Running jest, first with no arguments, then with the --watch
flag.
owner@G700:~/cp/projectName$ npm run test
> project_name@1.0.0 test /home/owner/cp/projectName
> jest
PASS src/classes/setupWizard/__tests__/SetupRole.test.ts
✓ SetupRole (4 ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 5.335 s
Ran all test suites.
owner@G700:~/cp/projectName$ npm run test
> project_name@1.0.0 test /home/owner/cp/projectName
> jest --watch
internal/fs/watchers.js:186
throw error;
^
Error: ENOSPC: System limit for number of file watchers reached, watch '/home/owner/cp/projectName/node_modules/fast-json-stable-stringify/test'
at FSWatcher.<computed> (internal/fs/watchers.js:178:26)
at Object.watch (fs.js:1445:34)
at NodeWatcher.watchdir (/home/owner/cp/projectName/node_modules/sane/src/node_watcher.js:159:22)
at Walker.<anonymous> (/home/owner/cp/projectName/node_modules/sane/src/common.js:109:31)
at Walker.emit (events.js:315:20)
at /home/owner/cp/projectName/node_modules/walker/lib/walker.js:69:16
at FSReqCallback.oncomplete (fs.js:163:23) {
errno: -28,
syscall: 'watch',
code: 'ENOSPC',
path: '/home/owner/cp/projectName/node_modules/fast-json-stable-stringify/test',
filename: '/home/owner/cp/projectName/node_modules/fast-json-stable-stringify/test'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project_name@1.0.0 test: `jest --watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project_name@1.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/owner/.npm/_logs/2020-06-05T00_30_53_889Z-debug.log
What would cause the error Error: ENOSPC: System limit for number of file watchers reached, watch
for a fairly small project?
Any suggestions on how to debug this are also welcome. I'm running Lubuntu 20.04, NodeJS 14.2.0, NPM 6.14.4.
// package.json
{
"name": "project_name",
"version": "1.0.0",
"description": "",
"main": "compiled/index.js",
"scripts": {
"test": "jest --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.10.2",
"@babel/preset-env": "^7.10.2",
"@babel/preset-typescript": "^7.10.1",
"@types/jest": "^25.2.3",
"@types/node": "^14.0.5",
"@types/readline-sync": "^1.4.3",
"babel-jest": "^26.0.1",
"jest": "^26.0.1",
"ts-jest": "^26.0.0",
"typescript": "^3.9.3"
},
"dependencies": {
"@google-cloud/text-to-speech": "^2.3.0",
"@google-cloud/translate": "^5.3.0",
"readline-sync": "^1.4.10"
},
"jest" : {
"preset" : "ts-jest"
, "modulePathIgnorePatterns" : ["compiled"]
}
}