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

Inconsistent caching behavior #5796

Closed
DaveStein opened this issue Mar 14, 2018 · 2 comments
Closed

Inconsistent caching behavior #5796

DaveStein opened this issue Mar 14, 2018 · 2 comments

Comments

@DaveStein
Copy link

Do you want to request a feature or report a bug?
Possible bug, but more likely this needs clarification in the docs.

What is the current behavior?
It is possible to have Jest cache be in two states when running NODE_ENV=test jest vs NODE_ENV=test jest --coverage --coverageDirectory=coverage. ie the issue described here with babel, was happening in only one case. It was very difficult to determine if this was an issue with babel, jest, or my machine setup since it appeared Jest could run perfectly normal when I used coverage report.

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.

Sorry, I have no idea how I got into that state as I was consistently running the coverage option, went back to check npm test was working, and saw it was broken.

What is the expected behavior?
When running Jest, if there is cached code, it would be the same whether I am running with or without coverage.

Please provide your exact Jest configuration
I am not using any config. Used all defaults, and used package.json to point at a setup file and that's it. Setup file should be unrelated but it's:

import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import jestFetch from 'jest-fetch-mock';

configure({ adapter: new Adapter() });
global.fetch = jestFetch;

Run npx envinfo --preset jest in your project directory and paste the
results here

  System:
    OS: macOS High Sierra 10.13.3
    CPU: x64 Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
  Binaries:
    Node: 8.10.0
    Yarn: Not Found
    npm: 5.7.1
  npmPackages:
    jest:
      wanted: ^22.1.4
      installed: 22.4.2
@SimenB
Copy link
Member

SimenB commented Feb 3, 2019

When running Jest, if there is cached code, it would be the same whether I am running with or without coverage.

That's an expectation that we cannot fulfil - in coverage mode we apply the istanbul plugin which injects coverage tracking code. So the code is different.

Gonna close as this behaves as intended. If this causes an issue, please open up a new issue with some reproduction steps. If you think anything needs to be clarified in the docs, don't hesitate to send a PR 🙂

@SimenB SimenB closed this as completed Feb 3, 2019
@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