codeceptjs 3.7.5-beta.2 → 3.7.5-beta.3

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,
@@ -92,14 +92,29 @@ module.exports = function (config) {
92
92
 
93
93
  // Save failed tests to file after all tests complete
94
94
  event.dispatcher.on(event.all.result, (result) => {
95
- const outputPath = path.resolve(process.cwd(), options.outputFile)
95
+ // Respect CodeceptJS output directory like other plugins
96
+ const outputDir = global.output_dir || './output'
97
+ const outputPath = path.isAbsolute(options.outputFile)
98
+ ? options.outputFile
99
+ : path.resolve(outputDir, options.outputFile)
96
100
  let allFailedTests = [...failedTests]
97
101
 
98
102
  // In worker mode, collect failed tests from consolidated result
99
103
  if (store.hasWorkers && result && result.tests) {
100
104
  const workerFailedTests = result.tests.filter(test => test.state === 'failed' || test.err)
101
105
 
106
+ // Use a Set to track unique test identifiers to prevent duplicates
107
+ const existingTestIds = new Set(allFailedTests.map(test => test.uid || `${test.file}:${test.title}`))
108
+
102
109
  workerFailedTests.forEach(test => {
110
+ // Create unique identifier for deduplication
111
+ const testId = test.uid || `${test.file || 'unknown'}:${test.title}`
112
+
113
+ // Skip if we already have this test
114
+ if (existingTestIds.has(testId)) {
115
+ return
116
+ }
117
+
103
118
  const failedTest = {
104
119
  title: test.title,
105
120
  fullTitle: test.fullTitle || test.title,
@@ -144,6 +159,7 @@ module.exports = function (config) {
144
159
  }
145
160
 
146
161
  allFailedTests.push(failedTest)
162
+ existingTestIds.add(testId)
147
163
  })
148
164
  }
149
165
 
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.3",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",