create-react-app: Travis failing tests from react-scripts error
If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.
Can you reproduce the problem with latest npm?
yes
Description
What are you reporting?
- Bug on Travis-CI when running tests
Expected behavior
Tell us what you think should happen.
- Travis should run tests without issues from core react-scripts package.
Actual behavior
Tell us what actually happens:
- Travis cancel’s build from throw in react-scripts:
/home/travis/build/<ORG>/<REPO>/node_modules/react-scripts/scripts/test.js:20
Raw log:
Build language: node_js
Build group: stable
Build dist: precise
Build id: 46417480
Job id: 76262059
travis-build version: 97c7efd0c
...
Reading package lists...
Building dependency tree...
Reading state information...
libc6 is already the newest version (2.15-0ubuntu10.18).
0 upgraded, 0 newly installed, 0 to remove and 41 not upgraded.
travis_fold:end:fix.CVE-2015-7547
[0K
travis_fold:start:git.checkout
[0Ktravis_time:start:0bc7b7ba
[0K$ git clone --depth=50 --branch=upgrade-react-scripts-1-0-0 git@github.com:whiplashmerch/whiplash-frontend.git whiplashmerch/whiplash-frontend
Cloning into 'whiplashmerch/whiplash-frontend'...
$ git checkout -qf 709fef5c26d1487e27a2ae27c5b5b2dad2747595
travis_fold:end:git.checkout
[0K
[33;1mSetting environment variables from repository settings[0m
$ export REACT_APP_AUTH_CLIENT_ID=[secure]
$ export REACT_APP_AUTH_CLIENT_SECRET=[secure]
$ export REACT_APP_AUTH_SCOPE=[secure]
$ export REACT_APP_FETCH_URL=[secure]
$ export REACT_APP_API_URL=[secure]
...
Computing checksum with sha256sum
Checksums matched!
Now using node v7.10.0 (npm v4.2.0)
export PATH="$HOME/.yarn/bin:$PATH"
[0m
[32m> Successfully installed Yarn 0.24.5! Please open another terminal where the `yarn` command will now be available.[0m
travis_time:end:12392424:start=1495209134696212767,finish=1495209136544733861,duration=1848521094
[0K[32;1mSetting up $PATH[0m
$ export PATH=$HOME/.yarn/bin:$PATH
travis_fold:end:install.yarn
[0Ktravis_fold:start:cache.1
[0KSetting up build cache
$ export CASHER_DIR=$HOME/.casher
travis_time:start:243a4afc
[0K$ Installing caching utilities
...
[2m[31mconsole.error[39m[22m [2mnode_modules/redux/lib/utils/warning.js:14[22m
...
[0m[7m[1m[32m PASS [39m[22m[27m[0m [2msrc/components/routes/Orders/routes/OrderDetail/components/OrderDetail/components/OrderCustomerView/components/OrderCustomerBilling/[22m[1mOrderCustomerBilling.test.js[22m
/home/travis/build/whiplashmerch/whiplash-frontend/node_modules/react-scripts/scripts/test.js:20
throw err;
^
TypeError: Network request failed
at XMLHttpRequest.xhr.onerror (/home/travis/build/whiplashmerch/whiplash-frontend/node_modules/whatwg-fetch/fetch.js:436:16)
at XMLHttpRequest.callback.(anonymous function) (/home/travis/build/whiplashmerch/whiplash-frontend/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:289:32)
at invokeEventListeners (/home/travis/build/whiplashmerch/whiplash-frontend/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:219:27)
at invokeInlineListeners (/home/travis/build/whiplashmerch/whiplash-frontend/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:166:7)
at EventTargetImpl._dispatch (/home/travis/build/whiplashmerch/whiplash-frontend/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:122:7)
at EventTargetImpl.dispatchEvent (/home/travis/build/whiplashmerch/whiplash-frontend/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:87:17)
at XMLHttpRequest.dispatchEvent (/home/travis/build/whiplashmerch/whiplash-frontend/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:61:35)
at XMLHttpRequest.abort (/home/travis/build/whiplashmerch/whiplash-frontend/node_modules/jsdom/lib/jsdom/living/xmlhttprequest.js:405:16)
at Object.abort (/home/travis/build/whiplashmerch/whiplash-frontend/node_modules/jsdom/lib/jsdom/living/xhr-utils.js:315:13)
at RequestManager.close (/home/travis/build/whiplashmerch/whiplash-frontend/node_modules/jsdom/lib/jsdom/living/nodes/Document-impl.js:146:21)
at Window.close (/home/travis/build/whiplashmerch/whiplash-frontend/node_modules/jsdom/lib/jsdom/browser/Window.js:362:29)
at JSDOMEnvironment.dispose (/home/travis/build/whiplashmerch/whiplash-frontend/node_modules/jest-environment-jsdom/build/index.js:44:19)
at Promise.resolve.then (/home/travis/build/whiplashmerch/whiplash-frontend/node_modules/jest-cli/build/runTest.js:102:17)
[2K[1G[31merror[39m Command failed with exit code 1.
travis_time:end:108ef955:start=1495209195561968992,finish=1495209221460338749,duration=25898369757
[0K
[31;1mThe command "yarn test -- --coverage" exited with 1.[0m
travis_fold:start:cache.2
[0Kstore build cache
travis_time:start:0cfd7d99
[0K
travis_time:end:0cfd7d99:start=1495209221468157758,finish=1495209221472322754,duration=4164996
[0Ktravis_time:start:0edd64e8
[0K[32;1mchanges detected, packing new archive[0m
.
.
[32;1muploading archive[0m
travis_time:end:0edd64e8:start=1495209221477099088,finish=1495209235877817140,duration=14400718052
[0Ktravis_fold:end:cache.2
[0K
Done. Your build exited with 1.
Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts
(if you haven’t ejected):node -v
:npm -v
:
Then, specify:
- Operating system:
- Browser and version:
Reproducible Demo
Please take the time to create a new app that reproduces the issue.
Alternatively, you could copy your app that experiences the problem and start removing things until you’re left with the minimal reproducible demo.
(Accidentally, you might get to the root of your problem during that process.)
Push to GitHub and paste the link here.
By doing this, you’re helping the Create React App contributors a big time! Demonstrable issues gets fixed faster.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18 (8 by maintainers)
fetch-mock
solved my similar issue,nock
didn’t, didn’t tryjest-fetch-mock
.This is what I was running into, this SO question had a fix: https://stackoverflow.com/questions/44700992/yarn-test-network-request-failed