Listen for Jest crashing, and restart the watcher
See original GitHub issueEnvironment
node -v
: 8.4- Operating system: macOS
Steps to Reproduce
Run Jest for a very long time. Get output like:
[83639:0x103000000] 2640294 ms: Mark-sweep 1403.7 (1559.1) -> 1403.7 (1559.1) MB, 1658.3 / 0.0 ms allocation failure GC in old space requested
[83639:0x103000000] 2642200 ms: Mark-sweep 1403.7 (1559.1) -> 1403.7 (1542.1) MB, 1905.3 / 0.0 ms last resort
[83639:0x103000000] 2644065 ms: Mark-sweep 1403.7 (1542.1) -> 1403.7 (1541.1) MB, 1863.2 / 0.0 ms last resort
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x3c40f489cef1 <JSObject>
2: stringSlice(aka stringSlice) [buffer.js:556] [bytecode=0x247d9e747009 offset=96](this=0x3c40f4882241 <undefined>,buf=0x173c99209f01 <Uint8Array map = 0x358156c43de1>,encoding=0x3c40f48fe879 <String[4]: utf8>,start=0,end=298264)
4: toString [buffer.js:629] [bytecode=0x247d9e746c41 offset=148](this=0x173c99209f01 <Uint8Array map = 0x358156c43de1>,encoding=0x3c40f48fe879 <String[4]: utf8...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1:
node::Abort() [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
2:
node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
3:
v8::internal::V8::FatalProcessOutOfMemory(char const*, bool)
[/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
4:
v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
5:
v8::internal::Factory::NewStringFromUtf8(v8::internal::Vector<char const>, v8::internal::PretenureFlag)
[/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
6:
v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int) [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
7:
node::StringBytes::Encode(v8::Isolate*, char const*, unsigned long, node::encoding, v8::Local<v8::Value>*)
[/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
8:
void node::Buffer::(anonymous namespace)::StringSlice<(node::encoding)1>(v8::FunctionCallbackInfo<v8::Value> const&)
[/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
9:
v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
10:
v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
11:
v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/orta/.nvm/versions/node/v8.4.0/bin/node]
12: 0x23c1f6a840dd
Closed Jest
Closed Jest
Expected Behavior
Restart the watcher, and continue, show a message that Jest crashed and was re-booted so that people are not confused.
Actual Behavior
The spinner indicating it is working continues to spin.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Jest watch restart fails for gatsby site with fs/watchers failure
Problem. When running jest —watch Jest keeps track of all files in the directory for updates via fsevents . When an item it...
Read more >Troubleshooting - Create React App
If the watcher doesn't see a file called index.js and you're referencing it by the folder name, you need to restart the watcher...
Read more >Get Notified if Your Server App Crashes on Linux
Ensure crash logs are instantly sent to your inbox. A server application behind an NGINX reverse proxy fails, causing the endpoint to show...
Read more >Let It Crash: Best Practices for Handling Node.js Errors on ...
In this post, I'll walk through some of the background on the Node.js process lifecycle and some strategies to properly handle graceful shutdown ......
Read more >Node.js Memory Leak Detection: How to Debug & Avoid Them
You can restart the app and make it all magically go away. ... These blocks can grow over time and lead to your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
there is one concern… if for some reason jest couldn’t be started, we will be firing it up continuously in that case… eventually killed vscode… maybe we should have a max restart count to safeguard this issue… thoughts?
Related: #49