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's getCacheKey() doesn't take into account options passed to createTransformer() #6698

Closed
edmorley opened this issue Jul 15, 2018 · 1 comment · Fixed by #6699
Closed

Comments

@edmorley
Copy link
Contributor

🐛 Bug Report

babel-jest's getCacheKey uses a variety of factors to generate the hash used for the cache, however currently doesn't include the list of options that were passed to the createTransformer constructor. This means there are incorrect cache hits even when the underlying options have changed.

To Reproduce

Steps to reproduce the behavior:

  1. Create a custom transformer that's referenced by transform in the Jest config:
// transformer.js
const { createTransformer }  = require('babel-jest');

const babelOptions = { presets: ['env'] };

module.exports = createTransformer(babelOptions);
  1. Run jest
  2. Modify the value of babelOptions (for example enabling babel preset-env's debug option)
  3. Run jest again

Expected behavior

When Jest is run the second time, the previous cache entries are not re-used, and the changed babel config is seen in the results.


I'll open a PR to update getCacheKey():
https://github.com/facebook/jest/blob/d05e53a641366fcd1c2532ea845ce6fc8ce42a65/packages/babel-jest/src/index.js#L85-L105

@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

Successfully merging a pull request may close this issue.

1 participant