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

testNamePattern runs beforeAll/afterAll in excluded suites #4820

Closed
felipeochoa opened this issue Nov 1, 2017 · 14 comments
Closed

testNamePattern runs beforeAll/afterAll in excluded suites #4820

felipeochoa opened this issue Nov 1, 2017 · 14 comments

Comments

@felipeochoa
Copy link
Contributor

Given a test file with the following contents:

describe("abc", function() {
  it("runs abc", function() {});
});

describe("def", function() {
  beforeAll(() => fail("Ran beforeAll for def"));
  it("does not run def", function() {
    fail("ran def");
  })
});

running jest -t abc runs the beforeAll callback in the def suite. The failure is reported under def › does not run def (though the summary at the bottom says "1 skipped, 1 passed, 2 total")

I would have expected the beforeAll function not to have run.

felipeochoa/jest-bug-demo is a basic repro repo.

Tested on jest 21.2.1, node 8.9.0, and yarn 1.0.1

@rogeliog
Copy link
Contributor

rogeliog commented Nov 1, 2017

Hi! Thanks for reporting, I'm also able to reproduce it

@rogeliog
Copy link
Contributor

rogeliog commented Nov 1, 2017

Seems like a duplicate of #4487 right?

@rogeliog rogeliog closed this as completed Nov 1, 2017
@rogeliog rogeliog reopened this Nov 1, 2017
@rogeliog
Copy link
Contributor

rogeliog commented Nov 1, 2017

cc: @aaronabramov

@timjacobi
Copy link

@rogeliog @aaronabramov
Is this being worked on and do you think this would be suitable to work on for someone that's new to the codebase? If the answers are no and yes then I would like to look into this.

@rogeliog
Copy link
Contributor

I think @aaronabramov would know better than me 😃

@aaronabramov
Copy link
Contributor

i think this is the way jasmine runs tests. I think it was fixed in Jasmine at some point, but we're still using the old/custom version of it.
@timjacobi you can try to find this issue in Jasmine repo, see how they fixed it and do something similar in our jasmine fork!

@timjacobi
Copy link

@aaronabramov #4166 (comment) says you are working on jest-circus which should fix the issue. Is this still the case?

@aaronabramov
Copy link
Contributor

@timjacobi unfortunately jest-circus is not the priority right now :(

@rogeliog
Copy link
Contributor

This seems to be the PR that fixed it in the Jasmine side, jasmine/jasmine#1225

@eyelidlessness
Copy link

My issue (#5593) was closed as a duplicate of this one, but I think mine captures several test cases that are not covered here, so I'll link to the repl.it repro in case it's helpful.

@SimenB SimenB removed this from the Jest 22 milestone Feb 18, 2018
@eisenbergrobin
Copy link

Any news on this issue ?

@SimenB
Copy link
Member

SimenB commented Apr 9, 2018

We tried to port the fix from Jasmine in #5051, but it didn't work. Help very much welcome!

@SimenB
Copy link
Member

SimenB commented May 30, 2018

Fixed in #6234

@SimenB SimenB closed this as completed May 30, 2018
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants