Node.js 24 cheatsheet

Node.js 24: Scripts and testing

5 common Node.js 24 tasks.

Run a package.json script

Run a script from the scripts section of package.json.

npm run build

Run the start script

Run the start script, falling back to node server.js when none is defined.

npm start

Run the test script

Run the test script from package.json.

npm test

Run tests with the built-in runner

Find and run test files with the node:test runner, no extra dependencies.

node --test

Run only matching tests

Run tests whose names match a pattern.

node --test --test-name-pattern="login"

Was this page helpful?