part4b jest to node --test bugs
erikstantoncarlson opened this issue · comments
There are a few bugs I've run into so far while going through part4b after the test library was changed from jest
to node --test
:
after
does not seem to run unless it is put inside of adescribe
block, yet all of the example code does not do this. So when you run your tests usingnpm test
, the process never finishes and you have toCtrl + C
to force it to stop.- In "Refactoring tests",
beforeEach
is only run once for thedescribe
blocks rather than for eachtest
inside, so the test 'addition of a new note'/'fails with status code 400 if data invalid' always fails because the test 'succeeds with valid data' adds a note, but then beforeEach does not run to clear this from the db.
strange. what os are you using?
and what is the node version?
I'm on macOS Sonoma 14.2.1 and node.js v18.16.0.
I upgraded to the latest node.js v20.11.1 LTS and it fixed these problems.
In that case, I'd like to change my request for the course to specify which version of node.js we should be using for testing because older versions seem pretty janky.
yes, that is the problem. now the mention to use node 20.11 is in part 3, it needs to be added also to part 4...
Thank you!
the following is now added to material
Note this course material was written with version v20.11.0 of Node.js. Please make sure that your version of Node is at least as new as the version used in the material (you can check the version by running node -v in the command line).