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

babel-jest does not vary cache by babel environment variables #3772

Closed
Met48 opened this issue Jun 8, 2017 · 10 comments · Fixed by #7239
Closed

babel-jest does not vary cache by babel environment variables #3772

Met48 opened this issue Jun 8, 2017 · 10 comments · Fixed by #7239

Comments

@Met48
Copy link
Contributor

Met48 commented Jun 8, 2017

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

Bug.

What is the current behavior?

Project uses babel-jest and has a .babelrc with configuration for the test env. The initial run of Jest used a non-test NODE_ENV and failed since the right babel transforms were not applied. After setting NODE_ENV=test, the tests continued to fail with the same error. Adding --no-cache temporarily fixes the error.

What is the expected behavior?

That the cache would vary by the environment variables babel checks, including NODE_ENV and BABEL_ENV.

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.

Empty Jest config.

Jest v20.0.4
Node v6.9.5
Yarn 0.23.4
NixOS 17.03

@thymikee
Copy link
Collaborator

What do you think @cpojer?

@cpojer
Copy link
Member

cpojer commented Jun 19, 2017 via email

@ajomadlabs
Copy link

@thymikee Could I go with this ?

@thymikee
Copy link
Collaborator

Sure!

@ajomadlabs
Copy link

@thymikee Since it's my first contribution, could you help me where to get started off

@thymikee
Copy link
Collaborator

Here you'll find how babel-jest calculates the cache key:
https://github.com/facebook/jest/blob/0285e63e903abbab9c323341e62eb68b29acd87e/packages/babel-jest/src/index.js#L85-L105

Looks like we also need to include information about NODE_NEV and BABEL_ENV (not sure about that though)

@njgraf512
Copy link

Appears to have been fixed by #3376

@Isaddo
Copy link

Isaddo commented Oct 2, 2018

I still have this problem on the latest version 23.6.0, relying on api.env() in babel.config.js to export different config.

@SimenB
Copy link
Member

SimenB commented Oct 2, 2018

PR welcome! Shouldn't be pretty straightforward :)

@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

Successfully merging a pull request may close this issue.

7 participants