dd-trace 5.134.0 → 5.135.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/LICENSE-3rdparty.csv +0 -1
- package/ci/cypress/support.js +15 -1
- package/ci/diagnose.js +4 -4
- package/ci/test-annotations.d.ts +5 -0
- package/ci/test-annotations.js +5 -0
- package/ci/test-optimization-validation/approval-artifacts.js +2 -2
- package/ci/test-optimization-validation/approval.js +2 -2
- package/ci/test-optimization-validation/artifact-id.js +2 -3
- package/ci/test-optimization-validation/ci-package-scripts.js +1 -1
- package/ci/test-optimization-validation/cli.js +1 -1
- package/ci/test-optimization-validation/command-runner.js +2 -3
- package/ci/test-optimization-validation/executable.js +1 -1
- package/ci/test-optimization-validation/framework-adapters/cucumber.js +1 -1
- package/ci/test-optimization-validation/literal-environment.js +2 -2
- package/ci/test-optimization-validation/manifest-scaffold.js +1 -1
- package/ci/test-optimization-validation/offline-fixtures.js +1 -1
- package/ci/test-optimization-validation/redaction.js +3 -3
- package/ci/test-optimization-validation/runner-contract.js +10 -10
- package/ci/test-optimization-validation/scenarios/ci-wiring.js +1 -1
- package/ci/vitest-no-worker-init-annotations.mjs +4 -0
- package/ci/vitest-no-worker-init-node-setup.mjs +22 -0
- package/ci/vitest-no-worker-init-runner-setup.mjs +7 -32
- package/ci/vitest-no-worker-init-setup.mjs +34 -12
- package/ci/vitest-no-worker-init-v5-setup.mjs +6 -0
- package/ext/exporters.js +1 -0
- package/index.d.ts +19 -0
- package/loader-hook.mjs +53 -0
- package/openfeature/exposure-hook.d.ts +66 -0
- package/openfeature/exposure-hook.js +5 -0
- package/package.json +11 -9
- package/packages/datadog-core/src/storage.js +1 -1
- package/packages/datadog-esbuild/index.js +70 -7
- package/packages/datadog-instrumentations/src/cucumber.js +53 -19
- package/packages/datadog-instrumentations/src/cypress-config.js +163 -15
- package/packages/datadog-instrumentations/src/graphql.js +9 -3
- package/packages/datadog-instrumentations/src/grpc/server.js +23 -6
- package/packages/datadog-instrumentations/src/helpers/fetch.js +5 -1
- package/packages/datadog-instrumentations/src/helpers/graphql-jit-runtime.js +30 -8
- package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +16 -6
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +8 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql-jit.js +3 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/react-router.js +49 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/typesafe.js +23 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/webdriverio.js +12 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/target-patterns.json +8 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.js +19 -2
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +8 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +1 -1
- package/packages/datadog-instrumentations/src/jest.js +265 -82
- package/packages/datadog-instrumentations/src/mariadb-bundle.js +69 -11
- package/packages/datadog-instrumentations/src/mariadb.js +13 -6
- package/packages/datadog-instrumentations/src/mocha/common.js +89 -8
- package/packages/datadog-instrumentations/src/mocha/main.js +11 -2
- package/packages/datadog-instrumentations/src/mocha/utils.js +58 -12
- package/packages/datadog-instrumentations/src/mocha/worker.js +1 -1
- package/packages/datadog-instrumentations/src/oracledb.js +33 -0
- package/packages/datadog-instrumentations/src/pg.js +2 -1
- package/packages/datadog-instrumentations/src/playwright.js +81 -28
- package/packages/datadog-instrumentations/src/react-router.js +106 -0
- package/packages/datadog-instrumentations/src/typesafe.js +89 -0
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +84 -48
- package/packages/datadog-instrumentations/src/vitest-main.js +26 -0
- package/packages/datadog-instrumentations/src/vitest-test-annotations.js +20 -0
- package/packages/datadog-instrumentations/src/vitest-worker.js +39 -17
- package/packages/datadog-instrumentations/src/vitest.js +10 -8
- package/packages/datadog-plugin-cucumber/src/index.js +5 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +274 -44
- package/packages/datadog-plugin-cypress/src/index.js +1 -1
- package/packages/datadog-plugin-cypress/src/lifecycle-owner.js +20 -0
- package/packages/datadog-plugin-cypress/src/plugin.js +10 -0
- package/packages/datadog-plugin-cypress/src/retry-config-observer.js +281 -0
- package/packages/datadog-plugin-cypress/src/setup-handoff.js +125 -0
- package/packages/datadog-plugin-cypress/src/support.js +1217 -439
- package/packages/datadog-plugin-graphql/src/execute.js +2 -2
- package/packages/datadog-plugin-graphql/src/utils.js +5 -5
- package/packages/datadog-plugin-jest/src/index.js +25 -3
- package/packages/datadog-plugin-mocha/src/index.js +47 -6
- package/packages/datadog-plugin-oracledb/src/connection-parser.js +21 -11
- package/packages/datadog-plugin-playwright/src/index.js +4 -0
- package/packages/datadog-plugin-react-router/src/index.js +118 -0
- package/packages/datadog-plugin-typesafe/src/index.js +17 -0
- package/packages/datadog-plugin-typesafe/src/tracing.js +31 -0
- package/packages/datadog-plugin-vitest/src/index.js +8 -0
- package/packages/dd-trace/src/agent/info.js +2 -1
- package/packages/dd-trace/src/aiguard/sdk.js +0 -11
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +9 -16
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +4 -2
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +9 -16
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +9 -14
- package/packages/dd-trace/src/ci-visibility/requests/route.js +44 -0
- package/packages/dd-trace/src/ci-visibility/telemetry-logs.js +5 -0
- package/packages/dd-trace/src/ci-visibility/test-annotations.js +72 -0
- package/packages/dd-trace/src/ci-visibility/test-declaration-annotations.js +170 -0
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +9 -16
- package/packages/dd-trace/src/config/defaults.js +4 -3
- package/packages/dd-trace/src/config/generated-config-types.d.ts +4 -0
- package/packages/dd-trace/src/config/index.js +95 -39
- package/packages/dd-trace/src/config/parsers.js +9 -1
- package/packages/dd-trace/src/config/supported-configurations.json +16 -0
- package/packages/dd-trace/src/debugger/probe_sampler.js +6 -6
- package/packages/dd-trace/src/encode/0.4.js +2 -2
- package/packages/dd-trace/src/esm-module-load.js +58 -0
- package/packages/dd-trace/src/exporter.js +25 -6
- package/packages/dd-trace/src/exporters/agent/index.js +3 -1
- package/packages/dd-trace/src/exporters/agentless/index.js +3 -1
- package/packages/dd-trace/src/exporters/common/request.js +4 -4
- package/packages/dd-trace/src/exporters/llmobs/index.js +135 -0
- package/packages/dd-trace/src/exporters/log/index.js +4 -3
- package/packages/dd-trace/src/llmobs/constants/tags.js +1 -0
- package/packages/dd-trace/src/llmobs/experiments/index.js +2 -3
- package/packages/dd-trace/src/llmobs/experiments/noop.js +5 -2
- package/packages/dd-trace/src/llmobs/index.js +13 -2
- package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/index.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/genai/index.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +8 -4
- package/packages/dd-trace/src/llmobs/plugins/typesafe/index.js +102 -0
- package/packages/dd-trace/src/llmobs/prompts/cache.js +3 -1
- package/packages/dd-trace/src/llmobs/sdk.js +2 -1
- package/packages/dd-trace/src/llmobs/span_processor.js +210 -12
- package/packages/dd-trace/src/llmobs/tagger.js +3 -0
- package/packages/dd-trace/src/llmobs/writers/util.js +3 -3
- package/packages/dd-trace/src/log/writer.js +7 -1
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +64 -6
- package/packages/dd-trace/src/openfeature/configuration_source.js +18 -2
- package/packages/dd-trace/src/openfeature/debug-logging-hook.js +66 -3
- package/packages/dd-trace/src/openfeature/exposure-hook.js +185 -0
- package/packages/dd-trace/src/openfeature/flagging_provider.js +39 -13
- package/packages/dd-trace/src/openfeature/remote_config.js +16 -3
- package/packages/dd-trace/src/openfeature/writers/base.js +62 -27
- package/packages/dd-trace/src/openfeature/writers/exposures.js +161 -1
- package/packages/dd-trace/src/openfeature/writers/flag-eval-evp-hook.js +5 -0
- package/packages/dd-trace/src/openfeature/writers/flag-evaluation-aggregation.js +9 -4
- package/packages/dd-trace/src/openfeature/writers/flag-evaluation-payload.js +2 -0
- package/packages/dd-trace/src/openfeature/writers/flag-evaluation-pii.js +2 -0
- package/packages/dd-trace/src/openfeature/writers/split-features.js +25 -0
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +2 -2
- package/packages/dd-trace/src/opentelemetry/tracer_provider.js +5 -1
- package/packages/dd-trace/src/opentracing/tracer.js +9 -13
- package/packages/dd-trace/src/otel-thread-ctx.js +47 -21
- package/packages/dd-trace/src/plugins/ci_plugin.js +4 -4
- package/packages/dd-trace/src/plugins/index.js +3 -0
- package/packages/dd-trace/src/plugins/tracing.js +1 -1
- package/packages/dd-trace/src/plugins/util/git.js +11 -5
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +2 -4
- package/packages/dd-trace/src/plugins/util/test.js +26 -6
- package/packages/dd-trace/src/plugins/util/web.js +16 -0
- package/packages/dd-trace/src/process-tags/index.js +1 -1
- package/packages/dd-trace/src/profiling/config.js +6 -3
- package/packages/dd-trace/src/proxy.js +15 -4
- package/packages/dd-trace/src/serverless.js +3 -2
- package/packages/dd-trace/src/span_processor.js +21 -9
- package/packages/dd-trace/src/span_stats.js +28 -2
- package/packages/dd-trace/src/startup-log.js +2 -1
- package/packages/dd-trace/src/tagger.js +7 -5
- package/packages/dd-trace/src/telemetry/dependencies.js +4 -0
- package/packages/dd-trace/src/telemetry/index.js +3 -0
- package/packages/dd-trace/src/telemetry/logs/index.js +21 -2
- package/packages/dd-trace/src/telemetry/logs/log-collector.js +1 -0
- package/packages/dd-trace/src/telemetry/telemetry.js +10 -3
- package/packages/dd-trace/src/util.js +1 -1
- package/register.js +2 -1
- package/vendor/dist/@datadog/openfeature-node-server/index.js +1 -1
- package/vendor/dist/@datadog/openfeature-node-server/rules-based/index.d.ts +78 -0
- package/vendor/dist/@datadog/openfeature-node-server/rules-based/index.js +1 -1
- package/vendor/dist/@opentelemetry/core/index.js +1 -1
- package/vendor/dist/@opentelemetry/resources/LICENSE +0 -201
- package/vendor/dist/@opentelemetry/resources/index.js +0 -1
package/loader-hook.mjs
CHANGED
|
@@ -52,11 +52,51 @@ if (!isInitializeMainThread) {
|
|
|
52
52
|
|
|
53
53
|
const nodeModulesIncludeSource = `node_modules/(?:${moduleNameAlternation})/(?!node_modules).+`
|
|
54
54
|
|
|
55
|
+
const NODE_MODULES = '/node_modules/'
|
|
56
|
+
|
|
57
|
+
// Package roots already reported, so each package costs a single report however many of its files load.
|
|
58
|
+
const reportedPackageRoots = new Set()
|
|
59
|
+
/** @type {((url: string) => void) | undefined} */
|
|
60
|
+
let reportModuleLoad
|
|
61
|
+
|
|
55
62
|
function initialize (data = {}) {
|
|
63
|
+
const { moduleLoadPort } = data
|
|
64
|
+
if (moduleLoadPort) {
|
|
65
|
+
// A MessagePort, not a timer; optional chaining would break the Node.js 12 syntax this file supports.
|
|
66
|
+
// eslint-disable-next-line eslint-rules/eslint-timer-unref
|
|
67
|
+
moduleLoadPort.unref()
|
|
68
|
+
reportModuleLoad = (url) => moduleLoadPort.postMessage(url)
|
|
69
|
+
}
|
|
70
|
+
|
|
56
71
|
prepareImportInTheMiddleOptions(data)
|
|
57
72
|
return origInitialize(data)
|
|
58
73
|
}
|
|
59
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Reports the first loaded file of each `node_modules` package, so packages that
|
|
77
|
+
* import-in-the-middle leaves unwrapped reach `dd-trace:moduleLoadStart` too. Wrapped
|
|
78
|
+
* modules are also published through iitm's `addHook`; dependency telemetry deduplicates.
|
|
79
|
+
*
|
|
80
|
+
* @param {string} url Loaded module URL.
|
|
81
|
+
*/
|
|
82
|
+
function reportUnwrappedPackage (url) {
|
|
83
|
+
if (!reportModuleLoad || !url.startsWith('file:') || url.includes('iitm=true')) return
|
|
84
|
+
|
|
85
|
+
const nodeModulesIndex = url.lastIndexOf(NODE_MODULES)
|
|
86
|
+
if (nodeModulesIndex === -1) return
|
|
87
|
+
|
|
88
|
+
const nameStart = nodeModulesIndex + NODE_MODULES.length
|
|
89
|
+
let nameEnd = url.indexOf('/', nameStart)
|
|
90
|
+
if (url[nameStart] === '@' && nameEnd !== -1) nameEnd = url.indexOf('/', nameEnd + 1)
|
|
91
|
+
if (nameEnd === -1) return
|
|
92
|
+
|
|
93
|
+
const packageRoot = url.slice(0, nameEnd)
|
|
94
|
+
if (reportedPackageRoots.has(packageRoot)) return
|
|
95
|
+
|
|
96
|
+
reportedPackageRoots.add(packageRoot)
|
|
97
|
+
reportModuleLoad(url)
|
|
98
|
+
}
|
|
99
|
+
|
|
60
100
|
function prepareImportInTheMiddleOptions (data = {}) {
|
|
61
101
|
// A consumer-owned shouldInclude predicate takes over the wrapping decision, so
|
|
62
102
|
// iitm ignores the include/exclude arrays. Building the matcher here keeps the
|
|
@@ -116,10 +156,14 @@ function buildIncludeSource (securityControlsConfig) {
|
|
|
116
156
|
}
|
|
117
157
|
|
|
118
158
|
function load (url, context, nextLoad) {
|
|
159
|
+
reportUnwrappedPackage(url)
|
|
119
160
|
return rewriterLoader.load(url, context, (url, context) => origLoad(url, context, nextLoad))
|
|
120
161
|
}
|
|
121
162
|
|
|
122
163
|
function loadSync (url, context, nextLoad) {
|
|
164
|
+
// require() loads are already published by require-in-the-middle.
|
|
165
|
+
if (!hasRequireCondition(context)) reportUnwrappedPackage(url)
|
|
166
|
+
|
|
123
167
|
if (isCommonJSLoad(context)) {
|
|
124
168
|
return getSyncImportInTheMiddleHook().loadSync(url, context, nextLoad)
|
|
125
169
|
}
|
|
@@ -135,6 +179,13 @@ function isCommonJSLoad (context) {
|
|
|
135
179
|
// Sync hooks report CommonJS require() dependency loads with a `require`
|
|
136
180
|
// condition but no format. If a format is present, trust it instead: ESM
|
|
137
181
|
// loaded through require() reports `format: 'module'` and still needs rewrite.
|
|
182
|
+
return hasRequireCondition(context)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @param {import('node:module').LoadHookContext} context
|
|
187
|
+
*/
|
|
188
|
+
function hasRequireCondition (context) {
|
|
138
189
|
const conditions = context.conditions
|
|
139
190
|
if (!conditions) return false
|
|
140
191
|
|
|
@@ -184,6 +235,8 @@ function registerSyncLoaderHooks (data = {}) {
|
|
|
184
235
|
// synchronous and asynchronous loaders share the same option preparation so
|
|
185
236
|
// that `import http from 'node:http'` is wrapped on both paths.
|
|
186
237
|
syncHook.applyOptions(prepareImportInTheMiddleOptions(data))
|
|
238
|
+
// The synchronous hooks run on the application thread, so publish directly.
|
|
239
|
+
reportModuleLoad = require('./packages/dd-trace/src/esm-module-load.js').publishModuleLoad
|
|
187
240
|
Module.registerHooks({
|
|
188
241
|
resolve: syncHook.resolveSync,
|
|
189
242
|
load: loadSync,
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type ExposureFeatureValue = string | number | boolean;
|
|
2
|
+
|
|
3
|
+
export interface ExposureFlagMetadata {
|
|
4
|
+
[key: string]: string | number | boolean | undefined;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface ExposureEvaluationDetails {
|
|
8
|
+
flagKey: string;
|
|
9
|
+
value?: unknown;
|
|
10
|
+
variant?: string;
|
|
11
|
+
reason?: string;
|
|
12
|
+
errorCode?: string;
|
|
13
|
+
errorMessage?: string;
|
|
14
|
+
flagMetadata?: Readonly<ExposureFlagMetadata>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ExposureEvaluationContext {
|
|
18
|
+
targetingKey?: string;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A completed flag evaluation and its Datadog exposure decision.
|
|
24
|
+
*/
|
|
25
|
+
export interface ExposureEvaluation {
|
|
26
|
+
/** The flag key. */
|
|
27
|
+
readonly flagKey: string;
|
|
28
|
+
/** The flag key, variant, value, error and flag metadata of the evaluation. */
|
|
29
|
+
readonly details: ExposureEvaluationDetails;
|
|
30
|
+
/** The selected variant key, or undefined when the default value was returned. */
|
|
31
|
+
readonly variant: string | undefined;
|
|
32
|
+
/** The key of the selected allocation, or undefined when none was selected. */
|
|
33
|
+
readonly allocation: string | undefined;
|
|
34
|
+
/** The evaluation context, including the targeting key. */
|
|
35
|
+
readonly context: ExposureEvaluationContext | undefined;
|
|
36
|
+
/** The targeting key of the evaluation context, if readable. */
|
|
37
|
+
readonly targetingKey: string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* True when the evaluation succeeded and selected an allocation that logs exposures,
|
|
40
|
+
* whether or not this subject was already exposed.
|
|
41
|
+
*/
|
|
42
|
+
isExposure(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* True when this exposure repeats one already recorded for this subject: same
|
|
45
|
+
* allocation, variant and serial id.
|
|
46
|
+
*/
|
|
47
|
+
isCacheHit(): boolean;
|
|
48
|
+
/** True for a new or changed exposure: the decision the provider uses for Datadog. */
|
|
49
|
+
shouldSend(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The HOOK features of the selected split, such as `holdout.key`. Read-only.
|
|
52
|
+
*/
|
|
53
|
+
getFeatures(): Readonly<Record<string, ExposureFeatureValue>>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* An OpenFeature hook that hands each completed flag evaluation to a callback,
|
|
58
|
+
* with the Datadog exposure decision.
|
|
59
|
+
*
|
|
60
|
+
* Register it with `OpenFeature.addHooks(new ExposureHook(callback))` or on a client.
|
|
61
|
+
* The callback runs on the evaluation thread and must not do I/O. An exception from
|
|
62
|
+
* the callback does not affect the evaluation.
|
|
63
|
+
*/
|
|
64
|
+
export declare class ExposureHook {
|
|
65
|
+
constructor(callback: (evaluation: ExposureEvaluation) => void);
|
|
66
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dd-trace",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.135.0",
|
|
4
4
|
"description": "Datadog APM tracing client for JavaScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"test:integration:playwright:coverage": "node ./integration-tests/coverage/run-suite.js --timeout 60000 \"integration-tests/playwright/${SPEC:-playwright-*}.spec.js\"",
|
|
107
107
|
"test:integration:selenium": "mocha --timeout 60000 \"integration-tests/selenium/*.spec.js\"",
|
|
108
108
|
"test:integration:selenium:coverage": "node ./integration-tests/coverage/run-suite.js --timeout 60000 \"integration-tests/selenium/*.spec.js\"",
|
|
109
|
-
"test:integration:test-optimization:helpers": "mocha \"integration-tests/cypress/*dependencies.spec.js\" \"integration-tests/jest/*dependencies.spec.js\" \"integration-tests/playwright/version*.spec.js\" \"integration-tests/mocha/version*.spec.js\"",
|
|
109
|
+
"test:integration:test-optimization:helpers": "mocha \"integration-tests/cypress/config-lifecycle*.spec.js\" \"integration-tests/cypress/*dependencies.spec.js\" \"integration-tests/jest/*dependencies.spec.js\" \"integration-tests/playwright/version*.spec.js\" \"integration-tests/mocha/version*.spec.js\"",
|
|
110
110
|
"test:integration:webdriverio": "mocha --timeout 60000 \"integration-tests/webdriverio/${SPEC:-*}.spec.js\"",
|
|
111
111
|
"test:integration:webdriverio:coverage": "node ./integration-tests/coverage/run-suite.js --timeout 60000 \"integration-tests/webdriverio/${SPEC:-*}.spec.js\"",
|
|
112
112
|
"test:integration:vitest": "mocha --timeout 60000 \"integration-tests/vitest/${SPEC:-vitest*}.spec.js\"",
|
|
@@ -172,6 +172,8 @@
|
|
|
172
172
|
"openfeature.js",
|
|
173
173
|
"openfeature/rules-based.js",
|
|
174
174
|
"openfeature/rules-based.d.ts",
|
|
175
|
+
"openfeature/exposure-hook.js",
|
|
176
|
+
"openfeature/exposure-hook.d.ts",
|
|
175
177
|
"packages/*/index.js",
|
|
176
178
|
"packages/*/index.electron.js",
|
|
177
179
|
"packages/*/lib/**/*",
|
|
@@ -198,25 +200,25 @@
|
|
|
198
200
|
"@datadog/native-metrics": "4.0.0",
|
|
199
201
|
"@datadog/pprof": "5.20.0",
|
|
200
202
|
"@datadog/wasm-js-rewriter": "5.0.4",
|
|
201
|
-
"@opentelemetry/api": ">=1.
|
|
203
|
+
"@opentelemetry/api": ">=1.4.1 <1.10.0",
|
|
202
204
|
"@opentelemetry/api-logs": "<1.0.0",
|
|
203
205
|
"oxc-parser": "^0.132.0"
|
|
204
206
|
},
|
|
205
207
|
"devDependencies": {
|
|
206
208
|
"@actions/core": "^3.0.1",
|
|
207
209
|
"@actions/github": "^9.1.1",
|
|
208
|
-
"@babel/helpers": "^8.0.
|
|
210
|
+
"@babel/helpers": "^8.0.10",
|
|
209
211
|
"@eslint/eslintrc": "^3.3.7",
|
|
210
212
|
"@eslint/js": "^10.0.1",
|
|
211
213
|
"@eslint/plugin-kit": "^0.7.3",
|
|
212
|
-
"@datadog/openfeature-node-server": "2.
|
|
214
|
+
"@datadog/openfeature-node-server": "2.7.0",
|
|
213
215
|
"@msgpack/msgpack": "^3.1.3",
|
|
214
216
|
"@openfeature/core": "^1.12.0",
|
|
215
217
|
"@openfeature/server-sdk": "~1.23.0",
|
|
216
218
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
217
219
|
"@types/mocha": "^10.0.10",
|
|
218
220
|
"@types/node": "^18.19.106",
|
|
219
|
-
"@types/sinon": "^22.0.
|
|
221
|
+
"@types/sinon": "^22.0.2",
|
|
220
222
|
"@vercel/nft": "^1.11.0",
|
|
221
223
|
"@yarnpkg/lockfile": "^1.1.0",
|
|
222
224
|
"benchmark": "^2.1.4",
|
|
@@ -231,9 +233,9 @@
|
|
|
231
233
|
"eslint-plugin-mocha": "^12.0.2",
|
|
232
234
|
"eslint-plugin-n": "^18.5.0",
|
|
233
235
|
"eslint-plugin-promise": "^7.3.0",
|
|
234
|
-
"eslint-plugin-regexp": "^3.3.
|
|
236
|
+
"eslint-plugin-regexp": "^3.3.2",
|
|
235
237
|
"eslint-plugin-sonarjs": "^4.2.2",
|
|
236
|
-
"eslint-plugin-unicorn": "^
|
|
238
|
+
"eslint-plugin-unicorn": "^79.0.0",
|
|
237
239
|
"express": "^5.3.0",
|
|
238
240
|
"glob": "^10.4.5",
|
|
239
241
|
"globals": "^17.13.0",
|
|
@@ -244,7 +246,7 @@
|
|
|
244
246
|
"istanbul-reports": "^3.0.2",
|
|
245
247
|
"jsonc-parser": "^3.3.1",
|
|
246
248
|
"jszip": "^3.10.2",
|
|
247
|
-
"minimatch": "^
|
|
249
|
+
"minimatch": "^11.0.3",
|
|
248
250
|
"mocha": "^11.8.0",
|
|
249
251
|
"mocha-junit-reporter": "^2.2.1",
|
|
250
252
|
"mocha-multi-reporters": "^1.5.2",
|
|
@@ -128,7 +128,7 @@ if (!isACFActive) {
|
|
|
128
128
|
* For convenience, we use the `storage` function as a registry of namespaces
|
|
129
129
|
* corresponding to DatadogStorage instances. This lets us have separate
|
|
130
130
|
* storages for separate purposes.
|
|
131
|
-
* @type {
|
|
131
|
+
* @type {Record<string, DatadogStorage>}
|
|
132
132
|
*/
|
|
133
133
|
const storages = Object.create(null)
|
|
134
134
|
|
|
@@ -8,6 +8,8 @@ const { pathToFileURL, fileURLToPath } = require('node:url')
|
|
|
8
8
|
const instrumentations = require('../datadog-instrumentations/src/helpers/instrumentations')
|
|
9
9
|
const extractPackageAndModulePath = require('../datadog-instrumentations/src/helpers/extract-package-and-module-path')
|
|
10
10
|
const hooks = require('../datadog-instrumentations/src/helpers/hooks')
|
|
11
|
+
const { createBundlerRewriter } = require('../datadog-instrumentations/src/helpers/rewriter')
|
|
12
|
+
const { getRewriteTarget, isRewriteTargetName } = require('../datadog-instrumentations/src/helpers/rewriter/targets')
|
|
11
13
|
const { getValueFromEnvSources } = require('../dd-trace/src/config/helper')
|
|
12
14
|
const log = require('./src/log')
|
|
13
15
|
const { createEsmResolver } = require('./src/resolver')
|
|
@@ -15,8 +17,15 @@ const { isESMFile, processModule } = require('./src/utils')
|
|
|
15
17
|
|
|
16
18
|
const ESM_INTERCEPTED_SUFFIX = '._dd_esbuild_intercepted'
|
|
17
19
|
const INTERNAL_ESM_INTERCEPTED_PREFIX = '/_dd_esm_internal_/'
|
|
20
|
+
// User bundles may not have dc-polyfill next to the target package.
|
|
21
|
+
const DC_MODULE = require.resolve('dc-polyfill').replaceAll('\\', '/')
|
|
22
|
+
const DC_MODULE_LITERAL = JSON.stringify(DC_MODULE)
|
|
23
|
+
// Keep the marker split so source-map scanners do not treat this literal as this file's map.
|
|
24
|
+
// eslint-disable-next-line unicorn/no-useless-concat
|
|
25
|
+
const SOURCE_MAP_PREFIX = '//# sourceMapping' + 'URL=data:application/json;base64,'
|
|
18
26
|
|
|
19
27
|
let rewriter
|
|
28
|
+
let bundlerRewrite
|
|
20
29
|
|
|
21
30
|
for (const hook of Object.values(hooks)) {
|
|
22
31
|
if (hook !== null && typeof hook === 'object') {
|
|
@@ -189,6 +198,7 @@ ${build.initialOptions.banner.js}`
|
|
|
189
198
|
// TODO: Should this also check for namespace === 'file'?
|
|
190
199
|
if (!modulesOfInterest.has(args.path) &&
|
|
191
200
|
args.path.startsWith('@') &&
|
|
201
|
+
!isRewriteTargetName(args.path.split('/', 2).join('/')) &&
|
|
192
202
|
!args.importer.includes('node_modules/')) {
|
|
193
203
|
// This is the Next.js convention for loading local files
|
|
194
204
|
log.debug('@LOCAL: %s', args.path)
|
|
@@ -220,6 +230,9 @@ ${build.initialOptions.banner.js}`
|
|
|
220
230
|
const extracted = extractPackageAndModulePath(fullPathToModule)
|
|
221
231
|
|
|
222
232
|
const internal = builtins.has(args.path)
|
|
233
|
+
const target = getRewriteTarget(fullPathToModule.replaceAll('\\', '/'))
|
|
234
|
+
const isModuleOfInterest = modulesOfInterest.has(args.path) ||
|
|
235
|
+
modulesOfInterest.has(`${extracted.pkg}/${extracted.path}`)
|
|
223
236
|
|
|
224
237
|
// Only the generated wrapper module, and the real module importing itself, must reach the real module unwrapped.
|
|
225
238
|
// Every other importer must get the wrapper regardless of whether it has already been loaded: onLoad runs
|
|
@@ -228,9 +241,7 @@ ${build.initialOptions.banner.js}`
|
|
|
228
241
|
// wrapper cycle that can hit the wrapper's exports in their temporal dead zone.
|
|
229
242
|
const isInterceptedImporter = args.importer.endsWith(ESM_INTERCEPTED_SUFFIX) || args.importer === fullPathToModule
|
|
230
243
|
|
|
231
|
-
if (args.namespace === 'file' && (
|
|
232
|
-
modulesOfInterest.has(args.path) || modulesOfInterest.has(`${extracted.pkg}/${extracted.path}`))
|
|
233
|
-
) {
|
|
244
|
+
if (args.namespace === 'file' && (isModuleOfInterest || target !== undefined)) {
|
|
234
245
|
// Internal module like http/fs is imported and the build output is ESM
|
|
235
246
|
if (internal && args.kind === 'import-statement' && esmBuild && !isInterceptedImporter) {
|
|
236
247
|
fullPathToModule = `${INTERNAL_ESM_INTERCEPTED_PREFIX}${fullPathToModule}${ESM_INTERCEPTED_SUFFIX}`
|
|
@@ -274,7 +285,10 @@ ${build.initialOptions.banner.js}`
|
|
|
274
285
|
const packageJson = JSON.parse(fs.readFileSync(/** @type {string} */(pathToPackageJson)).toString())
|
|
275
286
|
|
|
276
287
|
const isESM = isESMFile(fullPathToModule, pathToPackageJson, packageJson)
|
|
277
|
-
|
|
288
|
+
// ESM targets with export hooks still need the IITM wrapper to run those hooks; the wrapper's import of the
|
|
289
|
+
// real module then resolves without the suffix and is rewritten.
|
|
290
|
+
const needsExportHook = !target || (isModuleOfInterest && !target.activate)
|
|
291
|
+
if (isESM && needsExportHook && !isInterceptedImporter) {
|
|
278
292
|
fullPathToModule += ESM_INTERCEPTED_SUFFIX
|
|
279
293
|
}
|
|
280
294
|
|
|
@@ -290,6 +304,7 @@ ${build.initialOptions.banner.js}`
|
|
|
290
304
|
full: fullPathToModule,
|
|
291
305
|
raw: args.path,
|
|
292
306
|
pkgOfInterest: true,
|
|
307
|
+
rewriteOnly: !isModuleOfInterest,
|
|
293
308
|
kind: args.kind,
|
|
294
309
|
internal,
|
|
295
310
|
isESM,
|
|
@@ -324,8 +339,44 @@ ${build.initialOptions.banner.js}`
|
|
|
324
339
|
|
|
325
340
|
// Read the content of the module file of interest
|
|
326
341
|
let contents
|
|
342
|
+
let sourceMap
|
|
343
|
+
const target = getRewriteTarget(args.path.replaceAll('\\', '/'))
|
|
344
|
+
|
|
345
|
+
if (target) {
|
|
346
|
+
const source = fs.readFileSync(args.path, 'utf8')
|
|
347
|
+
bundlerRewrite ??= createBundlerRewriter(DC_MODULE)
|
|
348
|
+
const result = bundlerRewrite(source, args.path, data.isESM ? 'module' : 'commonjs', target)
|
|
349
|
+
contents = /** @type {string} */(result.code)
|
|
350
|
+
if (result.map) {
|
|
351
|
+
const map = typeof result.map === 'string' ? JSON.parse(result.map) : result.map
|
|
352
|
+
// Inline maps resolve sources relative to the loaded file, not the package root.
|
|
353
|
+
sourceMap = {
|
|
354
|
+
...map,
|
|
355
|
+
sources: [path.basename(args.path)],
|
|
356
|
+
sourcesContent: [source],
|
|
357
|
+
}
|
|
358
|
+
}
|
|
327
359
|
|
|
328
|
-
|
|
360
|
+
if (contents !== source && target.activate) {
|
|
361
|
+
const payload = JSON.stringify({
|
|
362
|
+
activate: true,
|
|
363
|
+
package: target.moduleName,
|
|
364
|
+
version: data.version,
|
|
365
|
+
path: `${target.moduleName}/${target.filePath}`,
|
|
366
|
+
})
|
|
367
|
+
let channel = `;{\n const __dd_ch = require(${DC_MODULE_LITERAL}).channel('${CHANNEL}');\n`
|
|
368
|
+
if (data.isESM) {
|
|
369
|
+
let binding = '__dd_dc'
|
|
370
|
+
let suffix = 0
|
|
371
|
+
while (contents.includes(binding)) binding = `__dd_dc${++suffix}`
|
|
372
|
+
channel = `import ${binding} from ${DC_MODULE_LITERAL};\n;{\n` +
|
|
373
|
+
` const __dd_ch = ${binding}.channel('${CHANNEL}');\n`
|
|
374
|
+
}
|
|
375
|
+
contents += `\n${channel}` +
|
|
376
|
+
` if (__dd_ch.hasSubscribers) __dd_ch.publish(${payload});\n` +
|
|
377
|
+
'}\n'
|
|
378
|
+
}
|
|
379
|
+
} else if (data.isESM) {
|
|
329
380
|
if (args.path.endsWith(ESM_INTERCEPTED_SUFFIX)) {
|
|
330
381
|
args.path = args.path.slice(0, -ESM_INTERCEPTED_SUFFIX.length)
|
|
331
382
|
|
|
@@ -362,7 +413,12 @@ register(${JSON.stringify(toRegister)}, _, set, get, ${JSON.stringify(data.raw)}
|
|
|
362
413
|
contents = fs.readFileSync(args.path, 'utf8')
|
|
363
414
|
}
|
|
364
415
|
} else {
|
|
365
|
-
|
|
416
|
+
contents = fs.readFileSync(args.path, 'utf8')
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// Rewrite-only targets have no export hook. ESM export hooks run through the IITM wrapper instead.
|
|
420
|
+
if (!data.isESM && !data.rewriteOnly && !target?.activate) {
|
|
421
|
+
const fileCode = contents
|
|
366
422
|
// Don't spread `...arguments`: esbuild's minifier can rewrite the surrounding
|
|
367
423
|
// `__commonJS` factory into an arrow function whose `arguments` resolves to the
|
|
368
424
|
// ESM top-level scope (see issue #8681). Pass `(module.exports, module)`
|
|
@@ -370,7 +426,7 @@ register(${JSON.stringify(toRegister)}, _, set, get, ${JSON.stringify(data.raw)}
|
|
|
370
426
|
// resolution inside `fileCode` is preserved through the factory's closure.
|
|
371
427
|
contents = `
|
|
372
428
|
(function() {
|
|
373
|
-
|
|
429
|
+
${fileCode}
|
|
374
430
|
})(module.exports, module);
|
|
375
431
|
{
|
|
376
432
|
const dc = require('dc-polyfill');
|
|
@@ -386,6 +442,13 @@ register(${JSON.stringify(toRegister)}, _, set, get, ${JSON.stringify(data.raw)}
|
|
|
386
442
|
module.exports = payload.module;
|
|
387
443
|
}
|
|
388
444
|
`
|
|
445
|
+
if (sourceMap) {
|
|
446
|
+
sourceMap.mappings = `;;${sourceMap.mappings}`
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
if (sourceMap) {
|
|
451
|
+
contents += `\n${SOURCE_MAP_PREFIX}${Buffer.from(JSON.stringify(sourceMap)).toString('base64')}`
|
|
389
452
|
}
|
|
390
453
|
|
|
391
454
|
// https://esbuild.github.io/plugins/#on-load-results
|
|
@@ -139,6 +139,7 @@ let testManagementAttemptToFixRetries = 0
|
|
|
139
139
|
let testManagementTests = {}
|
|
140
140
|
let modifiedFiles = {}
|
|
141
141
|
let numTestRetries = 0
|
|
142
|
+
let frameworkRetryCount = 0
|
|
142
143
|
let knownTests = {}
|
|
143
144
|
let skippedSuites = []
|
|
144
145
|
let isSuitesSkipped = false
|
|
@@ -258,6 +259,7 @@ function configureParallelWorkerWorldParameters (options) {
|
|
|
258
259
|
options.worldParameters._ddIsFlakyTestRetriesEnabled = isFlakyTestRetriesEnabled
|
|
259
260
|
options.worldParameters._ddHasAutomaticRetries = hasAutomaticRetries
|
|
260
261
|
options.worldParameters._ddNumTestRetries = numTestRetries
|
|
262
|
+
options.worldParameters._ddFrameworkRetryCount = frameworkRetryCount
|
|
261
263
|
options.worldParameters._ddIsDynamicAtrEnabled = isDynamicAtrEnabled
|
|
262
264
|
options.worldParameters._ddDynamicAtrBuckets = dynamicAtrBuckets
|
|
263
265
|
|
|
@@ -308,6 +310,7 @@ function readParallelWorkerWorldParameters (options) {
|
|
|
308
310
|
* [worldParameters._ddEarlyFlakeDetectionRetryPolicy]
|
|
309
311
|
*/
|
|
310
312
|
function readParallelWorkerAtrParameters (worldParameters) {
|
|
313
|
+
frameworkRetryCount = worldParameters._ddFrameworkRetryCount || 0
|
|
311
314
|
isFlakyTestRetriesEnabled = !!worldParameters._ddIsFlakyTestRetriesEnabled
|
|
312
315
|
hasAutomaticRetries = !!worldParameters._ddHasAutomaticRetries
|
|
313
316
|
numTestRetries = worldParameters._ddNumTestRetries ?? 0
|
|
@@ -392,9 +395,10 @@ function handleParallelTestCaseFinished (pickle, worstTestStepResult, usesNumeri
|
|
|
392
395
|
const finished = (pickleResultByFile[testFileAbsolutePath] ||= [])
|
|
393
396
|
|
|
394
397
|
const isAttemptToFix = isTestManagementTestsEnabled &&
|
|
395
|
-
getTestProperties(getTestSuitePath(testFileAbsolutePath, process.cwd()), pickle.name).attemptToFix
|
|
398
|
+
getTestProperties(getTestSuitePath(testFileAbsolutePath, process.cwd()), pickle.name, pickle).attemptToFix
|
|
396
399
|
|
|
397
|
-
if (!
|
|
400
|
+
if (!getScenarioAnnotations(pickle).noAutoRetry && !isAttemptToFix && shouldRunEarlyFlakeDetection() &&
|
|
401
|
+
(isNew || modifiedTestsByPickleId.get(pickle.id))) {
|
|
398
402
|
let testStatuses = efdStatusesByPickleId.get(pickle.id)
|
|
399
403
|
if (testStatuses) {
|
|
400
404
|
testStatuses.push(status)
|
|
@@ -577,11 +581,25 @@ function isNewTest (testSuite, testName) {
|
|
|
577
581
|
return !testsForSuite.includes(testName)
|
|
578
582
|
}
|
|
579
583
|
|
|
580
|
-
|
|
584
|
+
/** @param {{ tags?: Array<{ name: string }> }} pickle */
|
|
585
|
+
function getScenarioAnnotations (pickle) {
|
|
586
|
+
const tags = pickle.tags || []
|
|
587
|
+
return {
|
|
588
|
+
mustFail: tags.some(tag => tag.name === '@datadog:prevent_failure_suppression'),
|
|
589
|
+
noAutoRetry: tags.some(tag => tag.name === '@datadog:no_auto_retry'),
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
function getTestProperties (testSuite, testName, pickle) {
|
|
581
594
|
const { attempt_to_fix: attemptToFix, disabled, quarantined } =
|
|
582
595
|
testManagementTests?.cucumber?.suites?.[testSuite]?.tests?.[testName]?.properties || {}
|
|
583
596
|
|
|
584
|
-
|
|
597
|
+
const { mustFail, noAutoRetry } = getScenarioAnnotations(pickle)
|
|
598
|
+
return {
|
|
599
|
+
attemptToFix: attemptToFix && !noAutoRetry,
|
|
600
|
+
disabled: disabled && !mustFail,
|
|
601
|
+
quarantined: quarantined && !mustFail,
|
|
602
|
+
}
|
|
585
603
|
}
|
|
586
604
|
|
|
587
605
|
function getTestStatusFromRetries (testStatuses) {
|
|
@@ -745,9 +763,10 @@ function publishRetriedAttempt (runner, state) {
|
|
|
745
763
|
const nextAttempt = currentAttempt + 1
|
|
746
764
|
const failedAttemptCtx = numAttemptToCtx.get(currentAttempt)
|
|
747
765
|
const isFirstAttempt = currentAttempt === 0
|
|
748
|
-
const
|
|
766
|
+
const noAutoRetry = getScenarioAnnotations(runner.pickle).noAutoRetry
|
|
767
|
+
const isAtrRetry = !isFirstAttempt && state.hasAutomaticRetries && !noAutoRetry
|
|
749
768
|
|
|
750
|
-
if (isFirstAttempt && isDynamicAtrEnabled && isFlakyTestRetriesEnabled) {
|
|
769
|
+
if (!noAutoRetry && isFirstAttempt && isDynamicAtrEnabled && isFlakyTestRetriesEnabled) {
|
|
751
770
|
state.hasAutomaticRetries = true
|
|
752
771
|
state.dynamicAtrRetryCount = getDynamicAtrRetryCount(
|
|
753
772
|
performance.now() - state.executionStart,
|
|
@@ -760,7 +779,7 @@ function publishRetriedAttempt (runner, state) {
|
|
|
760
779
|
}
|
|
761
780
|
|
|
762
781
|
// ATR: record this attempt as failed so when run().finally runs (after retry) we have all statuses
|
|
763
|
-
if (state.hasAutomaticRetries) {
|
|
782
|
+
if (state.hasAutomaticRetries && !noAutoRetry) {
|
|
764
783
|
const nameForKey = getCucumberTestName(runner.pickle.name, currentAttempt > 0)
|
|
765
784
|
const atrKey = `${runner.pickle.uri}:${nameForKey}`
|
|
766
785
|
if (atrStatusesByScenarioKey.has(atrKey)) {
|
|
@@ -814,10 +833,11 @@ function wrapRun (pl, isLatestVersion, version) {
|
|
|
814
833
|
return run.apply(this, args)
|
|
815
834
|
}
|
|
816
835
|
|
|
817
|
-
// Cucumber
|
|
836
|
+
// Cucumber 7–10 workers construct runners directly, without the newer
|
|
818
837
|
// runTestCase wrapper that reads the coordinator's configuration.
|
|
819
|
-
if (getEnvironmentVariable('CUCUMBER_WORKER_ID') && satisfies(version, '>=
|
|
820
|
-
|
|
838
|
+
if (getEnvironmentVariable('CUCUMBER_WORKER_ID') && satisfies(version, '>=7.0.0 <11.0.0')) {
|
|
839
|
+
frameworkRetryCount = this.worldParameters._ddFrameworkRetryCount || 0
|
|
840
|
+
if (satisfies(version, '>=8.0.0')) readParallelWorkerAtrParameters(this.worldParameters)
|
|
821
841
|
}
|
|
822
842
|
|
|
823
843
|
const testFileAbsolutePath = this.pickle.uri
|
|
@@ -825,7 +845,14 @@ function wrapRun (pl, isLatestVersion, version) {
|
|
|
825
845
|
|
|
826
846
|
const testSourceLine = this.gherkinDocument?.feature?.location?.line
|
|
827
847
|
|
|
848
|
+
const testAnnotations = getScenarioAnnotations(this.pickle)
|
|
849
|
+
// Explicit native retries already include the pickle's retry-tag-filter decision.
|
|
850
|
+
if (testAnnotations.noAutoRetry && frameworkRetryCount === 0) this.maxAttempts = 1
|
|
828
851
|
const testStartPayload = {
|
|
852
|
+
testAnnotations,
|
|
853
|
+
assignedProperties: isTestManagementTestsEnabled
|
|
854
|
+
? testManagementTests?.cucumber?.suites?.[testSuitePath]?.tests?.[this.pickle.name]?.properties
|
|
855
|
+
: undefined,
|
|
829
856
|
testName: this.pickle.name,
|
|
830
857
|
testFileAbsolutePath,
|
|
831
858
|
testSourceLine,
|
|
@@ -839,7 +866,7 @@ function wrapRun (pl, isLatestVersion, version) {
|
|
|
839
866
|
const state = { numAttempt: 0, promises, testStartPayload, hasAutomaticRetries }
|
|
840
867
|
numAttemptToCtx.set(state.numAttempt, ctx)
|
|
841
868
|
runnerToRetryState.set(this, state)
|
|
842
|
-
if (isTestManagementTestsEnabled && getTestProperties(testSuitePath, this.pickle.name).attemptToFix) {
|
|
869
|
+
if (isTestManagementTestsEnabled && getTestProperties(testSuitePath, this.pickle.name, this.pickle).attemptToFix) {
|
|
843
870
|
logAttemptToFixTestExecution(testSuitePath, this.pickle.name, loggedAttemptToFixTests)
|
|
844
871
|
}
|
|
845
872
|
testStartCh.runStores(ctx, () => {})
|
|
@@ -894,7 +921,7 @@ function wrapRun (pl, isLatestVersion, version) {
|
|
|
894
921
|
|
|
895
922
|
if (isTestManagementTestsEnabled) {
|
|
896
923
|
const testSuitePath = getTestSuitePath(testFileAbsolutePath, process.cwd())
|
|
897
|
-
const testProperties = getTestProperties(testSuitePath, testName)
|
|
924
|
+
const testProperties = getTestProperties(testSuitePath, testName, this.pickle)
|
|
898
925
|
const numRetries = numRetriesByPickleId.get(this.pickle.id)
|
|
899
926
|
isAttemptToFix = testProperties.attemptToFix
|
|
900
927
|
isAttemptToFixRetry = isAttemptToFix && numRetries > 0
|
|
@@ -930,7 +957,7 @@ function wrapRun (pl, isLatestVersion, version) {
|
|
|
930
957
|
}
|
|
931
958
|
|
|
932
959
|
if (
|
|
933
|
-
shouldRunEarlyFlakeDetection() &&
|
|
960
|
+
!testAnnotations.noAutoRetry && shouldRunEarlyFlakeDetection() &&
|
|
934
961
|
!isAttemptToFix &&
|
|
935
962
|
status !== 'skip' &&
|
|
936
963
|
(isNew || isModified) &&
|
|
@@ -966,7 +993,8 @@ function wrapRun (pl, isLatestVersion, version) {
|
|
|
966
993
|
|
|
967
994
|
// ATR: accumulate statuses by stable scenario key (uri:name) so retries are grouped.
|
|
968
995
|
// Cucumber appends " (attempt N)" or " (attempt N, retried)" to the scenario name; normalize for keying.
|
|
969
|
-
if (
|
|
996
|
+
if (!testAnnotations.noAutoRetry && state.hasAutomaticRetries &&
|
|
997
|
+
!isAttemptToFix && !isEfdRetry && numTestRetries > 0) {
|
|
970
998
|
const atrKey = `${this.pickle.uri}:${testName}`
|
|
971
999
|
if (atrStatusesByScenarioKey.has(atrKey)) {
|
|
972
1000
|
atrStatusesByScenarioKey.get(atrKey).push(status)
|
|
@@ -1015,7 +1043,9 @@ function wrapRun (pl, isLatestVersion, version) {
|
|
|
1015
1043
|
|
|
1016
1044
|
// Notice that ATR is handled using cucumber native retries features.
|
|
1017
1045
|
// Therefore, if we reach this point, we are certain that it's the last ATR execution
|
|
1018
|
-
const isLastAtrRetry =
|
|
1046
|
+
const isLastAtrRetry = satisfies(version, '>=8.0.0') &&
|
|
1047
|
+
!testAnnotations.noAutoRetry && state.hasAutomaticRetries &&
|
|
1048
|
+
!isAttemptToFix && !isEfdRetry &&
|
|
1019
1049
|
numTestRetries > 0 && this.maxAttempts > 1
|
|
1020
1050
|
|
|
1021
1051
|
const statuses = lastStatusByPickleId.get(this.pickle.id)
|
|
@@ -1044,8 +1074,8 @@ function wrapRun (pl, isLatestVersion, version) {
|
|
|
1044
1074
|
error,
|
|
1045
1075
|
isNew,
|
|
1046
1076
|
isEfdRetry,
|
|
1047
|
-
isFlakyRetry: state.numAttempt > 0 && state.hasAutomaticRetries,
|
|
1048
|
-
isExternalRetry: state.numAttempt > 0 && !state.hasAutomaticRetries,
|
|
1077
|
+
isFlakyRetry: state.numAttempt > 0 && state.hasAutomaticRetries && !testAnnotations.noAutoRetry,
|
|
1078
|
+
isExternalRetry: state.numAttempt > 0 && (!state.hasAutomaticRetries || testAnnotations.noAutoRetry),
|
|
1049
1079
|
isAttemptToFix,
|
|
1050
1080
|
isAttemptToFixRetry,
|
|
1051
1081
|
hasFailedAllRetries,
|
|
@@ -1267,6 +1297,7 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
|
|
|
1267
1297
|
const command = getEnvironmentVariable('npm_lifecycle_script') || `cucumber-js ${processArgv}`
|
|
1268
1298
|
|
|
1269
1299
|
const originalRetryCount = options.retry
|
|
1300
|
+
frameworkRetryCount = options.retry || 0
|
|
1270
1301
|
hasAutomaticRetries = isFlakyTestRetriesEnabled && !options.retry && numTestRetries > 0
|
|
1271
1302
|
if (hasAutomaticRetries) {
|
|
1272
1303
|
options.retry = numTestRetries
|
|
@@ -1423,9 +1454,10 @@ function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = fa
|
|
|
1423
1454
|
let isQuarantined = false
|
|
1424
1455
|
let isModified = false
|
|
1425
1456
|
|
|
1457
|
+
const testAnnotations = getScenarioAnnotations(pickle)
|
|
1426
1458
|
const originalDryRun = this.options.dryRun
|
|
1427
1459
|
if (isTestManagementTestsEnabled) {
|
|
1428
|
-
const testProperties = getTestProperties(testSuitePath, pickle.name)
|
|
1460
|
+
const testProperties = getTestProperties(testSuitePath, pickle.name, pickle)
|
|
1429
1461
|
isAttemptToFix = testProperties.attemptToFix
|
|
1430
1462
|
isDisabled = testProperties.disabled
|
|
1431
1463
|
isQuarantined = testProperties.quarantined
|
|
@@ -1497,8 +1529,10 @@ function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = fa
|
|
|
1497
1529
|
}
|
|
1498
1530
|
}
|
|
1499
1531
|
const originalRetry = this.options.retry
|
|
1500
|
-
const isEfdTest = !
|
|
1532
|
+
const isEfdTest = !testAnnotations.noAutoRetry && !isAttemptToFix &&
|
|
1533
|
+
shouldRunEarlyFlakeDetection() && (isNew || isModified)
|
|
1501
1534
|
const isManagedRetry = isAttemptToFix || isEfdTest
|
|
1535
|
+
if (testAnnotations.noAutoRetry) this.options.retry = frameworkRetryCount
|
|
1502
1536
|
if (isManagedRetry) {
|
|
1503
1537
|
this.options.retry = 0
|
|
1504
1538
|
}
|