Skip to content

Commit 64aa64b

Browse files
committed
fix: wrong stats when running with workers
1 parent f5a9157 commit 64aa64b

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

lib/command/workers/runTests.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,36 @@ const Codecept = require(process.env.CODECEPT_CLASS_PATH || '../../codecept')
2323
const { options, tests, testRoot, workerIndex, poolMode } = workerData
2424

2525
// hide worker output
26-
if (!options.debug && !options.verbose)
26+
// In pool mode, always hide worker output to prevent duplicate output
27+
// In regular mode, hide result output but allow step output in verbose/debug
28+
if (poolMode || (!options.debug && !options.verbose)) {
2729
process.stdout.write = string => {
2830
stdout += string
2931
return true
3032
}
33+
} else {
34+
// In verbose/debug mode for test/suite modes, show step details
35+
// but suppress individual worker result summaries to avoid duplicate output
36+
const originalWrite = process.stdout.write
37+
const originalConsoleLog = console.log
38+
39+
process.stdout.write = string => {
40+
// Suppress individual worker result summaries and failure reports
41+
if (string.includes(' FAIL |') || string.includes(' OK |') || string.includes('-- FAILURES:') || string.includes('AssertionError:') || string.includes('◯ File:') || string.includes('◯ Scenario Steps:')) {
42+
return true
43+
}
44+
return originalWrite.call(process.stdout, string)
45+
}
46+
47+
// Override console.log to catch result summaries
48+
console.log = (...args) => {
49+
const fullMessage = args.join(' ')
50+
if (fullMessage.includes(' FAIL |') || fullMessage.includes(' OK |') || fullMessage.includes('-- FAILURES:')) {
51+
return
52+
}
53+
return originalConsoleLog.apply(console, args)
54+
}
55+
}
3156

3257
const overrideConfigs = tryOrDefault(() => JSON.parse(options.override), {})
3358

0 commit comments

Comments
 (0)