-
-
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
Incorrect transform for multiple projects with different transform in the same process #5855
Comments
The issue with your configuration is using custom transformer, which is not fully functional (e.g. doesn't have You should rather stick with default transformer and use const os = require("os");
const path = require("path");
const nativeConfig = {
displayName: "native",
preset: "jest-expo",
testMatch: ['**/*.test.native.js']
};
const webConfig = {
displayName: "web",
moduleNameMapper: {
"react-native": "react-native-web"
},
setupFiles: ["jest-canvas-mock"],
testMatch: ['**/*.test.web.js']
};
module.exports = {
projects: [nativeConfig, webConfig]
}; |
That simple example doesn't quite represent our real transformers, there's many other differences between the transformers for our web and native config besides just module mapping, it's not possible to do them using a default transformer and other options. |
I tried modifying the cache key, and the problem persists. Is this the right way? amosyuen/jest-projects-transform-error@e75baeb |
As far as I can tell, modifying the I think the problem is that the transformer is being cached between tests which require a different transformer. |
Pleas re-open until it's actually solved. |
I can confirm this issue still occurs. I have a similar use case where I have 2 projects - one that runs just unit tests and another that runs e2e screenshot tests (uses
screenshot.test.config.js
|
This should be fixed in #7186, can you install |
I tried upgrading to the
which I got past with a temporary hack (adding a
I am on |
Yes, the new version of Jest requires Babel 7. The first error is an unintended breaking change from #7408, wanna send a PR to fix it? |
I'm also seeing |
Yeah, the concat bug is pretty bad, I'll put up a PR. It'll work in node 9, 10 and 11, you probably ran one of those? |
I found the reason for the TypeError in my case: running an older version of Node.js 8. When I upgraded eslint it failed to install and printed this error:
After upgrading Node.js, Jest started running without errors too. You may want to update the |
PR: #7565 |
Closing as #7565 is merged now (and hopefully fixes the problem, please let us know). |
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?
Report a bug
What is the current behavior?
Jest uses the same transform for projects with different transform behavior if they run in the same process.
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
.Repository https://github.com/amosyuen/jest-projects-transform-error.
Running
yarn test
succeeds. But runningyarn test --runInBand
will fail. Error message indicates that the incorrect babel transform was used.What is the expected behavior?
Correct transform for the project should be used. Both
yarn test
andyarn test --runInBand
should succeed.Please provide your exact Jest configuration
https://github.com/amosyuen/jest-projects-transform-error/blob/master/jest.config.js
Run
npx envinfo --preset jest
in your project directory and paste theresults here
Environment:
OS: Windows 10
Node: 8.9.4
Yarn: 1.5.1
npm: 5.6.0
Watchman: Not Found
Xcode: N/A
Android Studio: Version 3.0.0.0 AI-171.4443003
The text was updated successfully, but these errors were encountered: