property assert | Node.js node:test module | Bun {
t.assert.deepStrictEqual(actual, expected);
});
// Omitting the type annotation will result in a compilation error.
test('example', t => {
t.assert.deepStrictEqual(actual, expected); // Error: 't' needs an explicit type annotation.
});
```"/> {
t.assert.deepStrictEqual(actual, expected);
});
// Omitting the type annotation will result in a compilation error.
test('example', t => {
t.assert.deepStrictEqual(actual, expected); // Error: 't' needs an explicit type annotation.
});
```"/>
BuildDocsReferenceGuidesBlogDiscord/
node:test/
default/
TestContext/
assertPassert
Search the reference...
/
BuildDocsReferenceGuidesBlogDiscord/
node:test/
default/
TestContext/
assertPassert
property
test.default.TestContext.assert {
t.assert.deepStrictEqual(actual, expected);
});
// Omitting the type annotation will result in a compilation error.
test('example', t => {
t.assert.deepStrictEqual(actual, expected); // Error: 't' needs an explicit type annotation.
});
```" data-algolia-static="false" data-algolia-merged="false" data-type="Property">readonly
assert:
TestContextAssertAn object containing assertion methods bound to the test context. The top-level functions from the node:assert module are exposed here for the purpose of creating test plans.
Note: Some of the functions from node:assert contain type assertions. If these are called via the TestContext assert object, then the context parameter in the test's function signature must be explicitly typed (ie. the parameter must have a type annotation), otherwise an error will be raised by the TypeScript compiler:
import { test, type TestContext } from 'node:test';
// The test function's context parameter must have a type annotation.
test('example', (t: TestContext) => {
t.assert.deepStrictEqual(actual, expected);
});
// Omitting the type annotation will result in a compilation error.
test('example', t => {
t.assert.deepStrictEqual(actual, expected); // Error: 't' needs an explicit type annotation.
});
Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlog Toolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco
We're hiring →