Test

Node.js test module — test runner API. Provides test(), describe(), it(), before(), after(), beforeEach(), afterEach(), and mock.

Module: node:test Support: Experimental Since: 1.1.0 Docs: Node.js Docs See also: https://nodejs.org/api/test.html

Static Methods

🟢 test(name, options, fn)
Node.js test module — test runner API.
🟢 it(name, options, fn)
Alias for test(). Define and run a test case.
🟢 describe(name, options, fn)
Group tests into a suite.
🟢 suite(name, options, fn)
Alias for describe().
🟢 before(fn)
Register a function to run before all tests in the current suite.
🟢 after(fn)
Register a function to run after all tests in the current suite.
🟢 beforeEach(fn)
Register a function to run before each test in the current suite.
🟢 afterEach(fn)
Register a function to run after each test in the current suite.

Properties

🟢 mock
The mock object for creating spies and mocking timers.