codeceptjs 4.0.2-beta.12 → 4.0.2-beta.14
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/command/workers/runTests.js +27 -12
- package/package.json +1 -1
|
@@ -21,24 +21,29 @@ const { options, tests, testRoot, workerIndex, poolMode } = workerData
|
|
|
21
21
|
|
|
22
22
|
// Global error handlers to catch critical errors but not test failures
|
|
23
23
|
process.on('uncaughtException', (err) => {
|
|
24
|
+
// Log to stderr to bypass stdout suppression
|
|
25
|
+
process.stderr.write(`[Worker ${workerIndex}] UNCAUGHT EXCEPTION: ${err.message}\n`)
|
|
26
|
+
process.stderr.write(`${err.stack}\n`)
|
|
27
|
+
|
|
24
28
|
// Don't exit on test assertion errors - those are handled by mocha
|
|
25
29
|
if (err.name === 'AssertionError' || err.message?.includes('expected')) {
|
|
26
|
-
console.error(`[Worker ${workerIndex}] Test assertion error (handled by mocha):`, err.message)
|
|
27
30
|
return
|
|
28
31
|
}
|
|
29
|
-
console.error(`[Worker ${workerIndex}] Uncaught exception:`, err.message)
|
|
30
|
-
console.error(err.stack)
|
|
31
32
|
process.exit(1)
|
|
32
33
|
})
|
|
33
34
|
|
|
34
35
|
process.on('unhandledRejection', (reason, promise) => {
|
|
35
|
-
//
|
|
36
|
+
// Log to stderr to bypass stdout suppression
|
|
36
37
|
const msg = reason?.message || String(reason)
|
|
38
|
+
process.stderr.write(`[Worker ${workerIndex}] UNHANDLED REJECTION: ${msg}\n`)
|
|
39
|
+
if (reason?.stack) {
|
|
40
|
+
process.stderr.write(`${reason.stack}\n`)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Don't exit on test-related rejections
|
|
37
44
|
if (msg.includes('expected') || msg.includes('AssertionError')) {
|
|
38
|
-
console.error(`[Worker ${workerIndex}] Test rejection (handled by mocha):`, msg)
|
|
39
45
|
return
|
|
40
46
|
}
|
|
41
|
-
console.error(`[Worker ${workerIndex}] Unhandled rejection:`, reason)
|
|
42
47
|
process.exit(1)
|
|
43
48
|
})
|
|
44
49
|
|
|
@@ -136,8 +141,18 @@ initPromise = (async function () {
|
|
|
136
141
|
|
|
137
142
|
console.log(`[Worker ${workerIndex}] Loading config...`)
|
|
138
143
|
|
|
139
|
-
|
|
140
|
-
|
|
144
|
+
let baseConfig
|
|
145
|
+
try {
|
|
146
|
+
// IMPORTANT: await is required here since getConfig is async
|
|
147
|
+
baseConfig = await getConfig(options.config || testRoot)
|
|
148
|
+
console.log(`[Worker ${workerIndex}] Config loaded successfully`)
|
|
149
|
+
} catch (configErr) {
|
|
150
|
+
process.stderr.write(`[Worker ${workerIndex}] FAILED loading config: ${configErr.message}\n`)
|
|
151
|
+
process.stderr.write(`${configErr.stack}\n`)
|
|
152
|
+
// Ensure error is written before exit
|
|
153
|
+
await new Promise(resolve => setTimeout(resolve, 100))
|
|
154
|
+
process.exit(1)
|
|
155
|
+
}
|
|
141
156
|
|
|
142
157
|
console.log(`[Worker ${workerIndex}] Config loaded, creating Codecept...`)
|
|
143
158
|
|
|
@@ -153,8 +168,8 @@ initPromise = (async function () {
|
|
|
153
168
|
await codecept.init(testRoot)
|
|
154
169
|
console.log(`[Worker ${workerIndex}] Codecept initialized successfully`)
|
|
155
170
|
} catch (initErr) {
|
|
156
|
-
|
|
157
|
-
|
|
171
|
+
process.stderr.write(`[Worker ${workerIndex}] FAILED during codecept.init(): ${initErr.message}\n`)
|
|
172
|
+
process.stderr.write(`${initErr.stack}\n`)
|
|
158
173
|
process.exit(1)
|
|
159
174
|
}
|
|
160
175
|
|
|
@@ -186,8 +201,8 @@ initPromise = (async function () {
|
|
|
186
201
|
parentPort?.close()
|
|
187
202
|
}
|
|
188
203
|
} catch (err) {
|
|
189
|
-
|
|
190
|
-
|
|
204
|
+
process.stderr.write(`[Worker ${workerIndex}] FATAL ERROR: ${err.message}\n`)
|
|
205
|
+
process.stderr.write(`${err.stack}\n`)
|
|
191
206
|
process.exit(1)
|
|
192
207
|
}
|
|
193
208
|
})()
|