Closed eyelidlessness closed 6 years ago
I'd like to add a few notes on the impact this can have:
The Jest docs specifically call out isolating tests to ensure there isn't an inter-test conflict. Presumably this would be the same for setup and teardown. (This is not the problem in my case, but it might cause problems for others following this advice.)
Setup and teardown can cause side effects that do not impact the tests specifically, but are unexpected. In my case, I am (sadly but unavoidably) writing integration tests that cause irreversible side effects on an external service.
This can cause long-running tests to run significantly longer than expected.
Duplicate of #4820
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.
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Setup and teardown (
before*
andafter*
) is run for skipped suites (describe
) and tests (it
et al).If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can
yarn install
andyarn test
.https://repl.it/repls/MuddyYellowgreenEngineer
What is the expected behavior?
Setup and teardown will not be run for tests that are skipped.
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
As this is reproducible on repl.it, I'm not sure these will help narrow down the issue, but I'll provide them anyway to expedite the issue.
Config:
Node: 8.6.0 NPM: 5.6.0 OS: OS X 10.11.6