Docs (4.0.0)
class TestCase method

breakOnFail

Sets a flag to stop all other tests once this test case fails.

breakOnFail(): void

Notes

  • This method should be called at the start of a test function, if the success of this test is critical to other tests or if there’s no point to run any further tests if this test case fails.

Example

describe("Two tests", () => {
  test("Critical test", (t) => {
    t.breakOnFail();
    // ... do something critical here
  });
  test("Another test", () => {
    // ... this won't run if the above failed
  });
});

Related