codeceptjs 4.0.2-beta.13 → 4.0.2-beta.15
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.
|
@@ -141,8 +141,18 @@ initPromise = (async function () {
|
|
|
141
141
|
|
|
142
142
|
console.log(`[Worker ${workerIndex}] Loading config...`)
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
|
|
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
|
+
}
|
|
146
156
|
|
|
147
157
|
console.log(`[Worker ${workerIndex}] Config loaded, creating Codecept...`)
|
|
148
158
|
|
|
@@ -153,6 +163,13 @@ initPromise = (async function () {
|
|
|
153
163
|
const optsWithChild = { ...options, child: workerIndex }
|
|
154
164
|
codecept = new Codecept(config, optsWithChild)
|
|
155
165
|
|
|
166
|
+
// Add staggered delay to prevent resource conflicts (e.g., browser port conflicts)
|
|
167
|
+
const delay = (workerIndex - 1) * 500 // 0ms, 500ms, 1000ms, etc.
|
|
168
|
+
if (delay > 0) {
|
|
169
|
+
console.log(`[Worker ${workerIndex}] Waiting ${delay}ms to stagger initialization...`)
|
|
170
|
+
await new Promise(resolve => setTimeout(resolve, delay))
|
|
171
|
+
}
|
|
172
|
+
|
|
156
173
|
console.log(`[Worker ${workerIndex}] Initializing Codecept...`)
|
|
157
174
|
try {
|
|
158
175
|
await codecept.init(testRoot)
|