Reputation: 1812
I am trying to execute karma unit test cases for my project. When I run the whole test cases which are available in the application, it is failing with the below error. But when I configure to run fewer test cases by executing all the controllers in a folder, it works. How to increase the memory size to execute all the test cases.
Tried searching but couldn't get any working solutions. Any guidance would be helpful.`
$ karma start karma.conf.js
#
# Fatal error in , line 0
# API fatal error handler returned after process out of memory
#
/c/Users/AB18082/AppData/Roaming/npm/karma: line 14: 20164 Segmentation fault node "$basedir/node_modules/karma-cli/bin/karma" "$@"
EDIT 1:
When i try to increase size
$ node --max_old_space_size=10240 node_modules/karma/bin/karma start karma.conf.js
<--- Last few GCs --->
[13860:002BF998] 214803 ms: Scavenge 1021.9 (1358.6) -> 1021.6 (1365.1) MB, 146.9 / 0.0 ms allocation failure
[13860:002BF998] 217090 ms: Mark-sweep 1026.8 (1365.9) -> 1014.7 (1355.9) MB, 2263.4 / 0.0 ms allocation failure GC in old space requested
[13860:002BF998] 217243 ms: Scavenge 1022.6 (1359.5) -> 1022.5 (1363.5) MB, 75.4 / 0.0 ms allocation failure
[13860:002BF998] 217479 ms: Scavenge 1029.7 (1364.1) -> 1029.6 (1366.6) MB, 225.5 / 0.0 ms allocation failure
<--- JS stacktrace --->
Cannot get stack trace in GC.
FATAL ERROR: NewSpace::Rebalance Allocation failed - process out of memory
EDIT 2:
After setting those node --max_old_space_size=4096 changes my application itself is not loading now. tried uninstalling the nodejs and cleared
Now getting these error when i start the application also.
FATAL ERROR: Committing semi space failed. Allocation failed - process out of memory
1: 00BF287E
2: 00FD3013
3: 00FD1B24
4: 00FD16FC
EDIT:3
After so much googling able to fix loading the application using the below cmd and still the testing is having the same issue.
env NODE_OPTIONS=--max_old_space_size=2048 node node_modules/webpack/bin/webpack
Upvotes: 1
Views: 1147
Reputation: 41
Your issue will resolve once you do changes in package.json like below
"scripts": {
"test": "node --max_old_space_size=4096 ./node_modules/karma/bin/karma start ./test-config/karma.conf.js",
"test-ci": "node --max_old_space_size=4096 ./node_modules/karma/bin/karma start ./test-config/karma.conf.js --single-run",
"test-coverage": "node --max_old_space_size=4096 ./node_modules/karma/bin/karma start ./test-config/karma.conf.js --coverage"
}
Upvotes: 1