fullstack-hy2020 / fullstack-hy2020.github.io

Home Page:https://fullstack-hy2020.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  1. after does not seem to run unless it is put inside of a describe block, yet all of the example code does not do this. So when you run your tests using npm test, the process never finishes and you have to Ctrl + C to force it to stop.
  2. In "Refactoring tests", beforeEach is only run once for the describe blocks rather than for each test 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).