dd-trace 5.69.0 → 5.70.0
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dd-trace",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.70.0",
|
|
4
4
|
"description": "Datadog APM tracing client for JavaScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"test:integration:playwright": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/playwright/*.spec.js\"",
|
|
62
62
|
"test:integration:selenium": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/selenium/*.spec.js\"",
|
|
63
63
|
"test:integration:vitest": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/vitest/*.spec.js\"",
|
|
64
|
-
"test:integration:testopt": "mocha --timeout
|
|
64
|
+
"test:integration:testopt": "mocha --timeout 90000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/ci-visibility/*.spec.js\"",
|
|
65
65
|
"test:integration:profiler": "mocha --timeout 180000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/profiler/*.spec.js\"",
|
|
66
66
|
"test:integration:plugins": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/datadog-plugin-@($(echo $PLUGINS))/test/integration-test/**/*.spec.js\"",
|
|
67
67
|
"test:unit:plugins": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/datadog-instrumentations/test/@($(echo $PLUGINS)).spec.js\" \"packages/datadog-plugin-@($(echo $PLUGINS))/test/**/*.spec.js\" --exclude \"packages/datadog-plugin-@($(echo $PLUGINS))/test/integration-test/**/*.spec.js\"",
|
|
@@ -11,12 +11,8 @@ const {
|
|
|
11
11
|
getTestLineStart,
|
|
12
12
|
getTestSuitePath,
|
|
13
13
|
getTestParametersString,
|
|
14
|
-
addEfdStringToTestName,
|
|
15
|
-
removeEfdStringFromTestName,
|
|
16
14
|
getIsFaultyEarlyFlakeDetection,
|
|
17
15
|
JEST_WORKER_LOGS_PAYLOAD_CODE,
|
|
18
|
-
addAttemptToFixStringToTestName,
|
|
19
|
-
removeAttemptToFixStringFromTestName,
|
|
20
16
|
getTestEndLine,
|
|
21
17
|
isModifiedTest
|
|
22
18
|
} = require('../../dd-trace/src/plugins/util/test')
|
|
@@ -92,6 +88,7 @@ const newTestsTestStatuses = new Map()
|
|
|
92
88
|
const attemptToFixRetriedTestsStatuses = new Map()
|
|
93
89
|
const wrappedWorkers = new WeakSet()
|
|
94
90
|
const testSuiteMockedFiles = new Map()
|
|
91
|
+
const testsToBeRetried = new Set()
|
|
95
92
|
|
|
96
93
|
const BREAKPOINT_HIT_GRACE_PERIOD_MS = 200
|
|
97
94
|
|
|
@@ -146,6 +143,8 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
|
|
|
146
143
|
|
|
147
144
|
const repositoryRoot = this.testEnvironmentOptions._ddRepositoryRoot
|
|
148
145
|
|
|
146
|
+
// TODO: could we grab testPath from `this.getVmContext().expect.getState()` instead?
|
|
147
|
+
// so we don't rely on context being passed (some custom test environment do not pass it)
|
|
149
148
|
if (repositoryRoot) {
|
|
150
149
|
this.testSourceFile = getTestSuitePath(context.testPath, repositoryRoot)
|
|
151
150
|
this.repositoryRoot = repositoryRoot
|
|
@@ -209,19 +208,31 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
|
|
|
209
208
|
}
|
|
210
209
|
}
|
|
211
210
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
211
|
+
/**
|
|
212
|
+
* Jest snapshot counter issue during test retries
|
|
213
|
+
*
|
|
214
|
+
* Problem:
|
|
215
|
+
* - Jest tracks snapshot calls using an internal counter per test name
|
|
216
|
+
* - Each `toMatchSnapshot()` call increments this counter
|
|
217
|
+
* - When a test is retried, it keeps the same name but the counter continues from where it left off
|
|
218
|
+
*
|
|
219
|
+
* Example Issue:
|
|
220
|
+
* Original test run creates: `exports["test can do multiple snapshots 1"] = "hello"`
|
|
221
|
+
* Retried test expects: `exports["test can do multiple snapshots 2"] = "hello"`
|
|
222
|
+
*
|
|
223
|
+
* This mismatch causes snapshot tests to fail on retry because Jest is looking
|
|
224
|
+
* for the wrong snapshot number. The solution is to reset the snapshot state.
|
|
225
|
+
*/
|
|
226
|
+
resetSnapshotState () {
|
|
217
227
|
try {
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
228
|
+
const expectGlobal = this.getVmContext().expect
|
|
229
|
+
const { snapshotState: { _counters: counters } } = expectGlobal.getState()
|
|
230
|
+
if (counters) {
|
|
231
|
+
counters.clear()
|
|
232
|
+
}
|
|
233
|
+
} catch (e) {
|
|
234
|
+
log.warn('Error resetting snapshot state', e)
|
|
222
235
|
}
|
|
223
|
-
this.hasSnapshotTests = hasSnapshotTests
|
|
224
|
-
return hasSnapshotTests
|
|
225
236
|
}
|
|
226
237
|
|
|
227
238
|
// This function returns an array if the known tests are valid and null otherwise.
|
|
@@ -293,18 +304,15 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
|
|
|
293
304
|
}
|
|
294
305
|
|
|
295
306
|
// Generic function to handle test retries
|
|
296
|
-
retryTest (
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
return
|
|
303
|
-
}
|
|
304
|
-
|
|
307
|
+
retryTest ({
|
|
308
|
+
jestEvent,
|
|
309
|
+
retryCount,
|
|
310
|
+
retryType
|
|
311
|
+
}) {
|
|
312
|
+
const { testName, fn, timeout } = jestEvent
|
|
305
313
|
for (let retryIndex = 0; retryIndex < retryCount; retryIndex++) {
|
|
306
314
|
if (this.global.test) {
|
|
307
|
-
this.global.test(
|
|
315
|
+
this.global.test(testName, fn, timeout)
|
|
308
316
|
} else {
|
|
309
317
|
log.error('%s could not retry test because global.test is undefined', retryType)
|
|
310
318
|
}
|
|
@@ -314,8 +322,7 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
|
|
|
314
322
|
// At the `add_test` event we don't have the test object yet, so we can't use it
|
|
315
323
|
getTestNameFromAddTestEvent (event, state) {
|
|
316
324
|
const describeSuffix = getJestTestName(state.currentDescribeBlock)
|
|
317
|
-
|
|
318
|
-
return removeAttemptToFixStringFromTestName(removeEfdStringFromTestName(fullTestName))
|
|
325
|
+
return describeSuffix ? `${describeSuffix} ${event.testName}` : event.testName
|
|
319
326
|
}
|
|
320
327
|
|
|
321
328
|
async handleTestEvent (event, state) {
|
|
@@ -337,25 +344,27 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
|
|
|
337
344
|
})
|
|
338
345
|
}
|
|
339
346
|
if (event.name === 'test_start') {
|
|
347
|
+
const testName = getJestTestName(event.test)
|
|
348
|
+
if (testsToBeRetried.has(testName)) {
|
|
349
|
+
// This is needed because we're trying tests with the same name
|
|
350
|
+
this.resetSnapshotState()
|
|
351
|
+
}
|
|
352
|
+
|
|
340
353
|
let isNewTest = false
|
|
341
354
|
let numEfdRetry = null
|
|
342
355
|
let numOfAttemptsToFixRetries = null
|
|
343
356
|
const testParameters = getTestParametersString(this.nameToParams, event.test.name)
|
|
344
|
-
// Async resource for this test is created here
|
|
345
|
-
// It is used later on by the test_done handler
|
|
346
|
-
const testName = getJestTestName(event.test)
|
|
347
|
-
const originalTestName = removeEfdStringFromTestName(removeAttemptToFixStringFromTestName(testName))
|
|
348
357
|
|
|
349
358
|
let isAttemptToFix = false
|
|
350
359
|
let isDisabled = false
|
|
351
360
|
let isQuarantined = false
|
|
352
361
|
if (this.isTestManagementTestsEnabled) {
|
|
353
|
-
isAttemptToFix = this.testManagementTestsForThisSuite?.attemptToFix?.includes(
|
|
354
|
-
isDisabled = this.testManagementTestsForThisSuite?.disabled?.includes(
|
|
355
|
-
isQuarantined = this.testManagementTestsForThisSuite?.quarantined?.includes(
|
|
362
|
+
isAttemptToFix = this.testManagementTestsForThisSuite?.attemptToFix?.includes(testName)
|
|
363
|
+
isDisabled = this.testManagementTestsForThisSuite?.disabled?.includes(testName)
|
|
364
|
+
isQuarantined = this.testManagementTestsForThisSuite?.quarantined?.includes(testName)
|
|
356
365
|
if (isAttemptToFix) {
|
|
357
|
-
numOfAttemptsToFixRetries = retriedTestsToNumAttempts.get(
|
|
358
|
-
retriedTestsToNumAttempts.set(
|
|
366
|
+
numOfAttemptsToFixRetries = retriedTestsToNumAttempts.get(testName)
|
|
367
|
+
retriedTestsToNumAttempts.set(testName, numOfAttemptsToFixRetries + 1)
|
|
359
368
|
} else if (isDisabled) {
|
|
360
369
|
event.test.mode = 'skip'
|
|
361
370
|
}
|
|
@@ -375,17 +384,17 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
|
|
|
375
384
|
}
|
|
376
385
|
|
|
377
386
|
if (this.isKnownTestsEnabled) {
|
|
378
|
-
isNewTest = retriedTestsToNumAttempts.has(
|
|
387
|
+
isNewTest = retriedTestsToNumAttempts.has(testName)
|
|
379
388
|
}
|
|
380
389
|
|
|
381
390
|
if (this.isEarlyFlakeDetectionEnabled && (isNewTest || isModified)) {
|
|
382
|
-
numEfdRetry = retriedTestsToNumAttempts.get(
|
|
383
|
-
retriedTestsToNumAttempts.set(
|
|
391
|
+
numEfdRetry = retriedTestsToNumAttempts.get(testName)
|
|
392
|
+
retriedTestsToNumAttempts.set(testName, numEfdRetry + 1)
|
|
384
393
|
}
|
|
385
394
|
|
|
386
395
|
const isJestRetry = event.test?.invocations > 1
|
|
387
396
|
const ctx = {
|
|
388
|
-
name:
|
|
397
|
+
name: testName,
|
|
389
398
|
suite: this.testSuite,
|
|
390
399
|
testSourceFile: this.testSourceFile,
|
|
391
400
|
displayName: this.displayName,
|
|
@@ -431,24 +440,22 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
|
|
|
431
440
|
}
|
|
432
441
|
|
|
433
442
|
if (event.name === 'add_test') {
|
|
434
|
-
const originalTestName = this.getTestNameFromAddTestEvent(event, state)
|
|
435
|
-
|
|
436
443
|
if (event.failing) {
|
|
437
444
|
return
|
|
438
445
|
}
|
|
439
446
|
|
|
447
|
+
const testFullName = this.getTestNameFromAddTestEvent(event, state)
|
|
440
448
|
const isSkipped = event.mode === 'todo' || event.mode === 'skip'
|
|
441
449
|
if (this.isTestManagementTestsEnabled) {
|
|
442
|
-
const isAttemptToFix = this.testManagementTestsForThisSuite?.attemptToFix?.includes(
|
|
443
|
-
if (isAttemptToFix && !isSkipped && !retriedTestsToNumAttempts.has(
|
|
444
|
-
retriedTestsToNumAttempts.set(
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
'Test Management (Attempt to Fix)'
|
|
450
|
-
|
|
451
|
-
)
|
|
450
|
+
const isAttemptToFix = this.testManagementTestsForThisSuite?.attemptToFix?.includes(testFullName)
|
|
451
|
+
if (isAttemptToFix && !isSkipped && !retriedTestsToNumAttempts.has(testFullName)) {
|
|
452
|
+
retriedTestsToNumAttempts.set(testFullName, 0)
|
|
453
|
+
testsToBeRetried.add(testFullName)
|
|
454
|
+
this.retryTest({
|
|
455
|
+
jestEvent: event,
|
|
456
|
+
retryCount: testManagementAttemptToFixRetries,
|
|
457
|
+
retryType: 'Test Management (Attempt to Fix)'
|
|
458
|
+
})
|
|
452
459
|
}
|
|
453
460
|
}
|
|
454
461
|
if (this.isImpactedTestsEnabled) {
|
|
@@ -461,29 +468,27 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
|
|
|
461
468
|
this.modifiedTestsForThisSuite,
|
|
462
469
|
'jest'
|
|
463
470
|
)
|
|
464
|
-
if (isModified && !retriedTestsToNumAttempts.has(
|
|
465
|
-
retriedTestsToNumAttempts.set(
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
'
|
|
471
|
-
|
|
472
|
-
)
|
|
471
|
+
if (isModified && !retriedTestsToNumAttempts.has(testFullName) && this.isEarlyFlakeDetectionEnabled) {
|
|
472
|
+
retriedTestsToNumAttempts.set(testFullName, 0)
|
|
473
|
+
testsToBeRetried.add(testFullName)
|
|
474
|
+
this.retryTest({
|
|
475
|
+
jestEvent: event,
|
|
476
|
+
retryCount: earlyFlakeDetectionNumRetries,
|
|
477
|
+
retryType: 'Impacted tests'
|
|
478
|
+
})
|
|
473
479
|
}
|
|
474
480
|
}
|
|
475
481
|
if (this.isKnownTestsEnabled) {
|
|
476
|
-
const isNew = !this.knownTestsForThisSuite.includes(
|
|
477
|
-
if (isNew && !isSkipped && !retriedTestsToNumAttempts.has(
|
|
478
|
-
retriedTestsToNumAttempts.set(
|
|
482
|
+
const isNew = !this.knownTestsForThisSuite.includes(testFullName)
|
|
483
|
+
if (isNew && !isSkipped && !retriedTestsToNumAttempts.has(testFullName)) {
|
|
484
|
+
retriedTestsToNumAttempts.set(testFullName, 0)
|
|
479
485
|
if (this.isEarlyFlakeDetectionEnabled) {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
'Early flake detection'
|
|
485
|
-
|
|
486
|
-
)
|
|
486
|
+
testsToBeRetried.add(testFullName)
|
|
487
|
+
this.retryTest({
|
|
488
|
+
jestEvent: event,
|
|
489
|
+
retryCount: earlyFlakeDetectionNumRetries,
|
|
490
|
+
retryType: 'Early flake detection'
|
|
491
|
+
})
|
|
487
492
|
}
|
|
488
493
|
}
|
|
489
494
|
}
|
|
@@ -502,15 +507,14 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
|
|
|
502
507
|
let isAttemptToFix = false
|
|
503
508
|
if (this.isTestManagementTestsEnabled) {
|
|
504
509
|
const testName = getJestTestName(event.test)
|
|
505
|
-
|
|
506
|
-
isAttemptToFix = this.testManagementTestsForThisSuite?.attemptToFix?.includes(originalTestName)
|
|
510
|
+
isAttemptToFix = this.testManagementTestsForThisSuite?.attemptToFix?.includes(testName)
|
|
507
511
|
if (isAttemptToFix) {
|
|
508
|
-
if (attemptToFixRetriedTestsStatuses.has(
|
|
509
|
-
attemptToFixRetriedTestsStatuses.get(
|
|
512
|
+
if (attemptToFixRetriedTestsStatuses.has(testName)) {
|
|
513
|
+
attemptToFixRetriedTestsStatuses.get(testName).push(status)
|
|
510
514
|
} else {
|
|
511
|
-
attemptToFixRetriedTestsStatuses.set(
|
|
515
|
+
attemptToFixRetriedTestsStatuses.set(testName, [status])
|
|
512
516
|
}
|
|
513
|
-
const testStatuses = attemptToFixRetriedTestsStatuses.get(
|
|
517
|
+
const testStatuses = attemptToFixRetriedTestsStatuses.get(testName)
|
|
514
518
|
// Check if this is the last attempt to fix.
|
|
515
519
|
// If it is, we'll set the failedAllTests flag to true if all the tests failed
|
|
516
520
|
// If all tests passed, we'll set the attemptToFixPassed flag to true
|
|
@@ -531,14 +535,13 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
|
|
|
531
535
|
// We'll store the test statuses of the retries
|
|
532
536
|
if (this.isKnownTestsEnabled) {
|
|
533
537
|
const testName = getJestTestName(event.test)
|
|
534
|
-
const
|
|
535
|
-
const isNewTest = retriedTestsToNumAttempts.has(originalTestName)
|
|
538
|
+
const isNewTest = retriedTestsToNumAttempts.has(testName)
|
|
536
539
|
if (isNewTest) {
|
|
537
|
-
if (newTestsTestStatuses.has(
|
|
538
|
-
newTestsTestStatuses.get(
|
|
540
|
+
if (newTestsTestStatuses.has(testName)) {
|
|
541
|
+
newTestsTestStatuses.get(testName).push(status)
|
|
539
542
|
isEfdRetry = true
|
|
540
543
|
} else {
|
|
541
|
-
newTestsTestStatuses.set(
|
|
544
|
+
newTestsTestStatuses.set(testName, [status])
|
|
542
545
|
}
|
|
543
546
|
}
|
|
544
547
|
}
|
|
@@ -951,13 +954,12 @@ function getCliWrapper (isNewJestVersion) {
|
|
|
951
954
|
|
|
952
955
|
for (const { testName, testSuiteAbsolutePath } of failedTests) {
|
|
953
956
|
const testSuite = getTestSuitePath(testSuiteAbsolutePath, result.globalConfig.rootDir)
|
|
954
|
-
const originalName = removeAttemptToFixStringFromTestName(testName)
|
|
955
957
|
const testManagementTest = testManagementTests
|
|
956
958
|
?.jest
|
|
957
959
|
?.suites
|
|
958
960
|
?.[testSuite]
|
|
959
961
|
?.tests
|
|
960
|
-
?.[
|
|
962
|
+
?.[testName]
|
|
961
963
|
?.properties
|
|
962
964
|
// This uses `attempt_to_fix` because this is always the main process and it's not formatted in camelCase
|
|
963
965
|
if (testManagementTest?.attempt_to_fix && (testManagementTest?.quarantined || testManagementTest?.disabled)) {
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
getTestSuitePath,
|
|
5
|
-
removeEfdStringFromTestName,
|
|
6
|
-
addEfdStringToTestName,
|
|
7
|
-
addAttemptToFixStringToTestName,
|
|
8
|
-
removeAttemptToFixStringFromTestName
|
|
9
|
-
} = require('../../../dd-trace/src/plugins/util/test')
|
|
3
|
+
const { getTestSuitePath } = require('../../../dd-trace/src/plugins/util/test')
|
|
10
4
|
const { channel } = require('../helpers/instrument')
|
|
11
5
|
const shimmer = require('../../../datadog-shimmer')
|
|
12
6
|
|
|
@@ -60,17 +54,15 @@ function isNewTest (test, knownTests) {
|
|
|
60
54
|
return false
|
|
61
55
|
}
|
|
62
56
|
const testSuite = getTestSuitePath(test.file, process.cwd())
|
|
63
|
-
const testName =
|
|
57
|
+
const testName = test.fullTitle()
|
|
64
58
|
const testsForSuite = knownTests.mocha?.[testSuite] || []
|
|
65
59
|
return !testsForSuite.includes(testName)
|
|
66
60
|
}
|
|
67
61
|
|
|
68
|
-
function retryTest (test, numRetries,
|
|
69
|
-
const originalTestName = test.title
|
|
62
|
+
function retryTest (test, numRetries, tags) {
|
|
70
63
|
const suite = test.parent
|
|
71
64
|
for (let retryIndex = 0; retryIndex < numRetries; retryIndex++) {
|
|
72
65
|
const clonedTest = test.clone()
|
|
73
|
-
clonedTest.title = modifyTestName(originalTestName, retryIndex + 1)
|
|
74
66
|
suite.addTest(clonedTest)
|
|
75
67
|
tags.forEach(tag => {
|
|
76
68
|
if (tag) {
|
|
@@ -113,10 +105,7 @@ function getIsLastRetry (test) {
|
|
|
113
105
|
}
|
|
114
106
|
|
|
115
107
|
function getTestFullName (test) {
|
|
116
|
-
|
|
117
|
-
removeAttemptToFixStringFromTestName(test.fullTitle())
|
|
118
|
-
)
|
|
119
|
-
return `mocha.${getTestSuitePath(test.file, process.cwd())}.${testName}`
|
|
108
|
+
return `mocha.${getTestSuitePath(test.file, process.cwd())}.${test.fullTitle()}`
|
|
120
109
|
}
|
|
121
110
|
|
|
122
111
|
function getTestStatus (test) {
|
|
@@ -216,10 +205,8 @@ function getOnTestHandler (isMain) {
|
|
|
216
205
|
_ddIsModified: isModified
|
|
217
206
|
} = test
|
|
218
207
|
|
|
219
|
-
const testName = removeEfdStringFromTestName(removeAttemptToFixStringFromTestName(test.fullTitle()))
|
|
220
|
-
|
|
221
208
|
const testInfo = {
|
|
222
|
-
testName,
|
|
209
|
+
testName: test.fullTitle(),
|
|
223
210
|
testSuiteAbsolutePath,
|
|
224
211
|
title,
|
|
225
212
|
testStartLine
|
|
@@ -445,7 +432,6 @@ function getRunTestsWrapper (runTests, config) {
|
|
|
445
432
|
retryTest(
|
|
446
433
|
test,
|
|
447
434
|
config.testManagementAttemptToFixRetries,
|
|
448
|
-
addAttemptToFixStringToTestName,
|
|
449
435
|
['_ddIsAttemptToFix', isDisabled && '_ddIsDisabled', isQuarantined && '_ddIsQuarantined']
|
|
450
436
|
)
|
|
451
437
|
} else if (isDisabled) {
|
|
@@ -469,7 +455,6 @@ function getRunTestsWrapper (runTests, config) {
|
|
|
469
455
|
retryTest(
|
|
470
456
|
test,
|
|
471
457
|
config.earlyFlakeDetectionNumRetries,
|
|
472
|
-
addEfdStringToTestName,
|
|
473
458
|
['_ddIsModified', '_ddIsEfdRetry']
|
|
474
459
|
)
|
|
475
460
|
}
|
|
@@ -488,7 +473,6 @@ function getRunTestsWrapper (runTests, config) {
|
|
|
488
473
|
retryTest(
|
|
489
474
|
test,
|
|
490
475
|
config.earlyFlakeDetectionNumRetries,
|
|
491
|
-
addEfdStringToTestName,
|
|
492
476
|
['_ddIsNew', '_ddIsEfdRetry']
|
|
493
477
|
)
|
|
494
478
|
}
|
|
@@ -772,7 +772,10 @@ addHook({
|
|
|
772
772
|
if (!isKnownTestsEnabled && !isTestManagementTestsEnabled && !isImpactedTestsEnabled) {
|
|
773
773
|
return oldCreateRootSuite.apply(this, arguments)
|
|
774
774
|
}
|
|
775
|
-
|
|
775
|
+
|
|
776
|
+
const createRootSuiteReturnValue = await oldCreateRootSuite.apply(this, arguments)
|
|
777
|
+
// From v1.56.0 on, createRootSuite returns `{ rootSuite, topLevelProjects }`
|
|
778
|
+
const rootSuite = createRootSuiteReturnValue.rootSuite || createRootSuiteReturnValue
|
|
776
779
|
|
|
777
780
|
const allTests = rootSuite.allTests()
|
|
778
781
|
|
|
@@ -861,7 +864,7 @@ addHook({
|
|
|
861
864
|
}
|
|
862
865
|
}
|
|
863
866
|
|
|
864
|
-
return
|
|
867
|
+
return createRootSuiteReturnValue
|
|
865
868
|
}
|
|
866
869
|
|
|
867
870
|
// We need to proxy the createRootSuite function because the function is not configurable
|
|
@@ -130,10 +130,6 @@ const PLAYWRIGHT_WORKER_TRACE_PAYLOAD_CODE = 90
|
|
|
130
130
|
const VITEST_WORKER_TRACE_PAYLOAD_CODE = 100
|
|
131
131
|
const VITEST_WORKER_LOGS_PAYLOAD_CODE = 102
|
|
132
132
|
|
|
133
|
-
// Early flake detection util strings
|
|
134
|
-
const EFD_STRING = "Retried by Datadog's Early Flake Detection"
|
|
135
|
-
const EFD_TEST_NAME_REGEX = new RegExp(EFD_STRING + String.raw` \(#\d+\): `, 'g')
|
|
136
|
-
|
|
137
133
|
// Library Capabilities Tagging
|
|
138
134
|
const DD_CAPABILITIES_TEST_IMPACT_ANALYSIS = '_dd.library_capabilities.test_impact_analysis'
|
|
139
135
|
const DD_CAPABILITIES_EARLY_FLAKE_DETECTION = '_dd.library_capabilities.early_flake_detection'
|
|
@@ -196,10 +192,6 @@ const TEST_MANAGEMENT_IS_QUARANTINED = 'test.test_management.is_quarantined'
|
|
|
196
192
|
const TEST_MANAGEMENT_ENABLED = 'test.test_management.enabled'
|
|
197
193
|
const TEST_MANAGEMENT_ATTEMPT_TO_FIX_PASSED = 'test.test_management.attempt_to_fix_passed'
|
|
198
194
|
|
|
199
|
-
// Test Management utils strings
|
|
200
|
-
const ATTEMPT_TO_FIX_STRING = "Retried by Datadog's Test Management"
|
|
201
|
-
const ATTEMPT_TEST_NAME_REGEX = new RegExp(ATTEMPT_TO_FIX_STRING + String.raw` \(#\d+\): `, 'g')
|
|
202
|
-
|
|
203
195
|
// Impacted tests
|
|
204
196
|
const POSSIBLE_BASE_BRANCHES = ['main', 'master', 'preprod', 'prod', 'dev', 'development', 'trunk']
|
|
205
197
|
const BASE_LIKE_BRANCH_FILTER = /^(main|master|preprod|prod|dev|development|trunk|release\/.*|hotfix\/.*)$/
|
|
@@ -275,12 +267,6 @@ module.exports = {
|
|
|
275
267
|
getTestEndLine,
|
|
276
268
|
removeInvalidMetadata,
|
|
277
269
|
parseAnnotations,
|
|
278
|
-
EFD_STRING,
|
|
279
|
-
EFD_TEST_NAME_REGEX,
|
|
280
|
-
removeEfdStringFromTestName,
|
|
281
|
-
removeAttemptToFixStringFromTestName,
|
|
282
|
-
addEfdStringToTestName,
|
|
283
|
-
addAttemptToFixStringToTestName,
|
|
284
270
|
getIsFaultyEarlyFlakeDetection,
|
|
285
271
|
TEST_BROWSER_DRIVER,
|
|
286
272
|
TEST_BROWSER_DRIVER_VERSION,
|
|
@@ -837,22 +823,6 @@ function parseAnnotations (annotations) {
|
|
|
837
823
|
}, {})
|
|
838
824
|
}
|
|
839
825
|
|
|
840
|
-
function addEfdStringToTestName (testName, numAttempt) {
|
|
841
|
-
return `${EFD_STRING} (#${numAttempt}): ${testName}`
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
function addAttemptToFixStringToTestName (testName, numAttempt) {
|
|
845
|
-
return `${ATTEMPT_TO_FIX_STRING} (#${numAttempt}): ${testName}`
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
function removeEfdStringFromTestName (testName) {
|
|
849
|
-
return testName.replaceAll(EFD_TEST_NAME_REGEX, '')
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
function removeAttemptToFixStringFromTestName (testName) {
|
|
853
|
-
return testName.replaceAll(ATTEMPT_TEST_NAME_REGEX, '')
|
|
854
|
-
}
|
|
855
|
-
|
|
856
826
|
function getIsFaultyEarlyFlakeDetection (projectSuites, testsBySuiteName, faultyThresholdPercentage) {
|
|
857
827
|
let newSuites = 0
|
|
858
828
|
for (const suite of projectSuites) {
|