codeceptjs 3.7.5-beta.10 → 3.7.5-beta.12

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.
@@ -86,23 +86,14 @@ module.exports = async function (options) {
86
86
  testPatterns.push(file)
87
87
  }
88
88
 
89
- // Extract exact test UIDs for precise filtering
90
- const failedTestUIDs = failedTestsData.tests
91
- .map(test => test.uid)
92
- .filter(Boolean)
89
+ // Create a map of exact test titles to target for filtering
90
+ const failedTestTitles = new Set(failedTestsData.tests.map(test => test.title).filter(Boolean))
93
91
 
94
- if (failedTestUIDs.length > 0) {
95
- // Pass UIDs to options for precise test filtering
96
- options.tests = failedTestUIDs
97
- output.print(`Targeting ${failedTestUIDs.length} specific failed tests by UID`)
92
+ if (failedTestTitles.size > 0) {
93
+ output.print(`Targeting ${failedTestTitles.size} specific failed tests by exact title matching`)
94
+ options.exactTestTitles = Array.from(failedTestTitles)
98
95
  } else {
99
- // Fallback to title-based grep if no UIDs available
100
- const testTitles = failedTestsData.tests.map(test => test.title).filter(Boolean)
101
- if (testTitles.length > 0) {
102
- const grepPattern = testTitles.map(title => `^${title.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}$`).join('|')
103
- options.grep = grepPattern
104
- output.print(`Targeting failed tests by title pattern (no UIDs available)`)
105
- }
96
+ output.print('No specific test titles found, running all tests in files')
106
97
  }
107
98
  } else {
108
99
  // Fallback: use test titles with exact match grep
@@ -219,20 +210,22 @@ async function runWithoutWorkers(config, options, testPatterns, failedTestsData,
219
210
  codecept.loadTests()
220
211
  }
221
212
 
222
- // If we have specific test UIDs, filter the loaded tests to only include those
223
- if (options.tests && options.tests.length > 0) {
213
+ // If we have specific test titles, filter the loaded tests to only include those
214
+ if (options.exactTestTitles && options.exactTestTitles.length > 0) {
224
215
  const Container = require('../container')
225
216
  const mocha = Container.mocha()
226
217
 
227
- // Filter suites to only include tests with matching UIDs
218
+ // Filter suites to only include tests with matching exact titles
228
219
  for (const suite of mocha.suite.suites) {
229
- suite.tests = suite.tests.filter(test => options.tests.includes(test.uid))
220
+ suite.tests = suite.tests.filter(test => {
221
+ return options.exactTestTitles.includes(test.title)
222
+ })
230
223
  }
231
224
 
232
225
  // Remove empty suites
233
226
  mocha.suite.suites = mocha.suite.suites.filter(suite => suite.tests.length > 0)
234
227
 
235
- output.print(`Filtered to ${options.tests.length} specific failed tests by UID`)
228
+ output.print(`Filtered to ${options.exactTestTitles.length} specific failed tests by exact title matching`)
236
229
  }
237
230
 
238
231
  if (options.verbose) {
@@ -190,6 +190,8 @@ module.exports = function (config) {
190
190
  fullTitle: testFullTitle,
191
191
  file: filePath,
192
192
  uid: testUid,
193
+ // Add stable identifier for targeting tests across runs
194
+ stableId: `${filePath}:${testTitle}`,
193
195
  timestamp: new Date().toISOString(),
194
196
  }
195
197
 
package/lib/workers.js CHANGED
@@ -312,18 +312,22 @@ class Workers extends EventEmitter {
312
312
 
313
313
  // If specific tests are provided (e.g., from run-failed-tests), only include those
314
314
  const targetTests = this.options && this.options.tests
315
+ const exactTestTitles = this.options && this.options.exactTestTitles
315
316
 
316
317
  mocha.suite.eachTest(test => {
317
318
  if (test) {
318
- // If we have specific target tests, only include matching UIDs
319
+ let shouldInclude = true
320
+
321
+ // If we have specific target tests by UID, only include matching UIDs
319
322
  if (targetTests && targetTests.length > 0) {
320
- if (targetTests.includes(test.uid)) {
321
- const i = groupCounter % groups.length
322
- groups[i].push(test.uid)
323
- groupCounter++
324
- }
325
- } else {
326
- // Default behavior: include all tests
323
+ shouldInclude = targetTests.includes(test.uid)
324
+ }
325
+ // If we have exact test titles, only include tests with matching titles
326
+ else if (exactTestTitles && exactTestTitles.length > 0) {
327
+ shouldInclude = exactTestTitles.includes(test.title)
328
+ }
329
+
330
+ if (shouldInclude) {
327
331
  const i = groupCounter % groups.length
328
332
  groups[i].push(test.uid)
329
333
  groupCounter++
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.7.5-beta.10",
3
+ "version": "3.7.5-beta.12",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",