codeceptjs 4.0.2-beta.5 → 4.0.2-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/workers.js +16 -0
- package/package.json +1 -1
package/lib/workers.js
CHANGED
|
@@ -545,12 +545,16 @@ class Workers extends EventEmitter {
|
|
|
545
545
|
|
|
546
546
|
// Track last activity time to detect hanging workers
|
|
547
547
|
let lastActivity = Date.now()
|
|
548
|
+
let currentTest = null
|
|
548
549
|
const workerTimeout = 300000 // 5 minutes
|
|
549
550
|
|
|
550
551
|
const timeoutChecker = setInterval(() => {
|
|
551
552
|
const elapsed = Date.now() - lastActivity
|
|
552
553
|
if (elapsed > workerTimeout) {
|
|
553
554
|
console.error(`[Main] Worker appears to be hanging (no activity for ${Math.floor(elapsed/1000)}s). Terminating...`)
|
|
555
|
+
if (currentTest) {
|
|
556
|
+
console.error(`[Main] Last test: ${currentTest}`)
|
|
557
|
+
}
|
|
554
558
|
clearInterval(timeoutChecker)
|
|
555
559
|
worker.terminate()
|
|
556
560
|
}
|
|
@@ -558,6 +562,12 @@ class Workers extends EventEmitter {
|
|
|
558
562
|
|
|
559
563
|
worker.on('message', message => {
|
|
560
564
|
lastActivity = Date.now() // Update activity timestamp
|
|
565
|
+
|
|
566
|
+
// Track current test
|
|
567
|
+
if (message.event === event.test.started && message.data) {
|
|
568
|
+
currentTest = message.data.title || message.data.fullTitle
|
|
569
|
+
}
|
|
570
|
+
|
|
561
571
|
output.process(message.workerIndex)
|
|
562
572
|
|
|
563
573
|
// Handle test requests for pool mode
|
|
@@ -675,6 +685,9 @@ class Workers extends EventEmitter {
|
|
|
675
685
|
|
|
676
686
|
worker.on('error', err => {
|
|
677
687
|
console.error(`[Main] Worker error:`, err.message || err)
|
|
688
|
+
if (currentTest) {
|
|
689
|
+
console.error(`[Main] Failed during test: ${currentTest}`)
|
|
690
|
+
}
|
|
678
691
|
this.errors.push(err)
|
|
679
692
|
})
|
|
680
693
|
|
|
@@ -684,6 +697,9 @@ class Workers extends EventEmitter {
|
|
|
684
697
|
|
|
685
698
|
if (code !== 0) {
|
|
686
699
|
console.error(`[Main] Worker exited with code ${code}`)
|
|
700
|
+
if (currentTest) {
|
|
701
|
+
console.error(`[Main] Last test running: ${currentTest}`)
|
|
702
|
+
}
|
|
687
703
|
}
|
|
688
704
|
|
|
689
705
|
if (this.isPoolMode) {
|