grunt-istanbul
grunt-istanbul copied to clipboard
Error: EMFILE, too many open files
I have a large JS project whose files I am trying to instrument. When I try to run "grunt instrument" with the following config:
instrument: {
files: 'src/js/**/*.js',
options: {
lazy: true,
basePath: 'target/coverage/instrument/'
}
}
I get the following error:
Fatal error: An error occurred in an async call.
cause stack is ...
Error: EMFILE, open 'src/js/lib/cultures/globalize.culture.hi.js'
async call history is ...
[ { function: 'readFile',
location: '/Users/jryding/Development/pure-cloud-browser-app/node_modules/grunt-istanbul/tasks/helpers.js:65:44',
mapping:
{ name: 'src/js/lib/cultures/globalize.culture.hi.js',
code: [Object] } } ]
Looking at a similar issue in the istanbul project, the problem there was that the code was asynchronously loading all of the files to run the action against them.
Digging into the error above at helpers.js:65, it looks like that line is also using an async call to load the files we want to instrument.
How many files do you want to instrument?
100? 1000? 10000 or more?
If i don't ignore ANY files, my project has just over 1000 files to instrument. Ignoring some files (e.g. lib/) bring it down to 600-800 files.
I expect this to grow over time.