温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/node/test/default/TestContext/assert
点击访问原文链接

property assert | Node.js node:test module | Bun

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: TestContextAssert

An 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 runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

property assert | Node.js node:test module | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    An 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