You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I took a look into this. The issue you're experiencing is that jest.config.js is only configured to use babel-jest on *.tsx files. If you were to rename Hello.test.js to Hello.test.tsx it would work, but this is not ideal, since it's not a TypeScript component.
To support *.js extensions, you'd have to update your transform in jest.config.js to look something like:
transform: {'^.+\\.(js|tsx)?$': 'babel-jest',},
You will probably run into an error with this due to mismatched versions of babel-jest and jest. If you update both of those to be the same version (in this case, ^23.6.0), your tests should pass.
I've submitted a PR to make sure those versions are in sync.
…#5941)
This fixes the `with-jest-typescript` example to keep jest in sync with babel-jest (also updated to the latest of both). Having them resolve to different versions was resulting in weird errors.
When attempting to update the `transform` property in `jest.setup.js` to add babel-jest support to *.js/jsx files, it would throw:
> Plugin 0 specified in "node_modules/next/babel.js" provided an invalid property of "default" (While processing preset: "node_modules/next/babel.js")
Indirectly, this will fix#5917, once the author updates `jest.setup.js` to have:
```js
transform: {
'^.+\\.(js|tsx)?$': 'babel-jest',
},
```
lockbot
locked as resolved and limited conversation to collaborators
Dec 23, 2019
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Examples bug report
I just added simple test file(not typescript file) in with-jest-typescript example.
and Hello.js file is
Example name
with-jest-typescript
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Screenshots
System information
The text was updated successfully, but these errors were encountered: