-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Tests fail since config not passed to babel-jest in v22 #5185
Comments
Seems like #5110 messed something up. Wanna send a PR guarding against missing config? EDIT: I suppose that's not the correct fix, you should send |
Wait, the fix on your side is this diff: diff --git i/test/preprocessor.js w/test/preprocessor.js
index 1e4703f..f6a801d 100644
--- i/test/preprocessor.js
+++ w/test/preprocessor.js
@@ -7,10 +7,10 @@ var aliasPreprocessor = require('jest-alias-preprocessor')(config);
var babelJest = require('babel-jest');
module.exports = {
- process: function(src, filename) {
+ process: function(src, filename, ...rest) {
if (filename.indexOf('node_modules') === -1) {
- src = babelJest.process(src, filename);
- src = aliasPreprocessor.process(src, filename);
+ src = babelJest.process(src, filename, ...rest);
+ src = aliasPreprocessor.process(src, filename, ...rest);
}
return src;
}, It means we have a breaking change on our hands though, so we should still guard against missing |
If |
Thanks, @SimenB. That works! |
Closing as it was wrong api usage. It worked previously because not all arguments were used, but they were part of the API |
Had the same issue, even though I had not explicitly upgraded beyond jest v21 After a day of debugging, and diffing yarn.lock files between releases and running yarn list: culprit turned out to be webpack-babel-jest@1.0.4 depends on babel-jest@>5.0.0. Bug fix was to put explicit dependency resolution in the package.json file ‘’’ |
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. |
Do you want to request a feature or report a bug?
There seems to be a bug in jest 22 / babel-jest 22 where the config is not passed to babel-jest, so it fails when trying to access config.moduleFileExtensions on line 107 of node_modules/babel-jest/build/index.js
I modified that file to log what it was receiving for arguments in the process() call and only the first two args were passed in.
What is the current behavior?
All tests fail with error in preprocessor. My preprocess is a basic babel + webpack setup.
My preprocessor:
The call to babel-jest fails:
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
andyarn test
.Reproduction repo: https://github.com/gricard/jest-preproc-bug-repro/
You can reproduce with this repo by running
npm run test
What is the expected behavior?
Tests should run as they normally do.
Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.
node v8.4.0
npm 5.4.2
jest 22.0.4
Windows 7
Also occurs in:
Mac OS 10.11
node v9.3.0
npm 5.6.0
jest 22.0.4
The text was updated successfully, but these errors were encountered: