codeceptjs 3.7.5-beta.11 → 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,21 +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
- // Use stable identifiers (file:title) instead of UIDs since UIDs change between runs
91
- const failedTestStableIds = failedTestsData.tests.map(test => test.stableId || `${test.file}:${test.title}`).filter(Boolean)
92
-
93
- if (failedTestStableIds.length > 0) {
94
- output.print(`Targeting failed tests by stable ID (${failedTestStableIds.length} tests)`)
95
- options.stableIds = failedTestStableIds
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))
91
+
92
+ if (failedTestTitles.size > 0) {
93
+ output.print(`Targeting ${failedTestTitles.size} specific failed tests by exact title matching`)
94
+ options.exactTestTitles = Array.from(failedTestTitles)
96
95
  } else {
97
- output.print('Targeting failed tests by title pattern (no stable IDs available)')
98
- // Fallback to grep pattern matching if no stable IDs
99
- const testTitles = failedTestsData.tests.map(test => test.title).filter(Boolean)
100
- if (testTitles.length > 0) {
101
- const escapedTitles = testTitles.map(title => title.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
102
- options.grep = new RegExp(`^(${escapedTitles.join('|')})$`)
103
- }
96
+ output.print('No specific test titles found, running all tests in files')
104
97
  }
105
98
  } else {
106
99
  // Fallback: use test titles with exact match grep
@@ -217,35 +210,22 @@ async function runWithoutWorkers(config, options, testPatterns, failedTestsData,
217
210
  codecept.loadTests()
218
211
  }
219
212
 
220
- // If we have specific test UIDs or stable IDs, filter the loaded tests to only include those
221
- if ((options.tests && options.tests.length > 0) || (options.stableIds && options.stableIds.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) {
222
215
  const Container = require('../container')
223
216
  const mocha = Container.mocha()
224
217
 
225
- // Filter suites to only include tests with matching UIDs or stable IDs
218
+ // Filter suites to only include tests with matching exact titles
226
219
  for (const suite of mocha.suite.suites) {
227
220
  suite.tests = suite.tests.filter(test => {
228
- // Check UID match first
229
- if (options.tests && options.tests.includes(test.uid)) {
230
- return true
231
- }
232
- // Check stable ID match
233
- if (options.stableIds) {
234
- const testFile = test.file || test.parent?.file || 'unknown'
235
- const testTitle = test.title || 'unknown'
236
- const testStableId = `${testFile}:${testTitle}`
237
- return options.stableIds.includes(testStableId)
238
- }
239
- return false
221
+ return options.exactTestTitles.includes(test.title)
240
222
  })
241
223
  }
242
224
 
243
225
  // Remove empty suites
244
226
  mocha.suite.suites = mocha.suite.suites.filter(suite => suite.tests.length > 0)
245
227
 
246
- const filterType = options.stableIds ? 'stable ID' : 'UID'
247
- const filterCount = options.stableIds ? options.stableIds.length : options.tests.length
248
- output.print(`Filtered to ${filterCount} specific failed tests by ${filterType}`)
228
+ output.print(`Filtered to ${options.exactTestTitles.length} specific failed tests by exact title matching`)
249
229
  }
250
230
 
251
231
  if (options.verbose) {
package/lib/workers.js CHANGED
@@ -312,7 +312,7 @@ 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 targetStableIds = this.options && this.options.stableIds
315
+ const exactTestTitles = this.options && this.options.exactTestTitles
316
316
 
317
317
  mocha.suite.eachTest(test => {
318
318
  if (test) {
@@ -322,12 +322,9 @@ class Workers extends EventEmitter {
322
322
  if (targetTests && targetTests.length > 0) {
323
323
  shouldInclude = targetTests.includes(test.uid)
324
324
  }
325
- // If we have specific target tests by stable ID, only include matching stable IDs
326
- else if (targetStableIds && targetStableIds.length > 0) {
327
- const testFile = test.file || test.parent?.file || 'unknown'
328
- const testTitle = test.title || 'unknown'
329
- const testStableId = `${testFile}:${testTitle}`
330
- shouldInclude = targetStableIds.includes(testStableId)
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)
331
328
  }
332
329
 
333
330
  if (shouldInclude) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.7.5-beta.11",
3
+ "version": "3.7.5-beta.12",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",