node:test

noun

say it: “NOHD TEST” /ˈnoʊd ˈtɛst/

Node's built-in test runner, so small projects can write and run tests with no extra package.

What does node:test do?

Node has a built-in test runner (node:test with node --test), so small projects need no extra test library.

import { test } from 'node:test';
import assert from 'node:assert';

test('adds tax', () => assert.equal(withTax(100), 108));

In a sentence

  • “The tests import test from node:test and run with node --test.”
  • “node:test comes with Node, so there's nothing to install.”

Level: Journeyman · More Node.js terms at this level

Updated