Rob Kielty
Rob Kielty

Reputation: 8152

npm test fails with error for reactjs app created with create-react-app

For a I have created some tests in a __test__ folder at the same level as the src

After running npm test the project folder I get the following error

How can I fix this so that I can run my tests?

jenkins@VBOX:dashboard$ npm test

> react-scripts test --env=jsdom
Determining test suites to run...fs.js:1236
    throw error;
    ^
Error: watch /home/jenkins/dev/git-stash/dashboard/node_modules/react-scripts/node_modules/babel-jest/node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument/node_modules/babel-types/node_modules/babel-runtime/node_modules/core-js/fn/symbol ENOSPC
    at exports._errnoException (util.js:907:11)
    at FSWatcher.start (fs.js:1234:19)
    at Object.fs.watch (fs.js:1262:11)
    at NodeWatcher.watchdir (/home/jenkins/dev/git-stash/dashboard/node_modules/react-scripts/node_modules/jest/node_modules/jest-cli/node_modules/sane/src/node_watcher.js:144:20)
    at Walker.<anonymous> (/home/jenkins/dev/git-stash/dashboard/node_modules/react-scripts/node_modules/jest/node_modules/jest-cli/node_modules/sane/src/node_watcher.js:353:12)
    at emitTwo (events.js:87:13)
    at Walker.emit (events.js:172:7)
    at /home/jenkins/dev/git-stash/dashboard/node_modules/react-scripts/node_modules/jest/node_modules/jest-cli/node_modules/sane/node_modules/walker/lib/walker.js:69:16
    at go$readdir$cb (/home/jenkins/dev/git-stash/dashboard/node_modules/react-scripts/node_modules/jest/node_modules/jest-cli/node_modules/graceful-fs/graceful-fs.js:149:14)
    at FSReqWrap.oncomplete (fs.js:82:15)
npm ERR! Test failed.  See above for more details.

Upvotes: 0

Views: 1603

Answers (3)

dmitry_romanov
dmitry_romanov

Reputation: 5425

Sometimes we hit the limit on the number of files we can watch simultaneously and we gains the error while having plenty of free space.

On Linux (Debian Wheezy, npm v3.10.10, node v6.10.2) it can be fixed by trying $ npm dedupe first, and, if still necessary, by

$ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Credits go to hexo.io.

Upvotes: 5

lifenjoy51
lifenjoy51

Reputation: 1

I got exactly same problem. and I solve this issue by installing newest npm. I got ENOSPC error with npm version 2.15.11. and it works well with v3.10.10.

Upvotes: 0

drew moore
drew moore

Reputation: 32680

So that nonsensical word in all caps at the end of the first line of every node error... that's an error code. This one was ENOSPC, which means "no space on drive".

i.e. your drive was full, You must've freed up space before running npm install again, and it was the former not the latter that fixed your problem.

Upvotes: 1

Related Questions