question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Travis failing tests from react-scripts error

See original GitHub issue

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



travis_fold:start:git.checkout
travis_time:start:0bc7b7ba
$ 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


Setting environment variables from repository settings

$ 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"



> Successfully installed Yarn 0.24.5! Please open another terminal where the `yarn` command will now be available.



travis_time:end:12392424:start=1495209134696212767,finish=1495209136544733861,duration=1848521094
Setting up $PATH

$ export PATH=$HOME/.yarn/bin:$PATH

travis_fold:end:install.yarn
travis_fold:start:cache.1
Setting up build cache

$ export CASHER_DIR=$HOME/.casher

travis_time:start:243a4afc
$ Installing caching utilities

...

console.error node_modules/redux/lib/utils/warning.js:14

 ...

 PASS  src/components/routes/Orders/routes/OrderDetail/components/OrderDetail/components/OrderCustomerView/components/OrderCustomerBilling/OrderCustomerBilling.test.js

/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)

error Command failed with exit code 1.



travis_time:end:108ef955:start=1495209195561968992,finish=1495209221460338749,duration=25898369757


The command "yarn test -- --coverage" exited with 1.

travis_fold:start:cache.2
store build cache

travis_time:start:0cfd7d99


travis_time:end:0cfd7d99:start=1495209221468157758,finish=1495209221472322754,duration=4164996
travis_time:start:0edd64e8
changes detected, packing new archive

.

.

uploading archive



travis_time:end:0edd64e8:start=1495209221477099088,finish=1495209235877817140,duration=14400718052
travis_fold:end:cache.2


Done. Your build exited with 1.

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected):
  2. node -v:
  3. npm -v:

Then, specify:

  1. Operating system:
  2. 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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ron-liucommented, Nov 11, 2017

fetch-mock solved my similar issue, nock didn’t, didn’t try jest-fetch-mock.

1reaction
dylanjhacommented, Jul 16, 2017

This is what I was running into, this SO question had a fix: https://stackoverflow.com/questions/44700992/yarn-test-network-request-failed

Read more comments on GitHub >

github_iconTop Results From Across the Web

when i try to connect github repo and travis ci, there is error
im studying ' how to connect between github and travis. and my os is windows. i made '.travis.yml' file, dockerfile, Dockerfile.dev in react...
Read more >
Common Build Problems - Travis CI Docs
One possible cause for builds failing unexpectedly can be calling set -e (also known as set errexit ), either directly in your .travis.yml...
Read more >
Troubleshooting - Jest
Use this guide to resolve issues with Jest. Tests are Failing and You Don't Know Why​. Try using the debugging support built into...
Read more >
Running Tests | Create React App
By default, when you run npm test , Jest will only run the tests related to files changed since the last commit. This...
Read more >
Build Fails - Cannot find module - Travis CI Community
3.13s$ npm run test > bobbyhill@0.1.0 test > CI=false react-scripts test --env=jsdom FAIL src/components/_rtl-tests/Header.test.tsx ○ Test ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found