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

Setup and teardown run in skipped suites and tests #5593

Closed
eyelidlessness opened this issue Feb 17, 2018 · 3 comments
Closed

Setup and teardown run in skipped suites and tests #5593

eyelidlessness opened this issue Feb 17, 2018 · 3 comments

Comments

@eyelidlessness
Copy link

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Setup and teardown (before* and after*) 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 and yarn 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:

{
    "modulePaths": [
        "<rootDir>/dist"
    ],
    "setupTestFrameworkScriptFile": "<rootDir>/dist/testHelpers/integrationTestSetup.js",
    "testEnvironment": "node",
    "testMatch": [
        "**/providers/*/integrationTests/**/manifests.test.js"
    ],
    "verbose": true
}

Node: 8.6.0
NPM: 5.6.0
OS: OS X 10.11.6

@eyelidlessness
Copy link
Author

I'd like to add a few notes on the impact this can have:

  1. 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.)

  2. 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.

  3. This can cause long-running tests to run significantly longer than expected.

@SimenB
Copy link
Member

SimenB commented Feb 17, 2018

Duplicate of #4820

@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.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants