-
-
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
transformIgnorePatterns not working when ignoring untranspiled package from another Github repo #11067
Comments
Hmm, this issue has the "Needs Repro" label on it yet it has repos that reproduce this issue. Can anyone with permissions to remove that label do so for me? |
should this:
be this?
|
did it help? |
Another gotcha where I just spent 2h is that the current version of Babel doesn't process files in |
I have jest configured in package.json
And I have configured babel.config.js
I am getting this error while running the tests -
If i remove the import of package @shopify/polaris-viz, the tests run successfully. |
It looks like that your configuration uses |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
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. |
🐛 Bug Report
I am currently running into an issue where a jest test is breaking because I'm importing a package in another repo I have created in my package.json which breaks the test that imports that package. Using transformIgnorePatterns to ignore this package should fix this issue, but it unfortunately does not.
To Reproduce
In the package.json of freddies_testing_playground, I link greeter, another repo I have created like so:
"Greeter" is a repo that I have setup that uses the Greeter example in the TypeScript docs to show an example of importing a Github repo in a package.json. Here's what the Greeter class looks in the greeter repo:
Unfortunately, a jest test in freddies_testing_playground breaks because of the greeter repo. A react component(I wanna stress up front, that the react component isn't breaking, as I have tested the component in the actual browser) called GreeterUI imports the greeter class like so:
The test uses react-testing-library, which I wanna stress is not the problem here, as I have another test in this repo that uses react-testing-library which works fine. Here's the code for the test that's breakiing:
When running the test suite using npm run test, this stack trace occurs:
Reading the stack trace, I have tried to set the transformIgnorePatterns in order for the greeter import so the import works. Here's the excerpt of what the transformIgnorePatterns does in my jest.config.js.
This still returns the same error, despite following the snippet from the jest docs on this that says:
I've done a bit of research on this issue, and found that this is a common error and I have tried to apply several solutions I've found with no luck. So any help on this issue would be much appreciated!
Expected behavior
The
GreeterUI
component should be able to be imported in my test and not break when importing the Greeter package.Link to repl or repo (highly encouraged)
https://github.com/Freddie-Pike/freddies_testing_playground -> The repo that uses the greeter package, broken test located in js/components/GreeterUI/tests/GreeterUI.test.jsx.
https://github.com/Freddie-Pike/greeter -> The repo that causes the test failure.
Greeter example in the TypeScript docs: https://www.typescriptlang.org/docs/handbook/classes.html
Github issues I found about this problem that unfortunately didn't help:
nrwl/nx#812
#6053
envinfo
The text was updated successfully, but these errors were encountered: