codeceptjs 4.0.1-beta.32 → 4.0.1-beta.34
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/helper/Playwright.js +1 -1
- package/lib/listener/helpers.js +2 -14
- package/lib/workers.js +5 -5
- package/package.json +2 -2
package/lib/helper/Playwright.js
CHANGED
|
@@ -912,7 +912,7 @@ class Playwright extends Helper {
|
|
|
912
912
|
}
|
|
913
913
|
|
|
914
914
|
async _finishTest() {
|
|
915
|
-
if (
|
|
915
|
+
if (this.isRunning) {
|
|
916
916
|
try {
|
|
917
917
|
await Promise.race([this._stopBrowser(), new Promise((_, reject) => setTimeout(() => reject(new Error('Test finish timeout')), 10000))])
|
|
918
918
|
} catch (e) {
|
package/lib/listener/helpers.js
CHANGED
|
@@ -73,30 +73,18 @@ export default function () {
|
|
|
73
73
|
})
|
|
74
74
|
|
|
75
75
|
event.dispatcher.on(event.all.result, () => {
|
|
76
|
-
// Skip _finishTest for all helpers if any browser helper restarts to avoid double cleanup
|
|
77
|
-
const hasBrowserRestart = Object.values(helpers).some(helper =>
|
|
78
|
-
(helper.config && (helper.config.restart === 'browser' || helper.config.restart === 'context' || helper.config.restart === true)) ||
|
|
79
|
-
(helper.options && (helper.options.restart === 'browser' || helper.options.restart === 'context' || helper.options.restart === true))
|
|
80
|
-
)
|
|
81
|
-
|
|
82
76
|
Object.keys(helpers).forEach(key => {
|
|
83
77
|
const helper = helpers[key]
|
|
84
|
-
if (helper._finishTest
|
|
78
|
+
if (helper._finishTest) {
|
|
85
79
|
recorder.add(`hook ${key}._finishTest()`, () => helper._finishTest(), true, false)
|
|
86
80
|
}
|
|
87
81
|
})
|
|
88
82
|
})
|
|
89
83
|
|
|
90
84
|
event.dispatcher.on(event.all.after, () => {
|
|
91
|
-
// Skip _cleanup for all helpers if any browser helper restarts to avoid double cleanup
|
|
92
|
-
const hasBrowserRestart = Object.values(helpers).some(helper =>
|
|
93
|
-
(helper.config && (helper.config.restart === 'browser' || helper.config.restart === 'context' || helper.config.restart === true)) ||
|
|
94
|
-
(helper.options && (helper.options.restart === 'browser' || helper.options.restart === 'context' || helper.options.restart === true))
|
|
95
|
-
)
|
|
96
|
-
|
|
97
85
|
Object.keys(helpers).forEach(key => {
|
|
98
86
|
const helper = helpers[key]
|
|
99
|
-
if (helper._cleanup
|
|
87
|
+
if (helper._cleanup) {
|
|
100
88
|
recorder.add(`hook ${key}._cleanup()`, () => helper._cleanup(), true, false)
|
|
101
89
|
}
|
|
102
90
|
})
|
package/lib/workers.js
CHANGED
|
@@ -530,9 +530,6 @@ class Workers extends EventEmitter {
|
|
|
530
530
|
}
|
|
531
531
|
|
|
532
532
|
worker.on('message', message => {
|
|
533
|
-
if (message.workerIndex !== undefined) {
|
|
534
|
-
console.log(`[DEBUG] Received message from worker with workerIndex: ${message.workerIndex}`)
|
|
535
|
-
}
|
|
536
533
|
output.process(message.workerIndex)
|
|
537
534
|
|
|
538
535
|
// Handle test requests for pool mode
|
|
@@ -607,7 +604,7 @@ class Workers extends EventEmitter {
|
|
|
607
604
|
if (!this._testStates) this._testStates = new Map()
|
|
608
605
|
|
|
609
606
|
if (!this._testStates.has(uid)) {
|
|
610
|
-
this._testStates.set(uid, { states: [], lastData: data })
|
|
607
|
+
this._testStates.set(uid, { states: [], lastData: data, workerIndex: message.workerIndex })
|
|
611
608
|
}
|
|
612
609
|
|
|
613
610
|
const testState = this._testStates.get(uid)
|
|
@@ -677,7 +674,10 @@ class Workers extends EventEmitter {
|
|
|
677
674
|
|
|
678
675
|
// Emit states for all tracked tests before emitting results
|
|
679
676
|
if (this._testStates) {
|
|
680
|
-
for (const [uid, { states, lastData }] of this._testStates) {
|
|
677
|
+
for (const [uid, { states, lastData, workerIndex }] of this._testStates) {
|
|
678
|
+
// Set correct worker index for output
|
|
679
|
+
output.process(workerIndex)
|
|
680
|
+
|
|
681
681
|
// For tests with retries configured, emit all failures + final success
|
|
682
682
|
// For tests without retries, emit only final state
|
|
683
683
|
const lastState = states[states.length - 1]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "4.0.1-beta.
|
|
3
|
+
"version": "4.0.1-beta.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Supercharged End 2 End Testing Framework for NodeJS",
|
|
6
6
|
"keywords": [
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"@apollo/server": "^5",
|
|
138
138
|
"@codeceptjs/expect-helper": "^1.0.2",
|
|
139
139
|
"@codeceptjs/mock-request": "0.3.1",
|
|
140
|
-
"@eslint/eslintrc": "3.3.
|
|
140
|
+
"@eslint/eslintrc": "3.3.3",
|
|
141
141
|
"@eslint/js": "9.39.2",
|
|
142
142
|
"@faker-js/faker": "9.8.0",
|
|
143
143
|
"@inquirer/testing": "^3.0.3",
|