codeceptjs 4.0.2-beta.2 → 4.0.2-beta.4

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.
@@ -40,11 +40,22 @@ export default async function (workerCount, selectedRuns, options) {
40
40
 
41
41
  output.print(`CodeceptJS v${Codecept.version()} ${output.standWithUkraine()}`)
42
42
  output.print(`Running tests in ${output.styles.bold(numberOfWorkers)} workers...`)
43
- output.print()
44
43
  store.hasWorkers = true
45
44
 
46
45
  const workers = new Workers(numberOfWorkers, config)
47
46
  workers.overrideConfig(overrideConfigs)
47
+
48
+ // Show test distribution after workers are initialized
49
+ await workers.bootstrapAll()
50
+
51
+ const workerObjects = workers.getWorkers()
52
+ output.print()
53
+ output.print('Test distribution:')
54
+ workerObjects.forEach((worker, index) => {
55
+ const testCount = worker.tests.length
56
+ output.print(` Worker ${index + 1}: ${testCount} test${testCount !== 1 ? 's' : ''}`)
57
+ })
58
+ output.print()
48
59
 
49
60
  workers.on(event.test.failed, test => {
50
61
  output.test.failed(test)
@@ -68,7 +79,6 @@ export default async function (workerCount, selectedRuns, options) {
68
79
  if (options.verbose) {
69
80
  await getMachineInfo()
70
81
  }
71
- await workers.bootstrapAll()
72
82
  await workers.run()
73
83
  } catch (err) {
74
84
  output.error(err)
@@ -116,7 +116,10 @@ initPromise = (async function () {
116
116
  // We'll reload test files fresh for each test request
117
117
  } else {
118
118
  // Legacy mode - filter tests upfront
119
+ console.log(`[Worker ${workerIndex}] Starting test filtering. Assigned ${tests.length} test UIDs`)
119
120
  filterTests()
121
+ const finalCount = mocha.suite.total()
122
+ console.log(`[Worker ${workerIndex}] After filtering: ${finalCount} tests to run`)
120
123
  }
121
124
 
122
125
  // run tests
@@ -126,6 +129,7 @@ initPromise = (async function () {
126
129
  await runTests()
127
130
  } else {
128
131
  // No tests to run, close the worker
132
+ console.error(`[Worker ${workerIndex}] ERROR: No tests found after filtering! Assigned ${tests.length} UIDs but none matched.`)
129
133
  parentPort?.close()
130
134
  }
131
135
  } catch (err) {
@@ -336,24 +340,24 @@ function filterTests() {
336
340
  mocha.files = files
337
341
  mocha.loadFiles()
338
342
 
339
- // Debug logging to help diagnose test filtering issues
340
- if (options.debug || options.verbose) {
341
- const allLoadedTests = [];
342
- mocha.suite.eachTest(test => {
343
- if (test) {
344
- allLoadedTests.push({ uid: test.uid, title: test.fullTitle() });
345
- }
346
- });
347
-
348
- console.log(`[Worker ${workerIndex}] Loaded ${allLoadedTests.length} tests, expecting ${tests.length} tests`);
349
-
350
- const loadedUids = new Set(allLoadedTests.map(t => t.uid));
351
- const missingTests = tests.filter(uid => !loadedUids.has(uid));
352
-
353
- if (missingTests.length > 0) {
354
- console.log(`[Worker ${workerIndex}] WARNING: ${missingTests.length} assigned tests not found in loaded files`);
355
- console.log(`[Worker ${workerIndex}] Missing UIDs:`, missingTests);
343
+ // Collect all loaded tests for debugging
344
+ const allLoadedTests = [];
345
+ mocha.suite.eachTest(test => {
346
+ if (test) {
347
+ allLoadedTests.push({ uid: test.uid, title: test.fullTitle() });
356
348
  }
349
+ });
350
+
351
+ console.log(`[Worker ${workerIndex}] Loaded ${allLoadedTests.length} tests from ${files.length} files`);
352
+ console.log(`[Worker ${workerIndex}] Expecting ${tests.length} test UIDs`);
353
+
354
+ const loadedUids = new Set(allLoadedTests.map(t => t.uid));
355
+ const missingTests = tests.filter(uid => !loadedUids.has(uid));
356
+
357
+ if (missingTests.length > 0) {
358
+ console.error(`[Worker ${workerIndex}] ERROR: ${missingTests.length} assigned tests NOT FOUND in loaded files!`);
359
+ console.error(`[Worker ${workerIndex}] Missing UIDs:`, missingTests);
360
+ console.error(`[Worker ${workerIndex}] Available UIDs:`, Array.from(loadedUids).slice(0, 5), '...');
357
361
  }
358
362
 
359
363
  // Recursively filter tests in all suites (including nested ones)
@@ -367,13 +371,6 @@ function filterTests() {
367
371
  for (const suite of mocha.suite.suites) {
368
372
  filterSuiteTests(suite)
369
373
  }
370
-
371
- // Verify final test count
372
- if (options.debug || options.verbose) {
373
- let finalCount = 0;
374
- mocha.suite.eachTest(() => finalCount++);
375
- console.log(`[Worker ${workerIndex}] After filtering: ${finalCount} tests will run`);
376
- }
377
374
  }
378
375
 
379
376
  function initializeListeners() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "4.0.2-beta.2",
3
+ "version": "4.0.2-beta.4",
4
4
  "type": "module",
5
5
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
6
6
  "keywords": [