dd-trace 6.23.0 → 6.25.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/init.js +2 -22
- package/ci/test-annotations.d.ts +5 -0
- package/ci/test-annotations.js +5 -0
- 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 -1
- package/index.d.ts +124 -5
- package/initialize.mjs +5 -2
- package/lambda.d.ts +39 -0
- package/lambda.js +3 -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 +19 -15
- package/packages/datadog-core/src/storage.js +1 -1
- package/packages/datadog-esbuild/index.js +78 -62
- package/packages/datadog-instrumentations/src/aws-lambda.js +88 -0
- package/packages/datadog-instrumentations/src/cucumber.js +56 -19
- package/packages/datadog-instrumentations/src/cypress-config.js +163 -15
- package/packages/datadog-instrumentations/src/elevenlabs/activity.js +114 -0
- package/packages/datadog-instrumentations/src/elevenlabs/audio.js +104 -0
- package/packages/datadog-instrumentations/src/elevenlabs/index.js +288 -0
- package/packages/datadog-instrumentations/src/elevenlabs/session.js +444 -0
- package/packages/datadog-instrumentations/src/graphql.js +29 -20
- package/packages/datadog-instrumentations/src/grpc/server.js +23 -6
- package/packages/{datadog-esbuild/src/utils.js → datadog-instrumentations/src/helpers/bundler-esm-exports.js} +282 -40
- package/packages/datadog-instrumentations/src/helpers/bundler-transform.js +573 -0
- package/packages/datadog-instrumentations/src/helpers/bundler-utils.js +104 -0
- 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/hook.js +29 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +4 -8
- package/packages/datadog-instrumentations/src/helpers/lambda-handler.js +189 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +18 -6
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +26 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/async-mutex.js +41 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/elevenlabs.js +25 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql-jit.js +3 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql.js +0 -36
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/next.js +40 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/openai-agents-realtime.js +23 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/react-router.js +49 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/trpc.js +148 -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 +58 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.js +19 -2
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +25 -3
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +59 -2
- package/packages/datadog-instrumentations/src/ioredis.js +101 -3
- 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/next.js +19 -6
- package/packages/datadog-instrumentations/src/openai-agents-realtime.js +149 -0
- package/packages/datadog-instrumentations/src/openai-realtime/audio-accumulator.js +27 -0
- package/packages/datadog-instrumentations/src/openai-realtime/index.js +17 -6
- package/packages/datadog-instrumentations/src/openai-realtime/server-playback.js +887 -0
- package/packages/datadog-instrumentations/src/openai-realtime/session.js +150 -25
- package/packages/datadog-instrumentations/src/openai-realtime/turns.js +29 -2
- package/packages/datadog-instrumentations/src/oracledb.js +33 -0
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +11 -9
- 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-instrumentations/src/webdriverio.js +12 -12
- package/packages/datadog-plugin-async-mutex/src/index.js +50 -0
- package/packages/datadog-plugin-aws-lambda/src/index.js +106 -0
- package/packages/datadog-plugin-cucumber/src/index.js +5 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +296 -55
- 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-elevenlabs/src/index.js +69 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +10 -7
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +19 -52
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +4 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-request-context.js +25 -4
- package/packages/datadog-plugin-graphql/src/execute.js +2 -2
- package/packages/datadog-plugin-graphql/src/utils.js +5 -5
- package/packages/datadog-plugin-http/src/client.js +32 -9
- package/packages/datadog-plugin-http2/src/client.js +38 -13
- package/packages/datadog-plugin-jest/src/index.js +25 -3
- package/packages/datadog-plugin-mocha/src/index.js +47 -6
- package/packages/datadog-plugin-next/src/index.js +112 -14
- 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-prisma/src/datadog-tracing-helper.js +5 -3
- package/packages/datadog-plugin-react-router/src/index.js +118 -0
- package/packages/datadog-plugin-trpc/src/index.js +15 -0
- package/packages/datadog-plugin-trpc/src/procedure.js +48 -0
- package/packages/datadog-plugin-trpc/src/request.js +81 -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-undici/src/index.js +22 -7
- package/packages/datadog-plugin-vitest/src/index.js +8 -0
- package/packages/datadog-turbopack/index.js +4 -28
- package/packages/datadog-turbopack/src/loader.js +14 -452
- package/packages/datadog-webpack/index.js +3 -55
- package/packages/dd-trace/src/agent/info.js +2 -1
- package/packages/dd-trace/src/aiguard/evaluation.js +62 -1
- package/packages/dd-trace/src/aiguard/sdk.js +8 -13
- package/packages/dd-trace/src/aiguard/tags.js +2 -0
- package/packages/dd-trace/src/appsec/blocking/index.js +4 -0
- package/packages/dd-trace/src/appsec/graphql.js +91 -6
- package/packages/dd-trace/src/appsec/recommended.json +1287 -90
- package/packages/dd-trace/src/before-exit.js +32 -0
- package/packages/dd-trace/src/bootstrap.js +5 -3
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +24 -18
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +16 -36
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +41 -13
- package/packages/dd-trace/src/ci-visibility/exporters/request.js +2 -3
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +10 -18
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +10 -15
- 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/telemetry.js +6 -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 +10 -17
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache-schema.js +9 -134
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache.js +11 -156
- package/packages/dd-trace/src/config/config-types.d.ts +3 -0
- package/packages/dd-trace/src/config/defaults.js +9 -3
- package/packages/dd-trace/src/config/generated-config-types.d.ts +46 -2
- package/packages/dd-trace/src/config/index.js +111 -43
- package/packages/dd-trace/src/config/parsers.js +18 -1
- package/packages/dd-trace/src/config/supported-configurations.json +174 -4
- package/packages/dd-trace/src/constants.js +1 -0
- package/packages/dd-trace/src/debugger/pause-duration-histogram.js +2 -1
- 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 +23 -15
- 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 +83 -50
- package/packages/dd-trace/src/exporters/common/retry.js +12 -7
- package/packages/dd-trace/src/exporters/common/url.js +1 -1
- 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/id.js +1 -1
- package/packages/dd-trace/src/lambda/facade.js +74 -0
- package/packages/dd-trace/src/lambda/handler.js +3 -41
- package/packages/dd-trace/src/lambda/index.js +38 -15
- package/packages/dd-trace/src/lambda/runtime/patch.js +19 -3
- package/packages/dd-trace/src/lambda/wrap.js +44 -0
- package/packages/dd-trace/src/llmobs/constants/tags.js +3 -0
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +10 -5
- 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/elevenlabs.js +96 -0
- package/packages/dd-trace/src/llmobs/plugins/genai/index.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +27 -10
- package/packages/dd-trace/src/llmobs/plugins/openai/realtime.js +38 -11
- package/packages/dd-trace/src/llmobs/plugins/typesafe/index.js +102 -0
- package/packages/dd-trace/src/llmobs/plugins/vertexai.js +10 -2
- package/packages/dd-trace/src/llmobs/prompts/cache.js +3 -1
- package/packages/dd-trace/src/llmobs/sdk.js +21 -1
- package/packages/dd-trace/src/llmobs/span_processor.js +219 -12
- package/packages/dd-trace/src/llmobs/tagger.js +25 -0
- package/packages/dd-trace/src/llmobs/writers/util.js +3 -3
- package/packages/dd-trace/src/log/channels.js +4 -0
- package/packages/dd-trace/src/log/writer.js +13 -2
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +68 -6
- package/packages/dd-trace/src/openfeature/configuration_source.js +41 -17
- 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/flag-selection.js +152 -0
- package/packages/dd-trace/src/openfeature/flagging_provider.js +58 -14
- package/packages/dd-trace/src/openfeature/remote_config.js +16 -3
- package/packages/dd-trace/src/openfeature/writers/base.js +63 -30
- 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/logs/index.js +11 -0
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +7 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_exporter.js +4 -1
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +2 -2
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +19 -1
- package/packages/dd-trace/src/opentelemetry/span-ending-hook.js +5 -1
- package/packages/dd-trace/src/opentelemetry/span-helpers.js +6 -1
- package/packages/dd-trace/src/opentelemetry/span.js +2 -2
- package/packages/dd-trace/src/opentelemetry/startup-config.js +174 -0
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +7 -1
- package/packages/dd-trace/src/opentelemetry/tracer_provider.js +5 -1
- package/packages/dd-trace/src/opentracing/propagation/tracestate.js +77 -23
- package/packages/dd-trace/src/opentracing/tracer.js +33 -13
- package/packages/dd-trace/src/otel-thread-ctx.js +72 -49
- package/packages/dd-trace/src/plugin_manager.js +34 -7
- package/packages/dd-trace/src/plugins/ci_plugin.js +45 -14
- package/packages/dd-trace/src/plugins/index.js +9 -0
- package/packages/dd-trace/src/plugins/plugin.js +4 -2
- package/packages/dd-trace/src/plugins/tracing.js +1 -1
- package/packages/dd-trace/src/plugins/util/ci.js +18 -1
- package/packages/dd-trace/src/plugins/util/git-cache.js +4 -4
- package/packages/dd-trace/src/plugins/util/git.js +273 -86
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +77 -50
- package/packages/dd-trace/src/plugins/util/inferred_proxy.js +12 -4
- package/packages/dd-trace/src/plugins/util/status-validator.js +23 -10
- package/packages/dd-trace/src/plugins/util/tags.js +6 -0
- package/packages/dd-trace/src/plugins/util/test.js +90 -45
- package/packages/dd-trace/src/plugins/util/url.js +10 -2
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +2 -2
- package/packages/dd-trace/src/plugins/util/web.js +81 -10
- 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/profiling/webspan-utils.js +6 -5
- package/packages/dd-trace/src/proxy.js +48 -57
- package/packages/dd-trace/src/serverless.js +3 -2
- package/packages/dd-trace/src/span_processor.js +41 -9
- package/packages/dd-trace/src/span_stats.js +28 -2
- package/packages/dd-trace/src/startup-log.js +8 -5
- 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/metrics.js +2 -1
- package/packages/dd-trace/src/telemetry/telemetry.js +10 -3
- package/packages/dd-trace/src/tracer.js +0 -2
- package/packages/dd-trace/src/util.js +1 -1
- package/packages/dd-trace/src/web-tags-cache.js +8 -9
- package/register.js +4 -2
- package/vendor/dist/@apm-js-collab/code-transformer/LICENSE +489 -0
- package/vendor/dist/{@opentelemetry/resources → @datadog/flagging-core}/LICENSE +22 -2
- package/vendor/dist/@datadog/flagging-core/index.js +1 -0
- package/vendor/dist/@datadog/openfeature-node-server/LICENSE +21 -1
- package/vendor/dist/@datadog/openfeature-node-server/index.js +1 -1
- package/vendor/dist/@datadog/openfeature-node-server/rules-based/LICENSE +3 -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/@datadog/sketches-js/LICENSE +263 -0
- package/vendor/dist/@datadog/source-map/LICENSE +1 -0
- package/vendor/dist/@isaacs/ttlcache/LICENSE +13 -0
- package/vendor/dist/@opentelemetry/core/LICENSE +209 -1
- package/vendor/dist/@opentelemetry/core/index.js +1 -1
- package/vendor/dist/crypto-randomuuid/LICENSE +3 -0
- package/vendor/dist/escape-string-regexp/LICENSE +13 -0
- package/vendor/dist/esquery/LICENSE +2 -0
- package/vendor/dist/https-proxy-agent/LICENSE +80 -1
- package/vendor/dist/istanbul-lib-coverage/LICENSE +2 -0
- package/vendor/dist/jest-docblock/LICENSE +16 -0
- package/vendor/dist/jsonpath-plus/LICENSE +13 -0
- package/vendor/dist/limiter/LICENSE +2 -0
- package/vendor/dist/lodash.sortby/LICENSE +2 -0
- package/vendor/dist/lru-cache/LICENSE +13 -0
- package/vendor/dist/meriyah/LICENSE +13 -0
- package/vendor/dist/module-details-from-path/LICENSE +2 -0
- package/vendor/dist/mutexify/promise/LICENSE +28 -0
- package/vendor/dist/pprof-format/LICENSE +13 -0
- package/vendor/dist/pprof-format/index.js +1 -1
- package/vendor/dist/protobufjs/LICENSE +219 -0
- package/vendor/dist/protobufjs/minimal/LICENSE +219 -0
- package/vendor/dist/proxy-from-env/LICENSE +13 -0
- package/vendor/dist/retry/LICENSE +2 -0
- package/vendor/dist/rfdc/LICENSE +2 -0
- package/vendor/dist/semifies/LICENSE +3 -1
- package/vendor/dist/shell-quote/LICENSE +3 -1
- package/vendor/dist/source-map/LICENSE +1 -0
- package/vendor/dist/source-map/lib/util/LICENSE +1 -0
- package/vendor/dist/tlhunter-sorted-set/LICENSE +2 -0
- package/vendor/dist/ttl-set/LICENSE +28 -0
- package/ci/diagnose.js +0 -2215
- package/ci/runbook.md +0 -299
- package/ci/test-optimization-validation/approval-artifacts.js +0 -175
- package/ci/test-optimization-validation/approval.js +0 -386
- package/ci/test-optimization-validation/artifact-id.js +0 -19
- package/ci/test-optimization-validation/blocker-category.js +0 -24
- package/ci/test-optimization-validation/bounded-json.js +0 -120
- package/ci/test-optimization-validation/ci-command-candidate.js +0 -77
- package/ci/test-optimization-validation/ci-discovery.js +0 -192
- package/ci/test-optimization-validation/ci-package-scripts.js +0 -169
- package/ci/test-optimization-validation/ci-remediation.js +0 -283
- package/ci/test-optimization-validation/cli.js +0 -954
- package/ci/test-optimization-validation/command-blocker.js +0 -377
- package/ci/test-optimization-validation/command-output-policy.js +0 -188
- package/ci/test-optimization-validation/command-runner.js +0 -650
- package/ci/test-optimization-validation/environment.js +0 -88
- package/ci/test-optimization-validation/executable-approval.js +0 -47
- package/ci/test-optimization-validation/executable.js +0 -244
- package/ci/test-optimization-validation/execution-lock.js +0 -70
- package/ci/test-optimization-validation/framework-adapters/cucumber-validation.json +0 -3
- package/ci/test-optimization-validation/framework-adapters/cucumber.js +0 -767
- package/ci/test-optimization-validation/framework-adapters/cypress.js +0 -99
- package/ci/test-optimization-validation/framework-adapters/playwright.js +0 -175
- package/ci/test-optimization-validation/framework-adapters/vitest.js +0 -513
- package/ci/test-optimization-validation/generated-file-policy.js +0 -63
- package/ci/test-optimization-validation/generated-files.js +0 -425
- package/ci/test-optimization-validation/generated-test-contract.js +0 -284
- package/ci/test-optimization-validation/generated-verifier.js +0 -235
- package/ci/test-optimization-validation/literal-environment.js +0 -56
- package/ci/test-optimization-validation/literal-glob.js +0 -52
- package/ci/test-optimization-validation/manifest-loader.js +0 -116
- package/ci/test-optimization-validation/manifest-scaffold.js +0 -1276
- package/ci/test-optimization-validation/manifest-schema.js +0 -695
- package/ci/test-optimization-validation/offline-fixtures.js +0 -335
- package/ci/test-optimization-validation/offline-output.js +0 -406
- package/ci/test-optimization-validation/package-check.js +0 -97
- package/ci/test-optimization-validation/payload-normalizer.js +0 -72
- package/ci/test-optimization-validation/plan-writer.js +0 -541
- package/ci/test-optimization-validation/preflight-runner.js +0 -186
- package/ci/test-optimization-validation/project-build-artifact.js +0 -31
- package/ci/test-optimization-validation/redaction.js +0 -319
- package/ci/test-optimization-validation/report-writer.js +0 -666
- package/ci/test-optimization-validation/result-semantics.js +0 -103
- package/ci/test-optimization-validation/runner-command.js +0 -264
- package/ci/test-optimization-validation/runner-contract.js +0 -695
- package/ci/test-optimization-validation/safe-files.js +0 -202
- package/ci/test-optimization-validation/scenarios/auto-test-retries.js +0 -171
- package/ci/test-optimization-validation/scenarios/basic-reporting.js +0 -407
- package/ci/test-optimization-validation/scenarios/ci-wiring.js +0 -666
- package/ci/test-optimization-validation/scenarios/early-flake-detection.js +0 -142
- package/ci/test-optimization-validation/scenarios/helpers.js +0 -621
- package/ci/test-optimization-validation/scenarios/test-management.js +0 -219
- package/ci/test-optimization-validation/source-text.js +0 -84
- package/ci/test-optimization-validation/static-diagnosis.js +0 -166
- package/ci/test-optimization-validation/test-output.js +0 -120
- package/ci/test-optimization-validation/validation-blocker.js +0 -21
- package/ci/validate-test-optimization.js +0 -3
- package/packages/datadog-esbuild/src/resolver.js +0 -284
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/index.js +0 -156
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/msgpack-to-json.js +0 -287
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/payload-projection.js +0 -84
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/sink.js +0 -368
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/writer.js +0 -59
- package/vendor/dist/@opentelemetry/resources/index.js +0 -1
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// Capture real timers at module load, before any test can install fake timers.
|
|
4
4
|
const { performance } = require('perf_hooks')
|
|
5
5
|
const { basename } = require('node:path')
|
|
6
|
+
const { isDeepStrictEqual } = require('node:util')
|
|
6
7
|
const dateNow = Date.now
|
|
7
8
|
|
|
8
9
|
const { createCoverageMap } = require('../../../vendor/dist/istanbul-lib-coverage')
|
|
@@ -67,6 +68,8 @@ const {
|
|
|
67
68
|
TEST_MANAGEMENT_ENABLED,
|
|
68
69
|
TEST_MANAGEMENT_IS_DISABLED,
|
|
69
70
|
TEST_MANAGEMENT_IS_ATTEMPT_TO_FIX,
|
|
71
|
+
TEST_MANAGEMENT_PREVENT_FAILURE_SUPPRESSION,
|
|
72
|
+
TEST_MANAGEMENT_NO_AUTO_RETRY,
|
|
70
73
|
TEST_MANAGEMENT_ATTEMPT_TO_FIX_PASSED,
|
|
71
74
|
TEST_HAS_FAILED_ALL_RETRIES,
|
|
72
75
|
getLibraryCapabilitiesTags,
|
|
@@ -96,6 +99,8 @@ const {
|
|
|
96
99
|
const { ORIGIN_KEY, COMPONENT } = require('../../dd-trace/src/constants')
|
|
97
100
|
const { RESOURCE_NAME } = require('../../../ext/tags')
|
|
98
101
|
const getConfig = require('../../dd-trace/src/config')
|
|
102
|
+
const { getRepositoryRoot } = require('../../dd-trace/src/plugins/util/git')
|
|
103
|
+
const { getUserProviderGitMetadata } = require('../../dd-trace/src/plugins/util/user-provided-git')
|
|
99
104
|
const { getValueFromEnvSources } = require('../../dd-trace/src/config/helper')
|
|
100
105
|
const {
|
|
101
106
|
SCREENSHOT_UPLOAD_RESULT_ERROR,
|
|
@@ -131,7 +136,8 @@ const {
|
|
|
131
136
|
GIT_COMMIT_SHA,
|
|
132
137
|
GIT_BRANCH,
|
|
133
138
|
CI_PROVIDER_NAME,
|
|
134
|
-
|
|
139
|
+
GIT_CHECKOUT_ROOT,
|
|
140
|
+
GIT_CHECKOUT_IS_CUSTOM,
|
|
135
141
|
GIT_COMMIT_MESSAGE,
|
|
136
142
|
GIT_TAG,
|
|
137
143
|
GIT_PULL_REQUEST_BASE_BRANCH_SHA,
|
|
@@ -147,6 +153,8 @@ const {
|
|
|
147
153
|
RUNTIME_VERSION,
|
|
148
154
|
} = require('../../dd-trace/src/plugins/util/env')
|
|
149
155
|
const { DD_MAJOR } = require('../../../version')
|
|
156
|
+
const observeRetryConfig = require('./retry-config-observer')
|
|
157
|
+
const observeSetupHandoff = require('./setup-handoff')
|
|
150
158
|
const {
|
|
151
159
|
resolveOriginalSourceFile,
|
|
152
160
|
resolveSourceLineForTest,
|
|
@@ -356,17 +364,20 @@ function getTestManagementTests (tracer, testConfiguration) {
|
|
|
356
364
|
})
|
|
357
365
|
}
|
|
358
366
|
|
|
359
|
-
function getModifiedFiles (testEnvironmentMetadata) {
|
|
367
|
+
function getModifiedFiles (testEnvironmentMetadata, gitRoot) {
|
|
368
|
+
const isCustomCheckout = testEnvironmentMetadata[GIT_CHECKOUT_IS_CUSTOM] === 'true'
|
|
369
|
+
const diffMetadata = isCustomCheckout ? getUserProviderGitMetadata() : testEnvironmentMetadata
|
|
360
370
|
const {
|
|
361
371
|
[GIT_PULL_REQUEST_BASE_BRANCH]: pullRequestBaseBranch,
|
|
362
372
|
[GIT_PULL_REQUEST_BASE_BRANCH_SHA]: pullRequestBaseBranchSha,
|
|
363
373
|
[GIT_COMMIT_HEAD_SHA]: commitHeadSha,
|
|
364
|
-
} =
|
|
374
|
+
} = diffMetadata
|
|
375
|
+
const targetCommit = commitHeadSha || (isCustomCheckout ? testEnvironmentMetadata[GIT_COMMIT_SHA] : undefined)
|
|
365
376
|
|
|
366
|
-
const baseBranchSha = pullRequestBaseBranchSha || getPullRequestBaseBranch(pullRequestBaseBranch)
|
|
377
|
+
const baseBranchSha = pullRequestBaseBranchSha || getPullRequestBaseBranch(pullRequestBaseBranch, gitRoot)
|
|
367
378
|
|
|
368
379
|
if (baseBranchSha) {
|
|
369
|
-
const diff = getPullRequestDiff(baseBranchSha,
|
|
380
|
+
const diff = getPullRequestDiff(baseBranchSha, targetCommit, gitRoot)
|
|
370
381
|
const modifiedFiles = getModifiedFilesFromDiff(diff)
|
|
371
382
|
if (modifiedFiles) {
|
|
372
383
|
return modifiedFiles
|
|
@@ -420,7 +431,8 @@ function getFinalStatusRetryKind ({
|
|
|
420
431
|
return FINAL_STATUS_RETRY_KIND.efd
|
|
421
432
|
}
|
|
422
433
|
|
|
423
|
-
if (finishedTestAttempts.length > 1 &&
|
|
434
|
+
if (!finishedTest.noAutoRetry && finishedTestAttempts.length > 1 &&
|
|
435
|
+
(isDynamicAtrEnabled || flakyTestRetriesCount > 0)) {
|
|
424
436
|
return FINAL_STATUS_RETRY_KIND.atr
|
|
425
437
|
}
|
|
426
438
|
|
|
@@ -453,6 +465,61 @@ function getFinalStatus ({
|
|
|
453
465
|
}
|
|
454
466
|
}
|
|
455
467
|
|
|
468
|
+
/**
|
|
469
|
+
* Copies retry configuration without sharing nested experimental options with user code.
|
|
470
|
+
*
|
|
471
|
+
* @template T
|
|
472
|
+
* @param {T} retries
|
|
473
|
+
* @returns {T}
|
|
474
|
+
*/
|
|
475
|
+
function copyCypressRetries (retries) {
|
|
476
|
+
// Cypress 6 supports Node.js 12, which does not provide structuredClone.
|
|
477
|
+
// eslint-disable-next-line unicorn/prefer-structured-clone
|
|
478
|
+
return retries !== null && typeof retries === 'object' ? JSON.parse(JSON.stringify(retries)) : retries
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// Cypress treats omitted/undefined object fields as defaults, while null replaces them.
|
|
482
|
+
function mergeNativeRetries (baseline, supplied) {
|
|
483
|
+
if (supplied === undefined) return copyCypressRetries(baseline)
|
|
484
|
+
if (!supplied || typeof supplied !== 'object') return supplied
|
|
485
|
+
const result = baseline && typeof baseline === 'object' ? copyCypressRetries(baseline) : {}
|
|
486
|
+
for (const key of Object.keys(supplied)) result[key] = mergeNativeRetries(result[key], supplied[key])
|
|
487
|
+
return result
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
function updateNativeRetries (native, baseline, supplied, path) {
|
|
491
|
+
if (!path.length) return mergeNativeRetries(baseline, supplied)
|
|
492
|
+
if (typeof native === 'number') native = { runMode: native, openMode: native }
|
|
493
|
+
if (typeof baseline === 'number') baseline = { runMode: baseline, openMode: baseline }
|
|
494
|
+
const [key, ...rest] = path
|
|
495
|
+
const result = native && typeof native === 'object' ? copyCypressRetries(native) : {}
|
|
496
|
+
result[key] = updateNativeRetries(result[key], baseline && baseline[key], supplied && supplied[key], rest)
|
|
497
|
+
return result
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
function reconcileNativeRetries (native, baseline, configured, actual) {
|
|
501
|
+
if (isDeepStrictEqual(configured, actual)) return native
|
|
502
|
+
if (!actual || typeof actual !== 'object' || !configured || typeof configured !== 'object') {
|
|
503
|
+
return mergeNativeRetries(baseline, actual)
|
|
504
|
+
}
|
|
505
|
+
if (typeof native === 'number') native = { runMode: native, openMode: native }
|
|
506
|
+
if (typeof baseline === 'number') baseline = { runMode: baseline, openMode: baseline }
|
|
507
|
+
const result = native && typeof native === 'object' ? copyCypressRetries(native) : {}
|
|
508
|
+
for (const key of Object.keys(actual)) {
|
|
509
|
+
if (!isDeepStrictEqual(configured[key], actual[key])) {
|
|
510
|
+
result[key] = reconcileNativeRetries(result[key], baseline && baseline[key], configured[key], actual[key])
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
for (const key of Object.keys(configured)) {
|
|
514
|
+
// Cypress 6's plugin process uses Node 12, which predates Object.hasOwn.
|
|
515
|
+
// eslint-disable-next-line prefer-object-has-own
|
|
516
|
+
if (!Object.prototype.hasOwnProperty.call(actual, key)) {
|
|
517
|
+
result[key] = copyCypressRetries(baseline && baseline[key])
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
return result
|
|
521
|
+
}
|
|
522
|
+
|
|
456
523
|
class CypressPlugin {
|
|
457
524
|
#pendingTestSuiteSpans = new Map()
|
|
458
525
|
|
|
@@ -489,6 +556,7 @@ class CypressPlugin {
|
|
|
489
556
|
hasForcedToRunSuites = false
|
|
490
557
|
hasUnskippableSuites = false
|
|
491
558
|
unskippableSuites = []
|
|
559
|
+
testAnnotationsBySuite = new Map()
|
|
492
560
|
knownTests = []
|
|
493
561
|
isTestManagementTestsEnabled = false
|
|
494
562
|
testManagementAttemptToFixRetries = 0
|
|
@@ -517,7 +585,8 @@ class CypressPlugin {
|
|
|
517
585
|
[RUNTIME_VERSION]: runtimeVersion,
|
|
518
586
|
[GIT_BRANCH]: branch,
|
|
519
587
|
[CI_PROVIDER_NAME]: ciProviderName,
|
|
520
|
-
[
|
|
588
|
+
[GIT_CHECKOUT_ROOT]: gitRoot,
|
|
589
|
+
[GIT_CHECKOUT_IS_CUSTOM]: isCustomCheckout,
|
|
521
590
|
[GIT_COMMIT_MESSAGE]: commitMessage,
|
|
522
591
|
[GIT_TAG]: tag,
|
|
523
592
|
[GIT_PULL_REQUEST_BASE_BRANCH_SHA]: pullRequestBaseSha,
|
|
@@ -525,13 +594,14 @@ class CypressPlugin {
|
|
|
525
594
|
[GIT_COMMIT_HEAD_MESSAGE]: commitHeadMessage,
|
|
526
595
|
} = this.testEnvironmentMetadata
|
|
527
596
|
|
|
528
|
-
this.repositoryRoot =
|
|
597
|
+
this.repositoryRoot = gitRoot || getRepositoryRoot() || process.cwd()
|
|
529
598
|
this.ciProviderName = ciProviderName
|
|
530
|
-
this.codeOwnersEntries = getCodeOwnersFileEntries(repositoryRoot)
|
|
599
|
+
this.codeOwnersEntries = getCodeOwnersFileEntries(this.repositoryRoot)
|
|
531
600
|
|
|
532
601
|
this.testConfiguration = {
|
|
533
602
|
repositoryUrl,
|
|
534
603
|
sha,
|
|
604
|
+
gitRoot: this.repositoryRoot,
|
|
535
605
|
osVersion,
|
|
536
606
|
osPlatform,
|
|
537
607
|
osArchitecture,
|
|
@@ -542,8 +612,11 @@ class CypressPlugin {
|
|
|
542
612
|
commitMessage,
|
|
543
613
|
tag,
|
|
544
614
|
pullRequestBaseSha,
|
|
545
|
-
|
|
546
|
-
|
|
615
|
+
// Only an explicit PR head can override the selected commit in a custom checkout.
|
|
616
|
+
commitHeadSha: isCustomCheckout === 'true'
|
|
617
|
+
? getUserProviderGitMetadata()[GIT_COMMIT_HEAD_SHA]
|
|
618
|
+
: commitHeadSha,
|
|
619
|
+
commitHeadMessage: isCustomCheckout === 'true' ? undefined : commitHeadMessage,
|
|
547
620
|
}
|
|
548
621
|
}
|
|
549
622
|
|
|
@@ -556,6 +629,7 @@ class CypressPlugin {
|
|
|
556
629
|
this.#pendingTestSuiteSpans.clear()
|
|
557
630
|
this._isInit = false
|
|
558
631
|
this.finishedTestsByFile = {}
|
|
632
|
+
this.resolvedCypressRetries = undefined
|
|
559
633
|
this.hasTestsReported = false
|
|
560
634
|
this.testSuiteStatuses = new Set()
|
|
561
635
|
this.testStatuses = {}
|
|
@@ -590,6 +664,7 @@ class CypressPlugin {
|
|
|
590
664
|
this.isTestManagementTestsEnabled = false
|
|
591
665
|
this.testManagementAttemptToFixRetries = 0
|
|
592
666
|
this.testManagementTests = undefined
|
|
667
|
+
this.testAnnotationsBySuite = new Map()
|
|
593
668
|
this.isImpactedTestsEnabled = false
|
|
594
669
|
this.modifiedFiles = []
|
|
595
670
|
this.attemptToFixExecutions = new Map()
|
|
@@ -839,17 +914,24 @@ class CypressPlugin {
|
|
|
839
914
|
// Depending on the received configuration, the Cypress configuration can be modified:
|
|
840
915
|
// for example, to enable retries for failed tests.
|
|
841
916
|
init (tracer, cypressConfig) {
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
917
|
+
this.retryConfigObserver?.stop()
|
|
918
|
+
this.retryConfigObserver = undefined
|
|
919
|
+
this.stopSetupHandoff?.()
|
|
920
|
+
this.stopSetupHandoff = undefined
|
|
921
|
+
const isReusedConfig = this.cypressConfig === cypressConfig && this.hasOriginalCypressRetries
|
|
922
|
+
const retryDescriptor = Object.getOwnPropertyDescriptor(cypressConfig, 'retries')
|
|
923
|
+
if (retryDescriptor && !retryDescriptor.writable && !retryDescriptor.set) {
|
|
924
|
+
// Setup may make the retry root read-only before initial or repeated use.
|
|
925
|
+
// Work on a private copy without changing the external retry descriptor.
|
|
926
|
+
cypressConfig = { ...cypressConfig }
|
|
927
|
+
}
|
|
928
|
+
if (isReusedConfig) {
|
|
929
|
+
cypressConfig.retries = copyCypressRetries(this.originalCypressRetries)
|
|
847
930
|
} else {
|
|
848
|
-
this.originalCypressRetries = cypressConfig.retries
|
|
849
|
-
? { ...cypressConfig.retries }
|
|
850
|
-
: cypressConfig.retries
|
|
931
|
+
this.originalCypressRetries = copyCypressRetries(cypressConfig.retries)
|
|
851
932
|
this.hasOriginalCypressRetries = true
|
|
852
933
|
}
|
|
934
|
+
this.nativeCypressRetriesBaseline = copyCypressRetries(cypressConfig.retries)
|
|
853
935
|
this.resetRunState()
|
|
854
936
|
this._isInit = true
|
|
855
937
|
this.tracer = tracer
|
|
@@ -878,8 +960,47 @@ class CypressPlugin {
|
|
|
878
960
|
tracer._tracer._config.isServiceUserProvided ? 'true' : 'false'
|
|
879
961
|
|
|
880
962
|
this._pendingRequestErrorTags = []
|
|
963
|
+
const handoff = { seen: false, hasReply: false, retries: undefined }
|
|
964
|
+
const stopSetupHandoff = observeSetupHandoff((returnedConfig, event) => {
|
|
965
|
+
handoff.seen = true
|
|
966
|
+
if (event === 'setupTestingType:reply') {
|
|
967
|
+
handoff.hasReply = true
|
|
968
|
+
const retryProperty = returnedConfig && Object.getOwnPropertyDescriptor(returnedConfig, 'retries')
|
|
969
|
+
handoff.retries = mergeNativeRetries(
|
|
970
|
+
this.nativeCypressRetriesBaseline, retryProperty?.enumerable ? returnedConfig.retries : undefined
|
|
971
|
+
)
|
|
972
|
+
}
|
|
973
|
+
})
|
|
974
|
+
this.stopSetupHandoff = stopSetupHandoff
|
|
881
975
|
this.libraryConfigurationPromise = getLibraryConfiguration(this.tracer, this.testConfiguration)
|
|
882
976
|
.then((libraryConfigurationResponse) => {
|
|
977
|
+
stopSetupHandoff()
|
|
978
|
+
if (this.stopSetupHandoff === stopSetupHandoff) this.stopSetupHandoff = undefined
|
|
979
|
+
if (handoff.hasReply) {
|
|
980
|
+
// Keep the serialized retry snapshot independent of later child-local writes.
|
|
981
|
+
const properties = Object.getOwnPropertyDescriptors(this.cypressConfig)
|
|
982
|
+
for (const key of Reflect.ownKeys(properties)) {
|
|
983
|
+
const property = properties[key]
|
|
984
|
+
property.configurable = true
|
|
985
|
+
if ('value' in property) property.writable = true
|
|
986
|
+
}
|
|
987
|
+
properties.retries = {
|
|
988
|
+
value: copyCypressRetries(handoff.retries), enumerable: true, configurable: true, writable: true,
|
|
989
|
+
}
|
|
990
|
+
this.cypressConfig = Object.defineProperties({}, properties)
|
|
991
|
+
}
|
|
992
|
+
// Manual setup can make retries read-only while settings are pending.
|
|
993
|
+
// Keep later SDK writes private without changing the user's retry descriptor.
|
|
994
|
+
const pendingRetryDescriptor = Object.getOwnPropertyDescriptor(this.cypressConfig, 'retries')
|
|
995
|
+
if (pendingRetryDescriptor && !pendingRetryDescriptor.writable && !pendingRetryDescriptor.set) {
|
|
996
|
+
this.cypressConfig = { ...this.cypressConfig }
|
|
997
|
+
}
|
|
998
|
+
// Setup can change native retries while backend settings are resolving.
|
|
999
|
+
// Capture them before the first SDK retry write, including on settings errors.
|
|
1000
|
+
this.cypressConfig.retries = mergeNativeRetries(
|
|
1001
|
+
this.nativeCypressRetriesBaseline, this.cypressConfig.retries
|
|
1002
|
+
)
|
|
1003
|
+
this.originalCypressRetries = copyCypressRetries(this.cypressConfig.retries)
|
|
883
1004
|
if (libraryConfigurationResponse.err) {
|
|
884
1005
|
log.error('Cypress plugin library config response error', libraryConfigurationResponse.err)
|
|
885
1006
|
this._pendingRequestErrorTags.push({
|
|
@@ -928,15 +1049,36 @@ class CypressPlugin {
|
|
|
928
1049
|
}
|
|
929
1050
|
// Dynamic ATR starts at the maximum budget, then narrows each test
|
|
930
1051
|
// after its initial duration is known.
|
|
931
|
-
|
|
932
|
-
|
|
1052
|
+
const retryCount = this.isDynamicAtrEnabled
|
|
1053
|
+
? Math.max(
|
|
933
1054
|
1,
|
|
934
1055
|
this.dynamicAtrBuckets
|
|
935
1056
|
? Math.max(...this.dynamicAtrBuckets)
|
|
936
1057
|
: this.earlyFlakeDetectionRetryPolicy.schedulingRetryCount
|
|
937
1058
|
)
|
|
1059
|
+
: this.flakyTestRetriesCount
|
|
1060
|
+
if (this.cypressConfig.retries.experimentalStrategy) {
|
|
1061
|
+
if (this.cypressConfig.isTextTerminal !== false) {
|
|
1062
|
+
if (this.cypressConfig.retries.runMode === true) {
|
|
1063
|
+
// Keep an active native strategy and its budget floor.
|
|
1064
|
+
this.cypressConfig.retries.experimentalOptions = {
|
|
1065
|
+
...this.cypressConfig.retries.experimentalOptions,
|
|
1066
|
+
maxRetries: Math.max(this.cypressConfig.retries.experimentalOptions?.maxRetries ?? 0, retryCount),
|
|
1067
|
+
}
|
|
1068
|
+
} else if (retryCount > 0) {
|
|
1069
|
+
// An inactive experimental strategy must not change ordinary ATR policy.
|
|
1070
|
+
const { openMode, experimentalOptions } = this.cypressConfig.retries
|
|
1071
|
+
this.cypressConfig.retries = {
|
|
1072
|
+
// Explicit nulls prevent Cypress's config merge from retaining inactive options.
|
|
1073
|
+
experimentalStrategy: null,
|
|
1074
|
+
experimentalOptions: null,
|
|
1075
|
+
openMode: openMode === true ? experimentalOptions?.maxRetries ?? 0 : 0,
|
|
1076
|
+
runMode: retryCount,
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
938
1080
|
} else {
|
|
939
|
-
this.cypressConfig.retries.runMode =
|
|
1081
|
+
this.cypressConfig.retries.runMode = retryCount
|
|
940
1082
|
}
|
|
941
1083
|
} else {
|
|
942
1084
|
this.flakyTestRetriesCount = 0
|
|
@@ -945,6 +1087,20 @@ class CypressPlugin {
|
|
|
945
1087
|
this.testManagementAttemptToFixRetries = testManagementAttemptToFixRetries
|
|
946
1088
|
this.isImpactedTestsEnabled = isImpactedTestsEnabled
|
|
947
1089
|
}
|
|
1090
|
+
this.configuredCypressRetries = copyCypressRetries(this.cypressConfig.retries)
|
|
1091
|
+
if (!handoff.seen) {
|
|
1092
|
+
this.retryConfigObserver = observeRetryConfig(this.cypressConfig, (retries, path, provenance) => {
|
|
1093
|
+
this.originalCypressRetries = copyCypressRetries(provenance.retries)
|
|
1094
|
+
}, {
|
|
1095
|
+
nativeRetries: copyCypressRetries(this.originalCypressRetries),
|
|
1096
|
+
reconcileNative: (native, observed, actual) => reconcileNativeRetries(
|
|
1097
|
+
native, this.nativeCypressRetriesBaseline, observed, actual
|
|
1098
|
+
),
|
|
1099
|
+
updateNative: (native, retries, path) => updateNativeRetries(
|
|
1100
|
+
native, this.nativeCypressRetriesBaseline, retries, path
|
|
1101
|
+
),
|
|
1102
|
+
})
|
|
1103
|
+
}
|
|
948
1104
|
return this.cypressConfig
|
|
949
1105
|
})
|
|
950
1106
|
return this.libraryConfigurationPromise
|
|
@@ -1001,8 +1157,9 @@ class CypressPlugin {
|
|
|
1001
1157
|
* @param {string} testSuite
|
|
1002
1158
|
* @param {string} testId
|
|
1003
1159
|
* @param {number | undefined} duration
|
|
1160
|
+
* @param {number} [nativeRetryFloor]
|
|
1004
1161
|
*/
|
|
1005
|
-
setDynamicAtrRetryCountForTest (testSuite, testId, duration) {
|
|
1162
|
+
setDynamicAtrRetryCountForTest (testSuite, testId, duration, nativeRetryFloor = 0) {
|
|
1006
1163
|
if (!this.dynamicAtrRetryCountByTest) {
|
|
1007
1164
|
this.dynamicAtrRetryCountByTest = new Map()
|
|
1008
1165
|
}
|
|
@@ -1011,11 +1168,11 @@ class CypressPlugin {
|
|
|
1011
1168
|
retryCountByTestId = new Map()
|
|
1012
1169
|
this.dynamicAtrRetryCountByTest.set(testSuite, retryCountByTestId)
|
|
1013
1170
|
}
|
|
1014
|
-
const retryCount = getDynamicAtrRetryCount(
|
|
1171
|
+
const retryCount = Math.max(nativeRetryFloor, getDynamicAtrRetryCount(
|
|
1015
1172
|
duration ?? 0,
|
|
1016
1173
|
this.earlyFlakeDetectionRetryPolicy,
|
|
1017
1174
|
this.dynamicAtrBuckets
|
|
1018
|
-
)
|
|
1175
|
+
))
|
|
1019
1176
|
retryCountByTestId.set(testId, retryCount)
|
|
1020
1177
|
return retryCount
|
|
1021
1178
|
}
|
|
@@ -1079,7 +1236,8 @@ class CypressPlugin {
|
|
|
1079
1236
|
}
|
|
1080
1237
|
|
|
1081
1238
|
getTestSpan ({
|
|
1082
|
-
testName, testSuite, isUnskippable, isForcedToRun, testSourceFile, isDisabled, isQuarantined,
|
|
1239
|
+
testName, testSuite, isUnskippable, isForcedToRun, testSourceFile, isDisabled, isQuarantined,
|
|
1240
|
+
isAttemptToFix, annotations, startTime,
|
|
1083
1241
|
}) {
|
|
1084
1242
|
const testSuiteTags = {
|
|
1085
1243
|
[TEST_MODULE]: TEST_FRAMEWORK_NAME,
|
|
@@ -1125,6 +1283,10 @@ class CypressPlugin {
|
|
|
1125
1283
|
testSpanMetadata[TEST_ITR_FORCED_RUN] = 'true'
|
|
1126
1284
|
}
|
|
1127
1285
|
|
|
1286
|
+
if (annotations && annotations.mustFail) testSpanMetadata[TEST_MANAGEMENT_PREVENT_FAILURE_SUPPRESSION] = 'true'
|
|
1287
|
+
if (annotations && annotations.noAutoRetry) testSpanMetadata[TEST_MANAGEMENT_NO_AUTO_RETRY] = 'true'
|
|
1288
|
+
if (isAttemptToFix) testSpanMetadata[TEST_MANAGEMENT_IS_ATTEMPT_TO_FIX] = 'true'
|
|
1289
|
+
|
|
1128
1290
|
if (isDisabled) {
|
|
1129
1291
|
testSpanMetadata[TEST_MANAGEMENT_IS_DISABLED] = 'true'
|
|
1130
1292
|
}
|
|
@@ -1176,6 +1338,15 @@ class CypressPlugin {
|
|
|
1176
1338
|
}
|
|
1177
1339
|
|
|
1178
1340
|
async beforeRun (details) {
|
|
1341
|
+
this.retryConfigObserver?.stop()
|
|
1342
|
+
// Manual setup can change the developer budget after awaiting init. Capture it
|
|
1343
|
+
// before interactive reinitialization can restore the previous native value.
|
|
1344
|
+
const finalRetries = copyCypressRetries(details.config?.retries ?? this.cypressConfig?.retries)
|
|
1345
|
+
if (!this._isInit && !isDeepStrictEqual(finalRetries, this.configuredCypressRetries)) {
|
|
1346
|
+
this.originalCypressRetries = reconcileNativeRetries(
|
|
1347
|
+
this.originalCypressRetries, this.nativeCypressRetriesBaseline, this.configuredCypressRetries, finalRetries
|
|
1348
|
+
)
|
|
1349
|
+
}
|
|
1179
1350
|
if (this._isInit) {
|
|
1180
1351
|
// The user may not have returned the promise from the init function.
|
|
1181
1352
|
await this.libraryConfigurationPromise
|
|
@@ -1183,7 +1354,15 @@ class CypressPlugin {
|
|
|
1183
1354
|
// Cypress open reuses the same plugin process for every interactive run.
|
|
1184
1355
|
await this.init(this.tracer, this.cypressConfig)
|
|
1185
1356
|
}
|
|
1357
|
+
this.retryConfigObserver?.stop()
|
|
1358
|
+
|
|
1359
|
+
if (!isDeepStrictEqual(finalRetries, this.configuredCypressRetries)) {
|
|
1360
|
+
this.originalCypressRetries = reconcileNativeRetries(
|
|
1361
|
+
this.originalCypressRetries, this.nativeCypressRetriesBaseline, this.configuredCypressRetries, finalRetries
|
|
1362
|
+
)
|
|
1363
|
+
}
|
|
1186
1364
|
|
|
1365
|
+
this.resolvedCypressRetries = finalRetries
|
|
1187
1366
|
this.command = getCypressCommand(details)
|
|
1188
1367
|
this.frameworkVersion = getCypressVersion(details)
|
|
1189
1368
|
this.rootDir = getRootDir(details)
|
|
@@ -1271,7 +1450,7 @@ class CypressPlugin {
|
|
|
1271
1450
|
|
|
1272
1451
|
if (this.isImpactedTestsEnabled) {
|
|
1273
1452
|
try {
|
|
1274
|
-
this.modifiedFiles = getModifiedFiles(this.testEnvironmentMetadata)
|
|
1453
|
+
this.modifiedFiles = getModifiedFiles(this.testEnvironmentMetadata, this.repositoryRoot)
|
|
1275
1454
|
} catch (error) {
|
|
1276
1455
|
log.error(error)
|
|
1277
1456
|
this.isImpactedTestsEnabled = false
|
|
@@ -1560,13 +1739,21 @@ class CypressPlugin {
|
|
|
1560
1739
|
|
|
1561
1740
|
// Get tests that didn't go through `dd:afterEach`
|
|
1562
1741
|
// and create a skipped test span for each of them
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1742
|
+
const annotationOffsets = new Map()
|
|
1743
|
+
const matchedCypressTests = new Set()
|
|
1744
|
+
for (const cypressTest of cypressTests) {
|
|
1745
|
+
const cypressTestName = cypressTest.title.join(' ')
|
|
1746
|
+
const declarationIndex = annotationOffsets.get(cypressTestName) || 0
|
|
1747
|
+
const annotations = this.testAnnotationsBySuite.get(spec.relative)?.get(cypressTestName)?.[declarationIndex]
|
|
1748
|
+
annotationOffsets.set(cypressTestName, declarationIndex + 1)
|
|
1749
|
+
const isTestFinished = annotations?.testId
|
|
1750
|
+
? finishedTests.some(({ testId }) => testId === annotations.testId)
|
|
1751
|
+
: finishedTests.some(({ testName }) => cypressTestName === testName)
|
|
1566
1752
|
|
|
1567
1753
|
if (isTestFinished) {
|
|
1568
1754
|
continue
|
|
1569
1755
|
}
|
|
1756
|
+
matchedCypressTests.add(cypressTest)
|
|
1570
1757
|
|
|
1571
1758
|
const isSkippedByItr = this.testsToSkip.some(test =>
|
|
1572
1759
|
cypressTestName === test.name && spec.relative === test.suite
|
|
@@ -1577,7 +1764,7 @@ class CypressPlugin {
|
|
|
1577
1764
|
|
|
1578
1765
|
// Recovered tests that never ran have no execution time; keep them at the recorded suite end.
|
|
1579
1766
|
const skippedTestSpan = this.getTestSpan({
|
|
1580
|
-
testName: cypressTestName, testSuite: spec.relative, testSourceFile, startTime: finishTime,
|
|
1767
|
+
testName: cypressTestName, testSuite: spec.relative, testSourceFile, annotations, startTime: finishTime,
|
|
1581
1768
|
})
|
|
1582
1769
|
skippedTestSpan.setTag(TEST_FINAL_STATUS, 'skip')
|
|
1583
1770
|
|
|
@@ -1594,25 +1781,27 @@ class CypressPlugin {
|
|
|
1594
1781
|
|
|
1595
1782
|
if (isDisabled) {
|
|
1596
1783
|
skippedTestSpan.setTag(TEST_MANAGEMENT_IS_DISABLED, 'true')
|
|
1597
|
-
}
|
|
1784
|
+
}
|
|
1785
|
+
if (isQuarantined) {
|
|
1598
1786
|
skippedTestSpan.setTag(TEST_MANAGEMENT_IS_QUARANTINED, 'true')
|
|
1599
1787
|
}
|
|
1600
1788
|
|
|
1789
|
+
if (isAttemptToFix) skippedTestSpan.setTag(TEST_MANAGEMENT_IS_ATTEMPT_TO_FIX, 'true')
|
|
1601
1790
|
recordTestManagementExecution({
|
|
1602
1791
|
testSuite: spec.relative,
|
|
1603
1792
|
testName: cypressTestName,
|
|
1604
1793
|
status: 'skip',
|
|
1605
|
-
isAttemptToFix,
|
|
1606
|
-
isDisabled,
|
|
1607
|
-
isQuarantined,
|
|
1794
|
+
isAttemptToFix: isAttemptToFix && !annotations?.noAutoRetry,
|
|
1795
|
+
isDisabled: isDisabled && !annotations?.mustFail,
|
|
1796
|
+
isQuarantined: isQuarantined && !annotations?.mustFail,
|
|
1608
1797
|
})
|
|
1609
|
-
if (isAttemptToFix) {
|
|
1798
|
+
if (isAttemptToFix && !annotations?.noAutoRetry) {
|
|
1610
1799
|
recordAttemptToFixExecution(this.attemptToFixExecutions, {
|
|
1611
1800
|
testSuite: spec.relative,
|
|
1612
1801
|
testName: cypressTestName,
|
|
1613
1802
|
status: 'skip',
|
|
1614
|
-
isDisabled,
|
|
1615
|
-
isQuarantined,
|
|
1803
|
+
isDisabled: isDisabled && !annotations?.mustFail,
|
|
1804
|
+
isQuarantined: isQuarantined && !annotations?.mustFail,
|
|
1616
1805
|
})
|
|
1617
1806
|
}
|
|
1618
1807
|
|
|
@@ -1636,7 +1825,6 @@ class CypressPlugin {
|
|
|
1636
1825
|
finishedTestAttempts.push(finishedTest)
|
|
1637
1826
|
}
|
|
1638
1827
|
|
|
1639
|
-
const matchedCypressTests = new Set()
|
|
1640
1828
|
for (const finishedTestAttempts of finishedTestsByTest.values()) {
|
|
1641
1829
|
const { testName } = finishedTestAttempts[0]
|
|
1642
1830
|
// Cypress reports one result per original runnable, including Datadog-managed clones.
|
|
@@ -1664,7 +1852,9 @@ class CypressPlugin {
|
|
|
1664
1852
|
cypressTestStatus = CYPRESS_STATUS_TO_TEST_STATUS[cypressTest.attempts[attemptIndex].state]
|
|
1665
1853
|
const isAtrRetry = attemptIndex > 0 &&
|
|
1666
1854
|
this.isFlakyTestRetriesEnabled &&
|
|
1855
|
+
(this.isDynamicAtrEnabled || this.flakyTestRetriesCount > 0) &&
|
|
1667
1856
|
(!finishedTest.hasNativeRetries || this.isDynamicAtrEnabled) &&
|
|
1857
|
+
!finishedTest.noAutoRetry &&
|
|
1668
1858
|
!finishedTest.isAttemptToFix &&
|
|
1669
1859
|
!finishedTest.isEfdRetry
|
|
1670
1860
|
if (attemptIndex > 0) {
|
|
@@ -1700,7 +1890,8 @@ class CypressPlugin {
|
|
|
1700
1890
|
|
|
1701
1891
|
// Update test status - but NOT for non-ATF quarantined tests where we intentionally
|
|
1702
1892
|
// report 'fail' to Datadog even though Cypress sees it as 'pass'
|
|
1703
|
-
const isQuarantinedTest = finishedTest.
|
|
1893
|
+
const isQuarantinedTest = !finishedTest.mustFail &&
|
|
1894
|
+
finishedTest.testSpan?.context()?.getTag(TEST_MANAGEMENT_IS_QUARANTINED) === 'true'
|
|
1704
1895
|
if (cypressTestStatus !== finishedTest.testStatus && (!isQuarantinedTest || finishedTest.isAttemptToFix)) {
|
|
1705
1896
|
finishedTest.testSpan.setTag(TEST_STATUS, cypressTestStatus)
|
|
1706
1897
|
finishedTest.testSpan.setTag('error', latestError)
|
|
@@ -1714,8 +1905,8 @@ class CypressPlugin {
|
|
|
1714
1905
|
testName,
|
|
1715
1906
|
status: testManagementTags[TEST_STATUS] || cypressTestStatus,
|
|
1716
1907
|
isAttemptToFix: finishedTest.isAttemptToFix,
|
|
1717
|
-
isDisabled: testManagementTags[TEST_MANAGEMENT_IS_DISABLED] === 'true',
|
|
1718
|
-
isQuarantined: testManagementTags[TEST_MANAGEMENT_IS_QUARANTINED] === 'true',
|
|
1908
|
+
isDisabled: !finishedTest.mustFail && testManagementTags[TEST_MANAGEMENT_IS_DISABLED] === 'true',
|
|
1909
|
+
isQuarantined: !finishedTest.mustFail && testManagementTags[TEST_MANAGEMENT_IS_QUARANTINED] === 'true',
|
|
1719
1910
|
})
|
|
1720
1911
|
if (this.itrCorrelationId) {
|
|
1721
1912
|
finishedTest.testSpan.setTag(ITR_CORRELATION_ID, this.itrCorrelationId)
|
|
@@ -1762,13 +1953,24 @@ class CypressPlugin {
|
|
|
1762
1953
|
const isQuarantined = testSpanTags[TEST_MANAGEMENT_IS_QUARANTINED] === 'true'
|
|
1763
1954
|
const isDisabled = testSpanTags[TEST_MANAGEMENT_IS_DISABLED] === 'true'
|
|
1764
1955
|
|
|
1956
|
+
// Explicit experimental strategies can fail after a passing attempt. Their native
|
|
1957
|
+
// aggregate outcome remains authoritative when ATR supplies the retry budget.
|
|
1958
|
+
const hasNativeExperimentalRetries = typeof finishedTest.hasNativeExperimentalRetries === 'boolean'
|
|
1959
|
+
? finishedTest.hasNativeExperimentalRetries
|
|
1960
|
+
: Boolean(this.resolvedCypressRetries?.experimentalStrategy)
|
|
1961
|
+
const finalRetryKind = hasNativeExperimentalRetries && !isDatadogManagedAttempt
|
|
1962
|
+
? FINAL_STATUS_RETRY_KIND.none
|
|
1963
|
+
: retryKind
|
|
1765
1964
|
const finalStatus = getFinalStatus({
|
|
1766
|
-
|
|
1767
|
-
|
|
1965
|
+
// Native retries use Cypress's aggregate outcome; managed attempts retain their own policy.
|
|
1966
|
+
status: finalRetryKind === FINAL_STATUS_RETRY_KIND.none && !isDatadogManagedAttempt
|
|
1967
|
+
? CYPRESS_STATUS_TO_TEST_STATUS[isCypressHookFailure(cypressTest) ? 'failed' : cypressTest.state]
|
|
1968
|
+
: cypressTestStatus,
|
|
1969
|
+
retryKind: finalRetryKind,
|
|
1768
1970
|
hasFailedAllAttempts,
|
|
1769
1971
|
hasPassedAllAtfRetries,
|
|
1770
|
-
isQuarantined,
|
|
1771
|
-
isDisabled,
|
|
1972
|
+
isQuarantined: isQuarantined && !finishedTest.mustFail,
|
|
1973
|
+
isDisabled: isDisabled && !finishedTest.mustFail,
|
|
1772
1974
|
})
|
|
1773
1975
|
|
|
1774
1976
|
if (finalStatus) {
|
|
@@ -2045,9 +2247,29 @@ class CypressPlugin {
|
|
|
2045
2247
|
if (finishPromises.length > 0) return Promise.all(finishPromises).then(() => null)
|
|
2046
2248
|
}
|
|
2047
2249
|
|
|
2250
|
+
/**
|
|
2251
|
+
* @param {string} testSuite Suite path shared with Cypress results.
|
|
2252
|
+
* @param {object[]} testAnnotations Declaration metadata from the browser.
|
|
2253
|
+
*/
|
|
2254
|
+
recordTestDeclarations (testSuite, testAnnotations) {
|
|
2255
|
+
const declarationsByName = new Map()
|
|
2256
|
+
for (const annotation of testAnnotations) {
|
|
2257
|
+
if (!declarationsByName.has(annotation.testName)) declarationsByName.set(annotation.testName, [])
|
|
2258
|
+
declarationsByName.get(annotation.testName).push(annotation)
|
|
2259
|
+
}
|
|
2260
|
+
this.testAnnotationsBySuite.set(testSuite, declarationsByName)
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2048
2263
|
getTasks () {
|
|
2049
2264
|
return {
|
|
2050
|
-
'dd:
|
|
2265
|
+
'dd:testDeclarations': ({ testSuite, testAnnotations }) => {
|
|
2266
|
+
this.recordTestDeclarations(testSuite, testAnnotations)
|
|
2267
|
+
return null
|
|
2268
|
+
},
|
|
2269
|
+
'dd:testSuiteStart': ({
|
|
2270
|
+
testSuite, testSuiteAbsolutePath, isTextTerminal: browserIsTextTerminal, testAnnotations = [],
|
|
2271
|
+
}) => {
|
|
2272
|
+
this.recordTestDeclarations(testSuite, testAnnotations)
|
|
2051
2273
|
// Cypress 6 omits the execution mode from the Node plugin configuration.
|
|
2052
2274
|
const isTextTerminal = this.cypressConfig.isTextTerminal ?? browserIsTextTerminal
|
|
2053
2275
|
if (!isTextTerminal) {
|
|
@@ -2055,9 +2277,19 @@ class CypressPlugin {
|
|
|
2055
2277
|
this.isDynamicAtrEnabled = false
|
|
2056
2278
|
this.flakyTestRetriesCount = 0
|
|
2057
2279
|
}
|
|
2280
|
+
let frameworkRetries = this.originalCypressRetries
|
|
2281
|
+
if (typeof frameworkRetries !== 'number') {
|
|
2282
|
+
const configured = this.originalCypressRetries?.[isTextTerminal ? 'runMode' : 'openMode']
|
|
2283
|
+
frameworkRetries = configured === true
|
|
2284
|
+
? this.originalCypressRetries.experimentalOptions?.maxRetries ?? 0
|
|
2285
|
+
: configured || 0
|
|
2286
|
+
}
|
|
2058
2287
|
const suitePayload = {
|
|
2059
2288
|
isEarlyFlakeDetectionEnabled:
|
|
2060
2289
|
this.isEarlyFlakeDetectionEnabled && hasEfdRetries(this.earlyFlakeDetectionRetryPolicy),
|
|
2290
|
+
frameworkRetries,
|
|
2291
|
+
configuredRetries: this.configuredCypressRetries,
|
|
2292
|
+
originalRetries: this.originalCypressRetries,
|
|
2061
2293
|
knownTestsForSuite: this.knownTestsByTestSuite?.[testSuite] || [],
|
|
2062
2294
|
earlyFlakeDetectionSchedulingRetryCount: this.earlyFlakeDetectionRetryPolicy.schedulingRetryCount,
|
|
2063
2295
|
isKnownTestsEnabled: this.isKnownTestsEnabled,
|
|
@@ -2080,7 +2312,7 @@ class CypressPlugin {
|
|
|
2080
2312
|
},
|
|
2081
2313
|
'dd:beforeEach': (test) => {
|
|
2082
2314
|
this.hasTestsReported = true
|
|
2083
|
-
const { testId, testName, testSuite, isEfdRetry, efdRetryIndex } = test
|
|
2315
|
+
const { testId, testName, testSuite, isEfdRetry, efdRetryIndex, annotations } = test
|
|
2084
2316
|
if (isEfdRetry && this.shouldSkipEfdRetry(testSuite, testName, efdRetryIndex)) {
|
|
2085
2317
|
return { shouldSkip: true, shouldDiscard: true }
|
|
2086
2318
|
}
|
|
@@ -2111,12 +2343,12 @@ class CypressPlugin {
|
|
|
2111
2343
|
return { shouldSkip: true }
|
|
2112
2344
|
}
|
|
2113
2345
|
|
|
2114
|
-
if (isAttemptToFix) {
|
|
2346
|
+
if (isAttemptToFix && !annotations?.noAutoRetry) {
|
|
2115
2347
|
logAttemptToFixTestExecution(testSuite, testName, this.loggedAttemptToFixTests)
|
|
2116
2348
|
}
|
|
2117
2349
|
|
|
2118
2350
|
// For disabled tests (not attemptToFix), skip them
|
|
2119
|
-
if (!isAttemptToFix && isDisabled) {
|
|
2351
|
+
if ((!isAttemptToFix || annotations?.noAutoRetry) && isDisabled && !annotations?.mustFail) {
|
|
2120
2352
|
return { shouldSkip: true }
|
|
2121
2353
|
}
|
|
2122
2354
|
// Quarantined tests (not attemptToFix) run normally but their failures are caught
|
|
@@ -2130,6 +2362,8 @@ class CypressPlugin {
|
|
|
2130
2362
|
isForcedToRun,
|
|
2131
2363
|
isDisabled,
|
|
2132
2364
|
isQuarantined,
|
|
2365
|
+
isAttemptToFix,
|
|
2366
|
+
annotations,
|
|
2133
2367
|
})
|
|
2134
2368
|
}
|
|
2135
2369
|
|
|
@@ -2154,8 +2388,11 @@ class CypressPlugin {
|
|
|
2154
2388
|
isNew,
|
|
2155
2389
|
isEfdRetry,
|
|
2156
2390
|
isAttemptToFix,
|
|
2391
|
+
annotations,
|
|
2157
2392
|
isModified,
|
|
2158
2393
|
hasNativeRetries,
|
|
2394
|
+
hasNativeExperimentalRetries,
|
|
2395
|
+
nativeRetryFloor,
|
|
2159
2396
|
duration,
|
|
2160
2397
|
isQuarantined: isQuarantinedFromSupport,
|
|
2161
2398
|
isDisabled: isDisabledFromSupport,
|
|
@@ -2185,7 +2422,7 @@ class CypressPlugin {
|
|
|
2185
2422
|
}
|
|
2186
2423
|
this.tracer._tracer._exporter.exportCoverage(formattedCoverage)
|
|
2187
2424
|
}
|
|
2188
|
-
const isEfdManagedTest = (isNew || isModified) &&
|
|
2425
|
+
const isEfdManagedTest = !annotations?.noAutoRetry && (isNew || isModified) &&
|
|
2189
2426
|
this.isEarlyFlakeDetectionEnabled &&
|
|
2190
2427
|
hasEfdRetries(this.earlyFlakeDetectionRetryPolicy) &&
|
|
2191
2428
|
!isAttemptToFix
|
|
@@ -2200,6 +2437,7 @@ class CypressPlugin {
|
|
|
2200
2437
|
}
|
|
2201
2438
|
// Dynamic ATR: after the first attempt, compute the duration-based retry budget.
|
|
2202
2439
|
if (
|
|
2440
|
+
!annotations?.noAutoRetry &&
|
|
2203
2441
|
this.isDynamicAtrEnabled &&
|
|
2204
2442
|
this.isFlakyTestRetriesEnabled &&
|
|
2205
2443
|
!isAttemptToFix &&
|
|
@@ -2207,7 +2445,7 @@ class CypressPlugin {
|
|
|
2207
2445
|
!isEfdManagedTest &&
|
|
2208
2446
|
this.getDynamicAtrRetryCountForTest(testSuite, testId) === undefined
|
|
2209
2447
|
) {
|
|
2210
|
-
this.setDynamicAtrRetryCountForTest(testSuite, testId, duration)
|
|
2448
|
+
this.setDynamicAtrRetryCountForTest(testSuite, testId, duration, nativeRetryFloor)
|
|
2211
2449
|
}
|
|
2212
2450
|
if (didAbortSlowEfdRetries && testStatus === 'skip' && !error && duration > 0) {
|
|
2213
2451
|
testStatus = 'pass'
|
|
@@ -2300,14 +2538,14 @@ class CypressPlugin {
|
|
|
2300
2538
|
testSuite,
|
|
2301
2539
|
testName,
|
|
2302
2540
|
status: testStatus,
|
|
2303
|
-
isDisabled: activeSpanTags[TEST_MANAGEMENT_IS_DISABLED] === 'true',
|
|
2304
|
-
isQuarantined: activeSpanTags[TEST_MANAGEMENT_IS_QUARANTINED] === 'true',
|
|
2541
|
+
isDisabled: !annotations?.mustFail && activeSpanTags[TEST_MANAGEMENT_IS_DISABLED] === 'true',
|
|
2542
|
+
isQuarantined: !annotations?.mustFail && activeSpanTags[TEST_MANAGEMENT_IS_QUARANTINED] === 'true',
|
|
2305
2543
|
})
|
|
2306
2544
|
}
|
|
2307
2545
|
// ATR: set TEST_HAS_FAILED_ALL_RETRIES when all auto test retries were exhausted and every attempt failed
|
|
2308
2546
|
const dynamicAtrRetryCount = this.getDynamicAtrRetryCountForTest(testSuite, testId)
|
|
2309
2547
|
const atrRetryCount = this.isDynamicAtrEnabled ? dynamicAtrRetryCount : this.flakyTestRetriesCount
|
|
2310
|
-
if (this.isFlakyTestRetriesEnabled && !isAttemptToFix && !isEfdRetry &&
|
|
2548
|
+
if (!annotations?.noAutoRetry && this.isFlakyTestRetriesEnabled && !isAttemptToFix && !isEfdRetry &&
|
|
2311
2549
|
atrRetryCount > 0 && testStatuses.length === atrRetryCount + 1 &&
|
|
2312
2550
|
testStatuses.every(status => status === 'fail')) {
|
|
2313
2551
|
this.activeTestSpan.setTag(TEST_HAS_FAILED_ALL_RETRIES, 'true')
|
|
@@ -2357,6 +2595,9 @@ class CypressPlugin {
|
|
|
2357
2595
|
isEfdManagedTest,
|
|
2358
2596
|
isAttemptToFix,
|
|
2359
2597
|
hasNativeRetries,
|
|
2598
|
+
hasNativeExperimentalRetries,
|
|
2599
|
+
mustFail: annotations?.mustFail,
|
|
2600
|
+
noAutoRetry: annotations?.noAutoRetry,
|
|
2360
2601
|
}
|
|
2361
2602
|
if (this.finishedTestsByFile[testSuite]) {
|
|
2362
2603
|
this.finishedTestsByFile[testSuite].push(finishedTest)
|