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

Test.concurrentIf method | bun:test module | Bun

Test.concurrentIf method | bun:test module | BunBuildDocsReferenceGuidesBlogDiscord/bun:test/Test/concurrentIfMconcurrentIf

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/bun:test/Test/concurrentIfMconcurrentIf

method

test.Test.concurrentIfconcurrentIf(condition: boolean): TestT>;

Runs the test concurrently with other concurrent tests, if condition is true.

@param condition

if the test should run concurrently

Referenced typesinterface TestT extends ReadonlyArrayunknown>>

Runs a test.

test("can check if using Bun", () => {
expect(Bun).toBeDefined();
});

test("can make a fetch() request", async () => {
const response = await fetch("https://example.com/");
expect(response.ok).toBe(true);
});

test("can set a timeout", async () => {
await Bun.sleep(100);
}, 50); // or { timeout: 50 }
concurrent: TestT>

Runs the test concurrently with other concurrent tests.

failing: TestT>

Marks this test as failing.

Use test.failing when you are writing a test and expecting it to fail. These tests will behave the other way normal tests do. If failing test will throw any errors then it will pass. If it does not throw it will fail.

test.failing is very similar to test.todo except that it always runs, regardless of the --todo flag.

only: TestT>

Skips all other tests, except this test.

serial: TestT>

Forces the test to run serially (not in parallel), even when the --concurrent flag is used.

skip: TestT>

Skips this test.

todo: TestT>

Marks this test as to be written or to be fixed.

These tests will not be executed unless the --todo flag is passed. With the flag, if the test passes, the test will be marked as fail in the results; you will have to remove the .todo or check that your test is implemented correctly.

concurrentIf(condition: boolean): TestT>;

Runs the test concurrently with other concurrent tests, if condition is true.

@param condition

if the test should run concurrently

eachT extends unknown[]>(table: readonly T[]): TestT>;eachT>(table: T[]): Test[T]>;failingIf(condition: boolean): TestT>;

Marks this test as failing, if condition is true.

@param condition

if the test should be marked as failing

if(condition: boolean): TestT>;

Runs this test, if condition is true.

This is the opposite of test.skipIf().

@param condition

if the test should run

serialIf(condition: boolean): TestT>;

Forces the test to run serially (not in parallel), if condition is true. This applies even when the --concurrent flag is used.

@param condition

if the test should run serially

skipIf(condition: boolean): TestT>;

Skips this test, if condition is true.

@param condition

if the test should be skipped

todoIf(condition: boolean): TestT>;

Marks this test as to be written or to be fixed, if condition is true.

@param condition

if the test should be marked TODO

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 →

Test.concurrentIf method | bun:test module | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for method bun:test.Test.concurrentIf | Bun