remap-istanbul
remap-istanbul copied to clipboard
Maximum call stack size exceeded
I get an stack size error when i use remap-istanbul on windows.
RangeError: Maximum call stack size exceeded at Object.fs.mkdirSync (fs.js:916:18) at sync (..\node_modules\mkdirp\index.js:71:13) at sync (..\node_modules\mkdirp\index.js:77:24) at sync (..\node_modules\mkdirp\index.js:78:17) at sync (..\node_modules\mkdirp\index.js:78:17) ...
I think remap-istanbul must parse to many files on my project.
To solve this issue I added a timeout function to give node.js the chance to clear the stack.
loadCoverage.js
sources.forEach(function (filePath) {
setTimeout(() => {
collector.add(readJSON(filePath));
});
});
same issue. The setTimeout trick worked.
+1 on issue, workaround not tried.
Unfortunately my workaround runs not all the time correct because now you have async setTimeout on an sync call. So the timeout calls are not completed before the object is returned.
I think the solution ist to change the logic from sync calls to async, return a promise and resolve them.
Try only for test purpose node --stack_size=8192 node_modules/gulp/bin/gulp.js but this command depends on version of your nodejs
Two pence:
For me I was having the same issue with infinite loops
but it was caused by nested folders with windows drives in it C:\
which seemed to be causing this bug -> https://github.com/substack/node-mkdirp/issues/66
e.g. for example path creation : "C:\development\GW-Maintenance\frontend-projects\web-platform\C:\development\GW-Maintenance\frontend-projects\web-platform\src\components\products\performance\ft-calendar-year-returns\lib\en-us-retail"
from node_modules\istanbul\lib\util\file-writer.js
Looks like one solution might be to just go with a different library make-dir. Has anyone tried this?
i check the info that Anthony-Mckale provides. it seems if the driver of path does not exits, it will throw this error.
my case is that my container only have C:\ while I am trying to sync with D:. after change config to use C:\ as the driver of path, the problem fixed.