Runs the test concurrently with other concurrent tests, if condition is true.
method
test.Test.concurrentIf
condition: boolean
@param condition
if the test should run concurrently
Referenced types
interface Test<T extends ReadonlyArray<unknown>>
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 }
- failing: Test<T>
Marks this test as failing.
Use
test.failingwhen 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.failingis very similar to test.todo except that it always runs, regardless of the--todoflag. - condition: boolean
Runs the test concurrently with other concurrent tests, if
conditionis true.@param conditionif the test should run concurrently