Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

196
Views
How to force Jest to exit a certain test file

I have a few e2e tests, one of them hangs and we can't find out why, so we want to use --forceExit. But, we don't want to force exit all the tests just a particular one because we use github actions + npm script to run these e2e tests.

How would I do that?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Hard to help without further information on your part.

However, if you want to quit a running test, you can always use a return statement.

For example (all tests should pass):

describe("exit a test", () => {
  it("good test 1", () => {
    const aSum = 1;

    expect(aSum).toBe(1);
  });

  it("uses a flag and a return statement to prevent test from failing", () => {
    const flag = true;

    if (flag) {
      return;
    }

    expect(flag).toBeFalsy();
  });

  it("good test 2", () => {
    const aSum = 1;

    expect(aSum).toBe(1);
  });
});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!