When running Nightwatch tests I typically just run it like this:
nightwatch --test tests/file.js
I'm currently getting an error that looks like this:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - Javascript heap out of memory
1: node_module_register
2: v8::internal::FatalProcessOutOfMemory
3: v8::internal::FatalProcessOutOfMemory
4: v8::internal::Factory::NewRawTwoByteString
5: v8::internal::AsmJsScanner::IsNumberStart
6: 0000028B313843C1
I was looking up fixes and it seems node requires more memory in this scenario.
I tried the following but it didn't work.
node --max_old_space_size=8192 nightwatch --test tests/file.js
How should I rewrite the above line to make it work?
EDIT:
I've also tried:
npm install -g increase-memory-limit
increase-memory-limit
and also tried updating the package.json by adding:
"scripts": {
"fix-memory-limit": "cross-env LIMIT=2048 increase-memory-limit"
},
"devDependencies": {
"increase-memory-limit": "^1.0.3",
"cross-env": "^5.0.5"
}
Nightwatch may not be passing along the memory limits in any processes it spawns. You can set node options with environment variables, however. That should take effect for any spawned node processes:
npx cross-env NODE_OPTIONS="--max_old_space_size=8192" nightwatch --test tests/file.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With