react-scripts test fails on react-script@3.0.0
See original GitHub issueIs this a bug report?
Yes, react-scripts test
does not work since upgrading to version 3.0.0
.
Did you try recovering your dependencies?
Yes
Which terms did you search for in User Guide?
Cannot find module '/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/interopRequireDefault' from 'App.test.js'
Environment
Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Binaries:
Node: 11.14.0 - ~/.nvm/versions/node/v11.14.0/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.7.0 - ~/.nvm/versions/node/v11.14.0/bin/npm
Browsers:
Chrome: 73.0.3683.103
Firefox: Not Found
Safari: 12.0.3
npmPackages:
react: 16.8.6
react-dom: 16.8.6
react-scripts: 3.0.0
npmGlobalPackages:
create-react-app: Not Found
Steps to Reproduce
(Write your steps here:)
yarn install
yarn test
(runsreact-scripts test
)
Expected Behavior
Expected to pass all the tests but all of them are failing with same error, previously I used react-scripts@3.0.0-next.68
and it works with no problem but as I changed it to 3.0.0
error appeared everywhere.
UPDATED::
Errors are on both 3.0.0
and 3.0.0-next.68
UPDATE 2::
If I install babel-preset-react-app@7.0.2
in root of project all the tests will pass.
Actual Behavior
All the tests fails with errors
FAIL src/app/components/home/Home.spec.js
● Test suite failed to run
Cannot find module '../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/interopRequireDefault' from 'Home.spec.js'
1 | import React from 'react';
2 | import renderer from 'react-test-renderer';
> 3 | import {MemoryRouter} from 'react-router-dom'
| ^
4 |
5 | import Home from './Home';
6 |
at Resolver.resolveModule (../../node_modules/jest-resolve/build/index.js:229:17)
at Object.<anonymous> (src/app/components/home/Home.spec.js:3:30)
FAIL src/App.test.js
● Test suite failed to run
Cannot find module '../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/interopRequireDefault' from 'App.test.js'
1 | import React from 'react';
2 |
> 3 | test('Simple general test', () => {
| ^
4 | expect(true).toBe(true);
5 | });
at Resolver.resolveModule (../../node_modules/jest-resolve/build/index.js:229:17)
at Object.<anonymous> (src/App.test.js:3:30)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:8 (2 by maintainers)
Top Results From Across the Web
react-scripts - npm
react -scripts. This package includes scripts and configuration used by Create React App. Please refer to its documentation:.
Read more >Running Tests | Create React App
If your app uses a browser API that you need to mock in your tests or if you need a global setup before...
Read more >React application sudden break and causes Appropriate ...
I was using a create react app and all this while it was working fine until I ran npm install. I am not...
Read more >failed to load config "react-app/jest" to extend from - You.com
I just have the same error: for some reason, your react-scripts package is too old (mine was 1.1.5 ). Find and change it...
Read more >Unable to start app build with node version 14 which is ...
... with the following setup Node: 16.14.0 NPM: 8.3.1 react-scripts: ... our existing app, I am getting following error during npm start
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Removing the node_modules and running clean install (no lockfile) does not help with npm or yarn.
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.