Node.js module

node:test

The 'node:test' module is Node.js's built-in test runner that provides a zero-dependency testing framework. It supports test() functions, lifecycle hooks (before, after), and assertions.

Tests run in isolation with concurrent support, snapshot testing, and detailed reporting, making it a lightweight alternative to external test frameworks.

Works in Bun · notes

Basic test runner structure exists but lacks key features like mocking, snapshot testing, and timer manipulation/mocking. Use `bun:test` for a more complete testing solution.

Functions 1

  • test.default()

    The test() function is the value imported from the test module.

Namespaces 1