Does not load jest config from CRA
See original GitHub issueEnvironment
node -v
:v12.13.0
npm -v
:6.12.0
npm ls jest
ornpm ls react-scripts
(if you haven’t ejected):
npm ls jest
└─┬ react-scripts@3.2.0
└── jest@24.9.0
npm ls react-scripts
└── react-scripts@3.2.0
-
your vscode-jest settings if customized:
- jest.pathToJest? [fill]
- jest.pathToConfig? [fill]
- anything else that you think might be relevant? [fill]
-
Operating system: macOS High Sierra 10.13.6
Prerequisite
- are you able to run jest test from command line? yes
- how do you run your tests from command line? (for example:
npm run test
ornode_modules/.bin/jest
) npm run test
Steps to Reproduce
https://github.com/abumalick/vscode-test-cra/commit/1a787e8cf3513fa4e0b6d891a405a5330af5baac
Try to run vscode on this repository, you will see that vscode-jest’s test will fail. If you run yarn test
it will pass.
If you uncomment https://github.com/abumalick/vscode-test-cra/blob/master/src/App.test.js#L4 the test passes.
This shows that vscode-jest is not loading jest config of create-react-app
Relevant Debug Info
[fill]
Expected Behavior
It should load the config from create react app
Actual Behavior
It seems that it is not the same configuration
It seems that wallaby creates a jest configuration that will be generated from jest configuration of create-react-app ref: https://wallabyjs.com/docs/tutorial/react.html
Thank you for the extension
Issue Analytics
- State:
- Created 4 years ago
- Comments:8
Top GitHub Comments
@palcisto indeed, from the code here you can see it try to match against the default CRA test scripts, i.e.
react-scripts test
. Your test script has a prefixREACT_APP_ENV=beta
thus the plugin failed to recognize your project as a CRA project.You should be able to fix this by setting
jest.pathToJest
toyarn test
. see here for more info.@connectdotz thanks that helped.