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
Typescript library imports fail with Jest #9562
Comments
Hi @andrewbihl , there's a similar report in #7000 (comment) Can you try if setting the Eg. add
to your package.json |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue. |
Thank you, this indeed helped. It seems one of my packages uses ES module syntax with their new version. The tests couldn't handle that, but |
Describe the bug
Making a new React project with the defaults for typescript does not allow importing of a library when running a unit test.
I've put in a great deal of time trying to fix this in my project, but for this bug report I've simply started a new one with nothing more than the required steps to reproduce the error.
Running just these steps (and nothing else) causes the issue, even though all of the involved technologies (typescript, jest, react, create-react-app) claim to support the others.
Environment
current version of create-react-app: 3.4.1
running from /Users/...../34876/lib/node_modules/create-react-app
System:
OS: macOS 10.15.5
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Binaries:
Node: 14.4.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - /usr/local/bin/npm
Browsers:
Chrome: 84.0.4147.135
Firefox: 80.0
Safari: 13.1.1
npmPackages:
react: ^16.13.1 => 16.13.1
react-dom: ^16.13.1 => 16.13.1
react-scripts: 3.4.1 => 3.4.1
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
Steps to reproduce:
npx create-react-app app --typescript
yarn add ky
Add file src/fetch-a-thing.ts:
Run:
yarn test
.Output:
Expected behavior
Trivial test compiles and passes.
Actual behavior
Jest cannot run the test.
Reproducible demo
https://github.com/andrewbihl/jest-is-broken
The text was updated successfully, but these errors were encountered: