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

MatchersBuiltin.toBe method | bun:test module | Bun

MatchersBuiltin.toBe method | bun:test module | BunBuildDocsReferenceGuidesBlogDiscord/bun:test/MatchersBuiltin/toBeMtoBe

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/bun:test/MatchersBuiltin/toBeMtoBe

method

test.MatchersBuiltin.toBetoBe(expected: T): void;Asserts that a value equals what is expected.

For non-primitive values, like objects and arrays, use toEqual() instead.For floating-point numbers, use toBeCloseTo() instead.@param expectedthe expected value

expect(100 + 23).toBe(123); expect("d" + "og").toBe("dog"); expect([123]).toBe([123]); // fail, use toEqual() expect(3 + 0.14).toBe(3.14); // fail, use toBeCloseTo() // TypeScript errors: expect("hello").toBe(3.14); // typescript error + fail expect("hello").toBenumber>(3.14); // no typescript error, but still fails toBeX = T>(expected: NoInferX>): void;

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco

We're hiring →

智能索引记录