Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to skip tests in beforeEach #1208

Closed
daleharvey opened this issue May 7, 2014 · 4 comments
Closed

Ability to skip tests in beforeEach #1208

daleharvey opened this issue May 7, 2014 · 4 comments

Comments

@daleharvey
Copy link

We have a bunch of tests that we only run optionally based on the environment, we use various ways to do if (build time flags, just putting tests inside an if), but the best place for us to do it would be inside beforeEach, it would be nice if there was a way to provide something to done that indicated the test should be skipped

Can try coming up with a patch if that seems like something likely to be merged?

@JohnArrowwood
Copy link

I would also like to know how to do this. I played with it. If I throw an error, it stops all test execution. If I set the this.currentTest.pending flag to true, it still executes the test.

@boneskull
Copy link
Contributor

#332

@dangerbacon
Copy link

dangerbacon commented Jun 20, 2018

For anyone finding this issue: this little snippet of code should help you work around the issue:

beforeEach(function()
{
  if (YOUR_CONDITION_HERE) this.currentTest.fn = function() { this.skip(); }
});

@artyomtrityak
Copy link

you can also just use this.skip ie

beforeEach(function() {
  if (FAILED_TESTS[this.currentTest.file]) {
    this.skip();
  }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants