Jest not picking latest plugin from babel.config.js
See original GitHub issueI have my own babel plugin mentioned in babel.config.js and when I change the plugin, jest doesn’t pick the updated plugin code and breaks tests. When I run
npx jest --no-cache
, updated changes are picked up.
I do not want to run with --no-cache
everytime I update the plugin.
I am curious to know how jest picks the latest babel plugins, when they are updated in npm artifactory?
I have mentioned my plugin in babel.config.js as:
module.exports = function (api) {
api.cache(true);
const presets = ["@babel/preset-env", "@babel/preset-react"];
const plugins = [
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-runtime",
["module:@babel-plugin-dynamic-import-override", {
options: someOptions
}]
];
return {
presets,
plugins
};
}
Also, what changes do I make to my jest.config.js to make it pick the latest plugins?
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top Results From Across the Web
Jest not picking latest plugin from babel.config.js
I am curious to know how jest picks the latest babel plugins, when they are updated in npm artifactory? I have mentioned my...
Read more >babel-jest does not locate babel config when it is in root ...
js --rootDir . I get an error because I suppose that babel.config.js is not found: /packages/react-project ...
Read more >Configuring Jest
The configuration file should simply export an object: JavaScript; TypeScript ... Node.js core modules, like fs , are not mocked by default.
Read more >Babel Config option | ts-jest - GitHub Pages
ts-jest by default does NOT use Babel. But you may want to use it, especially if your code rely on Babel plugins to...
Read more >jest cannot use import statement outside a module
Ended up creating a new babel.config.js file specifically for the tests. Had a large .babelrc that wasn't getting picked up by jest no...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We don’t, and we won’t add it. It’s not a common use case to change the implementation of babel plugins while running tests, and we already have a way too big API. If you want you can extend
babel-jest
and add some sort of env variable to thegetCacheKey
function.https://jestjs.io/docs/en/configuration#transform-object-string-pathtotransformer-pathtotransformer-object
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.