codeceptjs 3.7.5-beta.2 → 3.7.5-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.
@@ -25,9 +25,11 @@ module.exports = async function (options) {
25
25
  const testRoot = getTestRoot(configFile)
26
26
  createOutputDir(config, testRoot)
27
27
 
28
- // Determine failed tests file path
29
- const failedTestsFile = options.file || './failed-tests.json'
30
- const failedTestsPath = path.resolve(process.cwd(), failedTestsFile)
28
+ // Determine failed tests file path - respect CodeceptJS output directory
29
+ const failedTestsFile = options.file || 'failed-tests.json'
30
+ const failedTestsPath = path.isAbsolute(failedTestsFile)
31
+ ? failedTestsFile
32
+ : path.resolve(global.output_dir || './output', failedTestsFile)
31
33
 
32
34
  // Check if failed tests file exists
33
35
  if (!fs.existsSync(failedTestsPath)) {
@@ -6,7 +6,7 @@ const store = require('../store')
6
6
 
7
7
  const defaultConfig = {
8
8
  enabled: true,
9
- outputFile: './failed-tests.json',
9
+ outputFile: 'failed-tests.json',
10
10
  clearOnSuccess: true,
11
11
  includeStackTrace: true,
12
12
  includeMetadata: true,
@@ -39,8 +39,13 @@ module.exports = function (config) {
39
39
  let allTestsPassed = true
40
40
  let workerFailedTests = new Map() // Track failed tests from workers
41
41
 
42
- // Track test failures
42
+ // Track test failures - only in non-worker mode
43
43
  event.dispatcher.on(event.test.failed, test => {
44
+ // In worker mode, we'll collect failed tests from consolidated results instead
45
+ if (store.hasWorkers) {
46
+ return
47
+ }
48
+
44
49
  allTestsPassed = false
45
50
 
46
51
  const failedTest = {
@@ -92,14 +97,29 @@ module.exports = function (config) {
92
97
 
93
98
  // Save failed tests to file after all tests complete
94
99
  event.dispatcher.on(event.all.result, (result) => {
95
- const outputPath = path.resolve(process.cwd(), options.outputFile)
100
+ // Respect CodeceptJS output directory like other plugins
101
+ const outputDir = global.output_dir || './output'
102
+ const outputPath = path.isAbsolute(options.outputFile)
103
+ ? options.outputFile
104
+ : path.resolve(outputDir, options.outputFile)
96
105
  let allFailedTests = [...failedTests]
97
106
 
98
107
  // In worker mode, collect failed tests from consolidated result
99
108
  if (store.hasWorkers && result && result.tests) {
100
109
  const workerFailedTests = result.tests.filter(test => test.state === 'failed' || test.err)
101
110
 
111
+ // Use a Set to track unique test identifiers to prevent duplicates
112
+ const existingTestIds = new Set(allFailedTests.map(test => test.uid || `${test.file}:${test.title}`))
113
+
102
114
  workerFailedTests.forEach(test => {
115
+ // Create unique identifier for deduplication
116
+ const testId = test.uid || `${test.file || 'unknown'}:${test.title}`
117
+
118
+ // Skip if we already have this test
119
+ if (existingTestIds.has(testId)) {
120
+ return
121
+ }
122
+
103
123
  const failedTest = {
104
124
  title: test.title,
105
125
  fullTitle: test.fullTitle || test.title,
@@ -144,6 +164,7 @@ module.exports = function (config) {
144
164
  }
145
165
 
146
166
  allFailedTests.push(failedTest)
167
+ existingTestIds.add(testId)
147
168
  })
148
169
  }
149
170
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.7.5-beta.2",
3
+ "version": "3.7.5-beta.4",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",