Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upJest or Mocha tests fail if file execution order changes #1550
Comments
|
To solve the problem, I added an
|
Steps to reproduce
users"jest": "shx rm -f ./test_sqlite.sqlite && jest --forceExit"I tested with Jest and Mocha.
The tests only run if
app.test.tsruns first and creates the users schema. In the cases (and Jest seems to change the order of execution of the files) whenauthentication.test.tsruns first, the execution fails with the following error msg:As a Feather's newbie, what's the best way to initialize the database and add a
beforeAllandafterAllcall to make sure the db is always provided?Ideally, the generator should create this code in future versions.
Thanks!
Expected behavior
Generated tests should always pass
Actual behavior
Tests only pass is
app.test.tsis called first.System configuration
Tell us about the applicable parts of your setup.
Module versions (especially the part that's not working):
NodeJS version:
v10.16.3
Operating System:
Ubuntu 18.04 in WSL for Windows 10
Module Loader: commonjs