Files
react-native-devtools-frontend/node_modules/karma/devtools_disconnect_patch.patch
Jack Franklin 5c9a3b6b59 Karma: apply patch to prevent timeouts after test complete
In github.com/karma-runner/karma/pull/3852 it is suggested that the 30s
timeout issue with Karma can be seen when:

1. All the tests complete, which sets the state of Karma to
   "disconnected"
2. But there is some async activity which logs, or something. This
   causes Karma to restart its 30s timeout, but no more messages will be
   received.

This is a bit experimental, but trying this patch to see if it has a
positive impact on CQ.

Bug: 406729910
Change-Id: Iaaa9247c801e193e5782a0da4857d804bcc45a92
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6407593
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2025-03-28 04:41:42 -07:00

26 lines
1.0 KiB
Diff

diff --git a/node_modules/karma/lib/browser.js b/node_modules/karma/lib/browser.js
index aa87957925..2e4f7c5f2f 100644
--- a/node_modules/karma/lib/browser.js
+++ b/node_modules/karma/lib/browser.js
@@ -192,12 +192,14 @@ class Browser {
if (this.noActivityTimeout) {
this.clearNoActivityTimeout()
- this.noActivityTimeoutId = this.timer.setTimeout(() => {
- this.lastResult.totalTimeEnd()
- this.lastResult.disconnected = true
- this.disconnect(`, because no message in ${this.noActivityTimeout} ms.`)
- this.emitter.emit('browser_complete', this)
- }, this.noActivityTimeout)
+ if(this.state !== 'DISCONNECTED') {
+ this.noActivityTimeoutId = this.timer.setTimeout(() => {
+ this.lastResult.totalTimeEnd()
+ this.lastResult.disconnected = true
+ this.disconnect(`, because no message in ${this.noActivityTimeout} ms.`)
+ this.emitter.emit('browser_complete', this)
+ }, this.noActivityTimeout)
+ }
}
}