node:test Runner in Node.js

From the Node.js Core Modules cheat sheet · Modern Node.js (Built-in) · verified Jul 2026

node:test Runner

Built-in test runner with describe / it / assert — no Jest needed

javascript
import { test, describe, it, before, after, mock } from 'node:test'
import assert from 'node:assert/strict'

test('adds two numbers', () => {
  assert.equal(1 + 1, 2)
})

describe('User', () => {
  it('starts inactive', () => {
    const u = new User()
    assert.equal(u.active, false)
  })
})

// Run with:  node --test
// Run a single file: node --test test/user.test.js
// Watch mode:        node --test --watch
💡 No Jest, no vitest — `node --test` is enough for most projects
⚡ Built-in mock + mock.timers + watch mode + parallel files
📌 `node:assert/strict` is the assertion lib — same API as Jest expect-ish
🎯 TS works via `--experimental-strip-types --test` on Node 22.6+
testingmodern

More Node.js tasks

Back to the full Node.js Core Modules cheat sheet