使用 create-react-app 创建的 reactjs 应用程序的 npm 测试失败并出现错误

Rob*_*lty 0 reactjs jestjs create-react-app

对于__test__在与src

运行npm test项目文件夹后,我收到以下错误

我该如何解决这个问题,以便我可以运行我的测试?

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.
Run Code Online (Sandbox Code Playgroud)

dmi*_*nov 5

有时,我们达到了可以同时观看的文件数量的限制,并且在有足够的可用空间时会出现错误。

在 Linux(Debian Wheezy、npm v3.10.10、node v6.10.2)上,可以先尝试修复它$ npm dedupe,如果仍然需要,通过

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

积分转到hexo.io