failing

Bun

Symbol

Test.failing

failing(label: string, fn?: () => void | Promise<unknown> | (done: (err?: unknown) => void) => void, options?: number | TestOptions): void

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.

@param label

the label for the test

@param fn

the test function

@param options

the test timeout or options

Referenced types

interface TestOptions

  • repeats?: number

    Sets the number of times to repeat the test, regardless of whether it passed or failed.

  • retry?: number

    Sets the number of times to retry the test if it fails.

  • timeout?: number

    Sets the timeout for the test in milliseconds.

    If the test does not complete within this time, the test will fail with:

    'Timeout: test {name} timed out after 5000ms'