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

Matchers.toThrowError method | bun:test module | Bun

Matchers.toThrowError method | bun:test module | BunBuildDocsReferenceGuidesBlogDiscord/bun:test/Matchers/toThrowErrorMtoThrowError

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/bun:test/Matchers/toThrowErrorMtoThrowError

method

test.Matchers.toThrowErrortoThrowError(expected?: unknown): void;Asserts that a function throws an error.

If expected is a string or RegExp, it will check the message property.If expected is an Error object, it will check the name and message properties.If expected is an Error constructor, it will check the class of the Error.If expected is not provided, it will check if anything has thrown.@param expectedthe expected error, error message, or error pattern

function fail() { throw new Error("Oops!"); } expect(fail).toThrowError("Oops!"); expect(fail).toThrowError(/oops/i); expect(fail).toThrowError(Error); expect(fail).toThrowError();

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 →

智能索引记录