The simplest Continuous-Integration example for Node.js
-
Install the Node package manager:
brew install npm
-
Configure
package.json
for the desired testing framework. To use Jest, for example, add the following:"devDependencies": { "jest": "^29.7" }
-
Install the test framework configured in 2:
npm install
-
Perform a clean install:
npm ci
-
Check the install by running the tests:
npm test
If all is well, you should see output similar to this:
$ npm test > test > jest PASS ./sum.test.js ✓ adds 1 + 2 to equal 3 (1 ms) Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: 0.163 s Ran all test suites.
Adapted from Jest's Getting Started tutorial.