codeceptjs 3.7.5-beta.8 → 3.7.5-beta.9
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.
|
@@ -53,7 +53,7 @@ module.exports = function (config) {
|
|
|
53
53
|
|
|
54
54
|
// Only collect on final failure (when retries are exhausted or no retries configured)
|
|
55
55
|
const currentRetry = test._currentRetry || 0
|
|
56
|
-
const maxRetries = test.retries || 0
|
|
56
|
+
const maxRetries = typeof test.retries === 'function' ? test.retries() : (test.retries || 0)
|
|
57
57
|
|
|
58
58
|
// Only add to failed tests if this is the final attempt
|
|
59
59
|
if (currentRetry >= maxRetries) {
|
|
@@ -91,7 +91,7 @@ module.exports = function (config) {
|
|
|
91
91
|
duration: test.duration || 0,
|
|
92
92
|
// Only include retries if it represents actual retry attempts, not the config value
|
|
93
93
|
...(test._currentRetry > 0 && { actualRetries: test._currentRetry }),
|
|
94
|
-
...(
|
|
94
|
+
...(maxRetries > 0 && maxRetries !== -1 && { maxRetries: maxRetries }),
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -111,6 +111,7 @@ module.exports = function (config) {
|
|
|
111
111
|
|
|
112
112
|
// Handle test completion and save failed tests
|
|
113
113
|
event.dispatcher.on(event.all.result, (result) => {
|
|
114
|
+
|
|
114
115
|
// Respect CodeceptJS output directory like other plugins
|
|
115
116
|
const outputDir = global.output_dir || './output'
|
|
116
117
|
const outputPath = path.isAbsolute(options.outputFile)
|
|
@@ -118,14 +119,27 @@ module.exports = function (config) {
|
|
|
118
119
|
: path.resolve(outputDir, options.outputFile)
|
|
119
120
|
let allFailedTests = [...failedTests]
|
|
120
121
|
|
|
121
|
-
//
|
|
122
|
-
if (
|
|
123
|
-
|
|
122
|
+
// Collect failed tests from result (both worker and single-process modes)
|
|
123
|
+
if (result) {
|
|
124
|
+
let resultFailedTests = []
|
|
125
|
+
|
|
126
|
+
// Worker mode: result.tests
|
|
127
|
+
if (store.hasWorkers && result.tests) {
|
|
128
|
+
resultFailedTests = result.tests.filter(test => test.state === 'failed' || test.err)
|
|
129
|
+
}
|
|
130
|
+
// Single-process mode: result._failures or result._tests
|
|
131
|
+
else if (!store.hasWorkers && (result._failures || result._tests)) {
|
|
132
|
+
if (result._failures && result._failures.length > 0) {
|
|
133
|
+
resultFailedTests = result._failures.map(failure => failure.test || failure)
|
|
134
|
+
} else if (result._tests) {
|
|
135
|
+
resultFailedTests = result._tests.filter(test => test.state === 'failed' || test.err)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
124
138
|
|
|
125
139
|
// Use a Set to track unique test identifiers to prevent duplicates
|
|
126
140
|
const existingTestIds = new Set(allFailedTests.map(test => test.uid || `${test.file}:${test.title}`))
|
|
127
141
|
|
|
128
|
-
|
|
142
|
+
resultFailedTests.forEach(test => {
|
|
129
143
|
// Create unique identifier for deduplication
|
|
130
144
|
const testId = test.uid || `${test.file || 'unknown'}:${test.title}`
|
|
131
145
|
|
|
@@ -181,7 +195,7 @@ module.exports = function (config) {
|
|
|
181
195
|
existingTestIds.add(testId)
|
|
182
196
|
})
|
|
183
197
|
|
|
184
|
-
output.print(`Failed Tests Tracker: Collected ${
|
|
198
|
+
output.print(`Failed Tests Tracker: Collected ${resultFailedTests.length} failed tests from result`)
|
|
185
199
|
}
|
|
186
200
|
|
|
187
201
|
if (allFailedTests.length === 0) {
|
|
@@ -322,7 +336,7 @@ module.exports = function (config) {
|
|
|
322
336
|
allFailedTests.push(failedTest)
|
|
323
337
|
})
|
|
324
338
|
|
|
325
|
-
output.print(`Failed Tests Tracker: Collected ${
|
|
339
|
+
output.print(`Failed Tests Tracker: Collected ${allFailedTests.length - failedTests.length} failed tests from workers`)
|
|
326
340
|
}
|
|
327
341
|
|
|
328
342
|
if (allFailedTests.length === 0) {
|