question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to enable fail-fast only in specific tests or describes

See original GitHub issue

Is your feature request related to a problem? Please describe.

there is a certain percentage where we write test independent of other tests, and dependent of other tests. At the time of writing this request, this plugin fails fast when a test fails in a test file.

Describe the solution you’d like

This request is to only fail on dependent test(s). So some kind of configuration to say fail fast in this describe if we want to, but don’t fail fast on other test files when a failure occurred.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
MuckTcommented, Dec 29, 2020

@javierbrea I would find this incredibly useful. I’ve set-up some e2e tests for my project that walk through a process and if test 2 fails there’s no point in running the remaining it blocks. Then I have other tests where I would like all the tests to run regardless of a fail in the spec.

1reaction
javierbreacommented, Dec 29, 2020

Hi @chuckadams,

I think that your scenario could be solved with the options I am thinking to implement for this issue (the #33 one is related to fail-fast parallel executions in CI).

Once implemented, each describe or it would accept next options object:

{
  failFast: {
    enabled: true //false
  }
}

So, you could achieve what you are describing as:

describe("All tests", {
  failFast: {
    enabled: false, // Next tests and describes will inherit this value
  },
}, () => {
  it("sanity test", {
    failFast: {
      enabled: true, // Overwrite previously defined options
    },
  }, () => {
    // Will skip the rest of tests if this one fails
    expect(true).to.be.true;
  });

  it("second test",() => {
    // Will continue if this one fails, as it inherits the options in the parent `describe`
    expect(true).to.be.true;
  });

  it("third test",() => {
    // Will continue if this one fails, as it inherits the options in the parent `describe`
    expect(true).to.be.true;
  });
});

Thanks for your feedback! 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Option to abort on first failure · Issue #518 · cypress-io ...
I tried your solutions and the runner correctly stops. However, I'm looking for a way to only stop the current test scenario/test file/describe...
Read more >
`--fail-fast` option - Command line - RSpec Core
Use the --fail-fast option to tell RSpec to stop running the test suite on ... RSpec.describe "fail fast" do it "passing test" do;...
Read more >
Jest stop test suite after first fail
What I want, is to stop executing the current test suite when a test in that test suite fails. The --bail option is...
Read more >
cypress-fail-fast
Enables fail fast in Cypress, skipping the rest of tests on first failure. It can be configured to skip all remaining tests in...
Read more >
Testing in Java & JVM projects
The Test task has many generic configuration options as well as several framework-specific ones that you can find described in JUnitOptions, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found