Built-in Tests with Node.js
summary
A new built-in testing module node:test exists, imports require the runtime prefix and it supports CJS and ESM; migration from mocha is straightforward and a real project with five test files moves over in about eight months of use. Output formatting changes land in Node 20.2, and the runtime adds conveniences like test.skip/test.todo/test.only. The npm test (npm module) lets teams pin behaviour while upgrading, and the module is already used in production sites and packages.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 3:10Node.js built-in testing added
- 5:35Node test runner basics
- 8:25Improving test structure
- 11:02Real-world test with mocking
- 15:54Moving from Mocha to Node test
- 16:16Node test as standard tool
- 18:25Benefits of test npm package
- 21:16Node test growth
- 24:05Recent features and future
- 25:51Call for contributions
related talks
14mnode:test module
29mNode js in 2023 - What’s New in the Node.js Native Test Runner
31mGreat Expectations – Understanding nodejs Testing Frameworks
37mTesting in the Node.js World
24mBuild your own test runner
31mHow to Succeed with Node.js Testing
25mMaking JavaScript Tests Fast, Easy, and Friendly
27mAutomated Testing for the Modern Web
