Description
This issue about moving away from Jest to Node.js's Native Test Runner
Why
It would be great if we adopted Node.js's Test Runner (and moved away from Jest) because:
- Way less dependencies
- We only need JSDom to be set before the tests start running
- We can remove all the reporters/coverage generators and other dependencies
- It's way faster and native to Node.js
- It's natively ESM compatible which Jest isn't
- We don't need snapshots nor any fancy Jest functionality
Migration
- We still generate JUnit Test Reports for our GitHub Action
- Mocking of Modules cannot be done on "module name mapping" (https://github.com/nodejs/nodejs.org/blob/main/jest.config.mjs#L15-L17)
- Meaning the mocks we have on
__mocks__
folders need to be manually imported when used and need to be changed to use the Mocking API https://nodejs.org/api/test.html#mocking
- Meaning the mocks we have on
- Any usage of
jest.
APIs need to be replaced to Node Test Runners APIs - Any usage of
expect
needs to be changed toassert
(https://nodejs.org/api/assert.html) - Some pieces of code/tests might also need to be changed