dd-trace 6.15.0 → 6.17.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/README.md +15 -0
- package/ci/diagnose.js +0 -23
- package/ci/test-optimization-validation/approval-artifacts.js +0 -3
- package/ci/test-optimization-validation/approval.js +0 -6
- package/ci/test-optimization-validation/artifact-id.js +0 -1
- package/ci/test-optimization-validation/bounded-json.js +0 -1
- package/ci/test-optimization-validation/cli.js +0 -12
- package/ci/test-optimization-validation/command-output-policy.js +0 -1
- package/ci/test-optimization-validation/command-runner.js +0 -3
- package/ci/test-optimization-validation/environment.js +0 -4
- package/ci/test-optimization-validation/executable-approval.js +0 -1
- package/ci/test-optimization-validation/executable.js +0 -5
- package/ci/test-optimization-validation/framework-adapters/cucumber.js +4 -8
- package/ci/test-optimization-validation/framework-adapters/cypress.js +0 -3
- package/ci/test-optimization-validation/framework-adapters/playwright.js +0 -6
- package/ci/test-optimization-validation/framework-adapters/vitest.js +0 -4
- package/ci/test-optimization-validation/generated-test-contract.js +0 -5
- package/ci/test-optimization-validation/generated-verifier.js +0 -1
- package/ci/test-optimization-validation/literal-environment.js +0 -1
- package/ci/test-optimization-validation/manifest-scaffold.js +0 -17
- package/ci/test-optimization-validation/manifest-schema.js +0 -21
- package/ci/test-optimization-validation/offline-fixtures.js +0 -4
- package/ci/test-optimization-validation/package-check.js +4 -1
- package/ci/test-optimization-validation/plan-writer.js +0 -11
- package/ci/test-optimization-validation/preflight-runner.js +0 -1
- package/ci/test-optimization-validation/redaction.js +0 -4
- package/ci/test-optimization-validation/report-writer.js +0 -16
- package/ci/test-optimization-validation/runner-command.js +0 -3
- package/ci/test-optimization-validation/runner-contract.js +0 -4
- package/ci/test-optimization-validation/safe-files.js +0 -1
- package/ci/test-optimization-validation/scenarios/basic-reporting.js +0 -1
- package/ci/test-optimization-validation/scenarios/ci-wiring.js +1 -2
- package/ci/test-optimization-validation/source-text.js +0 -3
- package/ci/vitest-no-worker-init-setup.mjs +41 -16
- package/index.d.ts +169 -0
- package/next.d.ts +27 -0
- package/next.js +3 -0
- package/package.json +28 -23
- package/packages/datadog-esbuild/index.js +14 -1
- package/packages/datadog-esbuild/src/resolver.js +284 -0
- package/packages/datadog-esbuild/src/utils.js +162 -120
- package/packages/datadog-instrumentations/src/aerospike.js +28 -6
- package/packages/datadog-instrumentations/src/ai.js +39 -97
- package/packages/datadog-instrumentations/src/anthropic.js +76 -134
- package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js.js +1 -3
- package/packages/datadog-instrumentations/src/aws-sdk.js +0 -2
- package/packages/datadog-instrumentations/src/azure-cosmos.js +1 -1
- package/packages/datadog-instrumentations/src/azure-durable-functions.js +23 -9
- package/packages/datadog-instrumentations/src/azure-functions.js +48 -0
- package/packages/datadog-instrumentations/src/bullmq.js +1 -1
- package/packages/datadog-instrumentations/src/claude-agent-sdk.js +1 -3
- package/packages/datadog-instrumentations/src/console.js +97 -0
- package/packages/datadog-instrumentations/src/cucumber.js +72 -12
- package/packages/datadog-instrumentations/src/cypress-config.js +0 -23
- package/packages/datadog-instrumentations/src/dd-trace-api.js +2 -2
- package/packages/datadog-instrumentations/src/graphql.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/bundler-register.js +39 -14
- package/packages/datadog-instrumentations/src/helpers/channel.js +0 -2
- package/packages/datadog-instrumentations/src/helpers/graphql-jit-runtime.js +0 -5
- package/packages/datadog-instrumentations/src/helpers/hooks.js +8 -0
- package/packages/datadog-instrumentations/src/helpers/instrument.js +25 -8
- package/packages/datadog-instrumentations/src/helpers/instrumentation-utils.js +69 -0
- package/packages/datadog-instrumentations/src/helpers/pool-acquire.js +0 -6
- package/packages/datadog-instrumentations/src/helpers/register.js +13 -64
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +109 -29
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +39 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/azure-durable-functions.js +17 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +3 -16
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/playwright.js +12 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/postgres.js +36 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/supabase.js +128 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/webdriverio.js +6 -7
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +17 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms/postgres.js +388 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +99 -75
- package/packages/datadog-instrumentations/src/helpers/router-helper.js +0 -1
- package/packages/datadog-instrumentations/src/jest.js +141 -51
- package/packages/datadog-instrumentations/src/knex.js +0 -1
- package/packages/datadog-instrumentations/src/langchain.js +1 -1
- package/packages/datadog-instrumentations/src/langgraph.js +1 -1
- package/packages/datadog-instrumentations/src/mariadb-bundle.js +0 -24
- package/packages/datadog-instrumentations/src/mariadb.js +0 -2
- package/packages/datadog-instrumentations/src/mercurius.js +1 -1
- package/packages/datadog-instrumentations/src/mocha/common.js +0 -1
- package/packages/datadog-instrumentations/src/mocha/main.js +22 -25
- package/packages/datadog-instrumentations/src/mocha/utils.js +119 -49
- package/packages/datadog-instrumentations/src/mocha/webdriverio-protocol.js +0 -6
- package/packages/datadog-instrumentations/src/mocha/worker.js +14 -17
- package/packages/datadog-instrumentations/src/modelcontextprotocol-sdk.js +1 -1
- package/packages/datadog-instrumentations/src/mysql2.js +0 -2
- package/packages/datadog-instrumentations/src/openai-agents.js +1 -1
- package/packages/datadog-instrumentations/src/openai-realtime/audio-accumulator.js +241 -0
- package/packages/datadog-instrumentations/src/openai-realtime/events.js +76 -0
- package/packages/datadog-instrumentations/src/openai-realtime/index.js +301 -0
- package/packages/datadog-instrumentations/src/openai-realtime/session.js +998 -0
- package/packages/datadog-instrumentations/src/openai-realtime/turns.js +211 -0
- package/packages/datadog-instrumentations/src/openai.js +97 -80
- package/packages/datadog-instrumentations/src/oracledb.js +9 -3
- package/packages/datadog-instrumentations/src/playwright-reporter.js +3 -16
- package/packages/datadog-instrumentations/src/playwright.js +238 -55
- package/packages/datadog-instrumentations/src/postgres.js +7 -0
- package/packages/datadog-instrumentations/src/router.js +0 -2
- package/packages/datadog-instrumentations/src/rum-browser-scripts.js +0 -2
- package/packages/datadog-instrumentations/src/sequelize.js +0 -1
- package/packages/datadog-instrumentations/src/supabase.js +15 -0
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +18 -18
- package/packages/datadog-instrumentations/src/vitest-main.js +37 -17
- package/packages/datadog-instrumentations/src/vitest-util.js +7 -1
- package/packages/datadog-instrumentations/src/vitest-worker.js +56 -23
- package/packages/datadog-instrumentations/src/webdriverio.js +23 -42
- package/packages/datadog-instrumentations/src/ws.js +0 -1
- package/packages/datadog-plugin-ai/src/utils.js +0 -2
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/trace-checkpoint.js +0 -1
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/util.js +0 -2
- package/packages/datadog-plugin-aws-sdk/src/base.js +0 -1
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +7 -2
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +0 -1
- package/packages/datadog-plugin-aws-sdk/src/util.js +0 -1
- package/packages/datadog-plugin-azure-cosmos/src/index.js +1 -1
- package/packages/datadog-plugin-azure-durable-functions/src/index.js +95 -1
- package/packages/datadog-plugin-cucumber/src/index.js +10 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +171 -75
- package/packages/datadog-plugin-cypress/src/finalization.js +0 -3
- package/packages/datadog-plugin-cypress/src/source-map-utils.js +0 -4
- package/packages/datadog-plugin-cypress/src/support.js +52 -7
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +2 -24
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +2 -36
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-request-context.js +31 -0
- package/packages/datadog-plugin-graphql/src/resolve-error.js +32 -11
- package/packages/datadog-plugin-graphql/src/utils.js +0 -5
- package/packages/datadog-plugin-jest/src/index.js +13 -0
- package/packages/datadog-plugin-kafkajs/src/producer.js +0 -1
- package/packages/datadog-plugin-mocha/src/index.js +39 -11
- package/packages/datadog-plugin-mongodb-core/src/query.js +0 -1
- package/packages/datadog-plugin-openai/src/index.js +16 -1
- package/packages/datadog-plugin-openai/src/realtime.js +144 -0
- package/packages/datadog-plugin-openai-agents/src/integration.js +0 -4
- package/packages/datadog-plugin-openai-agents/src/util.js +0 -1
- package/packages/datadog-plugin-playwright/src/index.js +76 -9
- package/packages/datadog-plugin-postgres/src/index.js +167 -0
- package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +0 -1
- package/packages/datadog-plugin-redis/src/index.js +15 -1
- package/packages/datadog-plugin-supabase/src/error.js +18 -0
- package/packages/datadog-plugin-supabase/src/index.js +21 -0
- package/packages/datadog-plugin-supabase/src/supabase-auth-js-gotrueclient-getuser.js +69 -0
- package/packages/datadog-plugin-supabase/src/supabase-functions-js-functionsclient-invoke.js +70 -0
- package/packages/datadog-plugin-supabase/src/supabase-postgrest-js-postgrestbuilder-then.js +122 -0
- package/packages/datadog-plugin-supabase/src/supabase-realtime-js-realtimechannel-send.js +66 -0
- package/packages/datadog-plugin-supabase/src/supabase-storage-js-handle-request.js +93 -0
- package/packages/datadog-plugin-supabase/src/url.js +17 -0
- package/packages/datadog-plugin-vitest/src/index.js +10 -0
- package/packages/datadog-plugin-ws/src/util.js +0 -4
- package/packages/datadog-turbopack/index.js +206 -0
- package/packages/datadog-turbopack/src/constants.js +5 -0
- package/packages/datadog-turbopack/src/loader.js +484 -0
- package/packages/datadog-webpack/src/loader.js +0 -1
- package/packages/dd-trace/src/aiguard/client.js +2 -3
- package/packages/dd-trace/src/aiguard/evaluation.js +6 -12
- package/packages/dd-trace/src/aiguard/index.js +3 -2
- package/packages/dd-trace/src/aiguard/integrations/anthropic.js +53 -25
- package/packages/dd-trace/src/aiguard/integrations/evaluate.js +49 -25
- package/packages/dd-trace/src/aiguard/integrations/index.js +4 -3
- package/packages/dd-trace/src/aiguard/integrations/openai.js +132 -29
- package/packages/dd-trace/src/aiguard/integrations/vercel-ai.js +116 -42
- package/packages/dd-trace/src/aiguard/messages/anthropic.js +0 -2
- package/packages/dd-trace/src/aiguard/messages/openai.js +64 -1
- package/packages/dd-trace/src/aiguard/messages/utils.js +29 -2
- package/packages/dd-trace/src/aiguard/messages/vercel-ai.js +25 -0
- package/packages/dd-trace/src/aiguard/redaction.js +0 -1
- package/packages/dd-trace/src/aiguard/sdk.js +1 -1
- package/packages/dd-trace/src/appsec/activation.js +1 -1
- package/packages/dd-trace/src/appsec/api_security/normalized-route.js +0 -5
- package/packages/dd-trace/src/appsec/api_security/sampler.js +0 -4
- package/packages/dd-trace/src/appsec/blocking/index.js +3 -3
- package/packages/dd-trace/src/appsec/downstream_requests.js +1 -4
- package/packages/dd-trace/src/appsec/iast/index.js +1 -1
- package/packages/dd-trace/src/appsec/iast/overhead-controller.js +5 -5
- package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +3 -3
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +8 -10
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/url-sensitive-analyzer.js +2 -2
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +2 -2
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +4 -1
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +7 -7
- package/packages/dd-trace/src/appsec/index.js +2 -2
- package/packages/dd-trace/src/appsec/lambda.js +71 -2
- package/packages/dd-trace/src/appsec/rasp/utils.js +5 -1
- package/packages/dd-trace/src/appsec/remote_config.js +8 -6
- package/packages/dd-trace/src/appsec/reporter.js +10 -6
- package/packages/dd-trace/src/appsec/rule_manager.js +3 -3
- package/packages/dd-trace/src/appsec/sdk/track_event.js +0 -2
- package/packages/dd-trace/src/appsec/telemetry/api_security.js +1 -3
- package/packages/dd-trace/src/appsec/telemetry/common.js +4 -0
- package/packages/dd-trace/src/appsec/telemetry/index.js +23 -5
- package/packages/dd-trace/src/appsec/telemetry/rasp.js +1 -20
- package/packages/dd-trace/src/appsec/telemetry/user.js +1 -3
- package/packages/dd-trace/src/appsec/telemetry/waf.js +1 -20
- package/packages/dd-trace/src/appsec/waf/index.js +2 -2
- package/packages/dd-trace/src/appsec/waf/waf_manager.js +8 -5
- package/packages/dd-trace/src/carrier.js +0 -5
- package/packages/dd-trace/src/ci-visibility/dynamic-atr-retries.js +104 -0
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +0 -2
- package/packages/dd-trace/src/ci-visibility/efd-retry-policy.js +34 -3
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/index.js +0 -4
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/msgpack-to-json.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/sink.js +0 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +37 -15
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +0 -3
- package/packages/dd-trace/src/ci-visibility/exporters/request.js +0 -11
- package/packages/dd-trace/src/ci-visibility/exporters/settings-cache-key.js +0 -1
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +0 -1
- package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +0 -6
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +2 -2
- package/packages/dd-trace/src/ci-visibility/requests/rate-limit.js +0 -1
- package/packages/dd-trace/src/ci-visibility/requests/upload-test-screenshot.js +0 -5
- package/packages/dd-trace/src/ci-visibility/requests/video-request.js +0 -1
- package/packages/dd-trace/src/ci-visibility/telemetry.js +13 -0
- package/packages/dd-trace/src/ci-visibility/test-optimization-cache.js +0 -1
- package/packages/dd-trace/src/ci-visibility/test-screenshot.js +0 -2
- package/packages/dd-trace/src/ci-visibility/test-video.js +0 -1
- package/packages/dd-trace/src/config/defaults.js +3 -2
- package/packages/dd-trace/src/config/generated-config-types.d.ts +74 -66
- package/packages/dd-trace/src/config/helper.js +9 -2
- package/packages/dd-trace/src/config/index.js +44 -29
- package/packages/dd-trace/src/config/parsers.js +34 -6
- package/packages/dd-trace/src/config/remote_config.js +25 -109
- package/packages/dd-trace/src/config/supported-configurations.json +146 -9
- package/packages/dd-trace/src/datastreams/encoding.js +0 -1
- package/packages/dd-trace/src/datastreams/pathway.js +0 -1
- package/packages/dd-trace/src/debugger/constants.js +10 -0
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +76 -17
- package/packages/dd-trace/src/debugger/devtools_client/config.js +2 -0
- package/packages/dd-trace/src/debugger/devtools_client/guardrail-metrics.js +15 -0
- package/packages/dd-trace/src/debugger/devtools_client/index.js +103 -27
- package/packages/dd-trace/src/debugger/devtools_client/json-buffer.js +50 -7
- package/packages/dd-trace/src/debugger/devtools_client/log.js +3 -1
- package/packages/dd-trace/src/debugger/devtools_client/probe_sampler.js +34 -8
- package/packages/dd-trace/src/debugger/devtools_client/send.js +40 -14
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +53 -13
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +118 -71
- package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +0 -3
- package/packages/dd-trace/src/debugger/devtools_client/status.js +20 -6
- package/packages/dd-trace/src/debugger/guardrail-metrics.js +167 -0
- package/packages/dd-trace/src/debugger/index.js +50 -2
- package/packages/dd-trace/src/debugger/inspect-segment.js +0 -3
- package/packages/dd-trace/src/debugger/probe_sampler.js +133 -9
- package/packages/dd-trace/src/debugger/probe_sampler_constants.js +31 -1
- package/packages/dd-trace/src/dogstatsd.js +0 -23
- package/packages/dd-trace/src/encode/0.4-cross-payload.js +0 -3
- package/packages/dd-trace/src/encode/0.4.js +0 -7
- package/packages/dd-trace/src/encode/0.5.js +0 -2
- package/packages/dd-trace/src/encode/tags-processors.js +0 -1
- package/packages/dd-trace/src/evp_proxy/discovery.js +3 -5
- package/packages/dd-trace/src/evp_proxy/path.js +11 -4
- package/packages/dd-trace/src/exporters/agent/writer.js +0 -1
- package/packages/dd-trace/src/exporters/agentless/index.js +0 -1
- package/packages/dd-trace/src/exporters/agentless/intake.js +0 -1
- package/packages/dd-trace/src/exporters/agentless/writer.js +0 -3
- package/packages/dd-trace/src/exporters/common/docker.js +4 -1
- package/packages/dd-trace/src/exporters/common/final-flush-request-tracker.js +0 -6
- package/packages/dd-trace/src/exporters/common/proxy.js +3 -0
- package/packages/dd-trace/src/exporters/common/request.js +1 -0
- package/packages/dd-trace/src/exporters/common/url.js +0 -2
- package/packages/dd-trace/src/exporters/common/writer.js +0 -2
- package/packages/dd-trace/src/id.js +0 -11
- package/packages/dd-trace/src/llmobs/audio-codec.js +192 -0
- package/packages/dd-trace/src/llmobs/audio-utils.js +121 -0
- package/packages/dd-trace/src/llmobs/constants/audio.js +35 -0
- package/packages/dd-trace/src/llmobs/constants/prompts.js +14 -0
- package/packages/dd-trace/src/llmobs/constants/tags.js +17 -0
- package/packages/dd-trace/src/llmobs/eval-metric.js +0 -6
- package/packages/dd-trace/src/llmobs/experiments/dataset.js +0 -4
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +0 -3
- package/packages/dd-trace/src/llmobs/experiments/index.js +7 -6
- package/packages/dd-trace/src/llmobs/experiments/util.js +1 -11
- package/packages/dd-trace/src/llmobs/index.js +1 -3
- package/packages/dd-trace/src/llmobs/noop.js +10 -0
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +0 -4
- package/packages/dd-trace/src/llmobs/plugins/anthropic/util.js +0 -1
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +0 -4
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/utils.js +0 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/constants.js +0 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/index.js +4 -6
- package/packages/dd-trace/src/llmobs/plugins/openai/realtime.js +285 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +16 -3
- package/packages/dd-trace/src/llmobs/prompts/cache.js +272 -0
- package/packages/dd-trace/src/llmobs/prompts/manager.js +639 -0
- package/packages/dd-trace/src/llmobs/prompts/noop.js +29 -0
- package/packages/dd-trace/src/llmobs/prompts/prompt.js +92 -0
- package/packages/dd-trace/src/llmobs/sdk.js +21 -6
- package/packages/dd-trace/src/llmobs/span_processor.js +81 -2
- package/packages/dd-trace/src/llmobs/tagger.js +30 -7
- package/packages/dd-trace/src/llmobs/telemetry.js +36 -4
- package/packages/dd-trace/src/llmobs/util.js +0 -34
- package/packages/dd-trace/src/llmobs/writers/base.js +0 -1
- package/packages/dd-trace/src/llmobs/writers/util.js +1 -2
- package/packages/dd-trace/src/log/channels.js +3 -0
- package/packages/dd-trace/src/log/index.js +23 -5
- package/packages/dd-trace/src/log-submission/log-submission-plugin.js +74 -6
- package/packages/dd-trace/src/msgpack/chunk.js +0 -1
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +0 -12
- package/packages/dd-trace/src/openfeature/encoding.js +0 -2
- package/packages/dd-trace/src/openfeature/eval-metrics-hook.js +0 -1
- package/packages/dd-trace/src/openfeature/index.js +0 -4
- package/packages/dd-trace/src/openfeature/span-enrichment-hook.js +0 -1
- package/packages/dd-trace/src/openfeature/span-enrichment.js +0 -4
- package/packages/dd-trace/src/openfeature/writers/base.js +0 -6
- package/packages/dd-trace/src/openfeature/writers/exposures.js +0 -5
- package/packages/dd-trace/src/openfeature/writers/util.js +0 -4
- package/packages/dd-trace/src/opentelemetry/logs/logger.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +0 -2
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/meter_provider.js +4 -4
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_transformer.js +0 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_transformer.js +0 -1
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +103 -35
- package/packages/dd-trace/src/opentelemetry/metrics/time.js +0 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +36 -13
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +0 -1
- package/packages/dd-trace/src/opentelemetry/span-helpers.js +0 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +0 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +0 -3
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +0 -6
- package/packages/dd-trace/src/opentracing/span_context.js +0 -1
- package/packages/dd-trace/src/otel-thread-ctx.js +38 -11
- package/packages/dd-trace/src/payload-tagging/tagging.js +15 -3
- package/packages/dd-trace/src/plugin_manager.js +9 -3
- package/packages/dd-trace/src/plugins/ci_plugin.js +0 -1
- package/packages/dd-trace/src/plugins/database.js +2 -6
- package/packages/dd-trace/src/plugins/index.js +8 -0
- package/packages/dd-trace/src/plugins/plugin.js +0 -4
- package/packages/dd-trace/src/plugins/tracing.js +1 -1
- package/packages/dd-trace/src/plugins/util/git.js +1 -3
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +0 -1
- package/packages/dd-trace/src/plugins/util/llm.js +0 -2
- package/packages/dd-trace/src/plugins/util/status-validator.js +0 -1
- package/packages/dd-trace/src/plugins/util/test.js +25 -21
- package/packages/dd-trace/src/plugins/util/url.js +0 -5
- package/packages/dd-trace/src/priority_sampler.js +0 -6
- package/packages/dd-trace/src/process-tags/index.js +0 -1
- package/packages/dd-trace/src/profiler.js +132 -35
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +0 -1
- package/packages/dd-trace/src/profiling/profiler.js +101 -41
- package/packages/dd-trace/src/profiling/ssi-heuristics.js +29 -15
- package/packages/dd-trace/src/propagation-hash/index.js +0 -1
- package/packages/dd-trace/src/proxy.js +21 -45
- package/packages/dd-trace/src/random_sampler.js +0 -4
- package/packages/dd-trace/src/rate_limiter.js +0 -4
- package/packages/dd-trace/src/remote_config/capabilities.js +1 -9
- package/packages/dd-trace/src/remote_config/index.js +0 -1
- package/packages/dd-trace/src/runtime_metrics/otlp_runtime_metrics.js +0 -3
- package/packages/dd-trace/src/sampler.js +0 -4
- package/packages/dd-trace/src/sampling_rule.js +0 -7
- package/packages/dd-trace/src/serverless/vercel.js +0 -1
- package/packages/dd-trace/src/serverless.js +0 -1
- package/packages/dd-trace/src/service-naming/index.js +0 -1
- package/packages/dd-trace/src/service-naming/schemas/util.js +0 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +7 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +5 -0
- package/packages/dd-trace/src/span_processor.js +2 -2
- package/packages/dd-trace/src/span_sampler.js +0 -1
- package/packages/dd-trace/src/standalone/product.js +2 -2
- package/packages/dd-trace/src/standalone/tracesource.js +0 -1
- package/packages/dd-trace/src/startup-log.js +1 -1
- package/packages/dd-trace/src/telemetry/endpoints.js +0 -8
- package/packages/dd-trace/src/telemetry/logs/index.js +16 -5
- package/packages/dd-trace/src/telemetry/logs/log-collector.js +16 -6
- package/packages/dd-trace/src/telemetry/metrics.js +0 -2
- package/packages/dd-trace/src/telemetry/telemetry.js +4 -1
- package/packages/dd-trace/src/util.js +13 -1
- package/vendor/dist/@datadog/openfeature-node-server/index.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/utils.js +0 -10
|
@@ -36,7 +36,6 @@ function isFastSlash (layer, matchers) {
|
|
|
36
36
|
* @param {{ handle: Function, name?: string, path?: string,
|
|
37
37
|
* regexp?: { fast_star?: boolean, fast_slash?: boolean } }} layer
|
|
38
38
|
* @param {Array<{ path?: string, regex?: RegExp }> & { hasStarPath?: boolean, hasSlashPath?: boolean }} matchers
|
|
39
|
-
* @returns {void}
|
|
40
39
|
*/
|
|
41
40
|
function annotateLayer (layer, matchers) {
|
|
42
41
|
const handle = layer.handle
|
|
@@ -382,7 +381,6 @@ function createLayerDispatchWrappers (name) {
|
|
|
382
381
|
|
|
383
382
|
/**
|
|
384
383
|
* @param {{ handle_request?: unknown, handleRequest?: unknown }} layer
|
|
385
|
-
* @returns {boolean}
|
|
386
384
|
*/
|
|
387
385
|
function hasLayerDispatch (layer) {
|
|
388
386
|
return typeof layer.handle_request === 'function' || typeof layer.handleRequest === 'function'
|
|
@@ -16,7 +16,6 @@ function detectRum () {
|
|
|
16
16
|
return { isRumInstrumented, isRumActive, rumSamplingRate }
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
/** @returns {boolean} */
|
|
20
19
|
function stopRumSession () {
|
|
21
20
|
if (window.DD_RUM && window.DD_RUM.stopSession) {
|
|
22
21
|
window.DD_RUM.stopSession()
|
|
@@ -25,7 +24,6 @@ function stopRumSession () {
|
|
|
25
24
|
return false
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
/** @returns {boolean} */
|
|
29
27
|
function stopRumSessionAndReportActivity () {
|
|
30
28
|
if (window.DD_RUM && window.DD_RUM.stopSession) {
|
|
31
29
|
const isRumActive = window.DD_RUM.getInternalContext
|
|
@@ -95,7 +95,6 @@ addHook({ name: 'sequelize', versions: ['>=4'], file: 'lib/transaction.js' }, Tr
|
|
|
95
95
|
/**
|
|
96
96
|
* @param {{ pool: SequelizePool & { read?: SequelizePool, write?: SequelizePool } }} manager
|
|
97
97
|
* @param {[{ type?: string, useMaster?: boolean }?]} args
|
|
98
|
-
* @returns {boolean}
|
|
99
98
|
*/
|
|
100
99
|
function sequelizeHasIdleConnection (manager, args) {
|
|
101
100
|
const pool = manager.pool
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { addHook, getHooks } = require('./helpers/instrument')
|
|
4
|
+
|
|
5
|
+
addHook({ name: '@supabase/supabase-js', versions: ['>=2.112.2'] }, exports => exports)
|
|
6
|
+
|
|
7
|
+
for (const hook of getHooks([
|
|
8
|
+
'@supabase/auth-js',
|
|
9
|
+
'@supabase/storage-js',
|
|
10
|
+
'@supabase/realtime-js',
|
|
11
|
+
'@supabase/functions-js',
|
|
12
|
+
'@supabase/postgrest-js',
|
|
13
|
+
]).values()) {
|
|
14
|
+
addHook(hook, exports => exports)
|
|
15
|
+
}
|
|
@@ -4,7 +4,8 @@ const path = require('node:path')
|
|
|
4
4
|
|
|
5
5
|
const satisfies = require('../../../vendor/dist/semifies')
|
|
6
6
|
|
|
7
|
-
const {
|
|
7
|
+
const { getDynamicAtrRetryCount } = require('../../dd-trace/src/ci-visibility/dynamic-atr-retries')
|
|
8
|
+
const { EMPTY_EFD_RETRY_POLICY, hasEfdRetries } = require('../../dd-trace/src/ci-visibility/efd-retry-policy')
|
|
8
9
|
const { RUM_TEST_EXECUTION_ID_COOKIE_NAME } = require('../../dd-trace/src/ci-visibility/rum')
|
|
9
10
|
const { getValueFromEnvSources } = require('../../dd-trace/src/config/helper')
|
|
10
11
|
const log = require('../../dd-trace/src/log')
|
|
@@ -94,7 +95,6 @@ function noop () {}
|
|
|
94
95
|
* Removes Vite and Vitest runtime query parameters from browser error URLs.
|
|
95
96
|
*
|
|
96
97
|
* @param {string} url
|
|
97
|
-
* @returns {string}
|
|
98
98
|
*/
|
|
99
99
|
function removeVitestBrowserUrlMetadata (url) {
|
|
100
100
|
const locationMatch = url.match(VITEST_BROWSER_STACK_LOCATION_RE)
|
|
@@ -129,7 +129,6 @@ function removeVitestBrowserUrlMetadata (url) {
|
|
|
129
129
|
* Removes Vite and Vitest runtime URL metadata from browser error text.
|
|
130
130
|
*
|
|
131
131
|
* @param {string} value
|
|
132
|
-
* @returns {string}
|
|
133
132
|
*/
|
|
134
133
|
function normalizeVitestBrowserErrorText (value) {
|
|
135
134
|
return value.replaceAll(VITEST_BROWSER_URL_RE, removeVitestBrowserUrlMetadata)
|
|
@@ -139,7 +138,6 @@ function normalizeVitestBrowserErrorText (value) {
|
|
|
139
138
|
* Removes the ephemeral Vite server origin in addition to its runtime query parameters.
|
|
140
139
|
*
|
|
141
140
|
* @param {string} url
|
|
142
|
-
* @returns {string}
|
|
143
141
|
*/
|
|
144
142
|
function normalizeVitestBrowserStackUrl (url) {
|
|
145
143
|
const normalizedUrl = removeVitestBrowserUrlMetadata(url)
|
|
@@ -152,7 +150,6 @@ function normalizeVitestBrowserStackUrl (url) {
|
|
|
152
150
|
* Normalizes browser URLs in a stack when Vitest does not provide parsed frames.
|
|
153
151
|
*
|
|
154
152
|
* @param {string} value
|
|
155
|
-
* @returns {string}
|
|
156
153
|
*/
|
|
157
154
|
function normalizeVitestBrowserStackText (value) {
|
|
158
155
|
return value.replaceAll(VITEST_BROWSER_URL_RE, normalizeVitestBrowserStackUrl)
|
|
@@ -330,7 +327,6 @@ function isNoWorkerInitPool (pool, isVitestWorkerPool) {
|
|
|
330
327
|
|
|
331
328
|
/**
|
|
332
329
|
* @param {object} state
|
|
333
|
-
* @returns {boolean}
|
|
334
330
|
*/
|
|
335
331
|
function isEarlyFlakeDetectionActive (state) {
|
|
336
332
|
return state.isEarlyFlakeDetectionEnabled &&
|
|
@@ -354,7 +350,20 @@ function configure (ctx, frameworkVersion, testSpecifications, setupData, option
|
|
|
354
350
|
testManagementTestsBySuite,
|
|
355
351
|
testPropertiesByFilepath,
|
|
356
352
|
testSessionConfiguration,
|
|
353
|
+
flakyTestRetriesConfiguration,
|
|
357
354
|
} = setupData
|
|
355
|
+
const { earlyFlakeDetectionRetryPolicy, dynamicAtrBuckets } = state
|
|
356
|
+
|
|
357
|
+
// Resolve the shared policy in Node; Browser Mode receives only serializable duration/count pairs.
|
|
358
|
+
const dynamicAtrRetryPolicy = state.isDynamicAtrEnabled
|
|
359
|
+
? [
|
|
360
|
+
...EMPTY_EFD_RETRY_POLICY.durationRetryCounts.map(({ durationLimitMs }) => ({
|
|
361
|
+
durationLimitMs,
|
|
362
|
+
retryCount: getDynamicAtrRetryCount(durationLimitMs, earlyFlakeDetectionRetryPolicy, dynamicAtrBuckets),
|
|
363
|
+
})),
|
|
364
|
+
{ retryCount: getDynamicAtrRetryCount(Infinity, earlyFlakeDetectionRetryPolicy, dynamicAtrBuckets) },
|
|
365
|
+
]
|
|
366
|
+
: undefined
|
|
358
367
|
|
|
359
368
|
setProvidedContext(ctx, {
|
|
360
369
|
_ddVitestWorkerSetup: {
|
|
@@ -366,6 +375,8 @@ function configure (ctx, frameworkVersion, testSpecifications, setupData, option
|
|
|
366
375
|
efdSuiteAdmissionBrowserCommand: VITEST_BROWSER_EFD_SUITE_ADMISSION_COMMAND,
|
|
367
376
|
isEfdSuiteAdmissionEnabled: state.isEfdSuiteAdmissionEnabled,
|
|
368
377
|
isEarlyFlakeDetectionEnabled: isEarlyFlakeDetectionActive(state),
|
|
378
|
+
dynamicAtrRetryPolicy,
|
|
379
|
+
flakyTestRetriesConfiguration,
|
|
369
380
|
isRumCorrelationEnabled: !canRaceRumCorrelation(ctx, testSpecifications),
|
|
370
381
|
knownTests: knownTestsBySuite || {},
|
|
371
382
|
modifiedFiles: modifiedFiles || {},
|
|
@@ -456,7 +467,6 @@ function addSetupFileToVitestConfigs (ctx, setupFile, testSpecifications) {
|
|
|
456
467
|
* @param {{
|
|
457
468
|
* resolve?: { dedupe?: string[] }
|
|
458
469
|
* }} viteConfig
|
|
459
|
-
* @returns {void}
|
|
460
470
|
*/
|
|
461
471
|
function configureVitestBrowserSetupFile (viteConfig) {
|
|
462
472
|
viteConfig.resolve ||= {}
|
|
@@ -473,7 +483,6 @@ function configureVitestBrowserSetupFile (viteConfig) {
|
|
|
473
483
|
* @param {unknown} _context
|
|
474
484
|
* @param {string} testSuite
|
|
475
485
|
* @param {unknown} hasNewTest
|
|
476
|
-
* @returns {boolean}
|
|
477
486
|
*/
|
|
478
487
|
function handleBrowserEfdSuiteAdmission (_context, testSuite, hasNewTest) {
|
|
479
488
|
return reserveEarlyFlakeDetectionSuite?.(testSuite, hasNewTest === true) === true
|
|
@@ -483,7 +492,6 @@ function handleBrowserEfdSuiteAdmission (_context, testSuite, hasNewTest) {
|
|
|
483
492
|
* Allows Vite to serve the Datadog setup file after its default workspace detection has run.
|
|
484
493
|
*
|
|
485
494
|
* @param {{ server?: { fs?: { allow?: string[] } } }} viteConfig
|
|
486
|
-
* @returns {void}
|
|
487
495
|
*/
|
|
488
496
|
function allowVitestBrowserSetupFile (viteConfig) {
|
|
489
497
|
const allow = viteConfig.server?.fs?.allow
|
|
@@ -505,7 +513,6 @@ function allowVitestBrowserSetupFile (viteConfig) {
|
|
|
505
513
|
* Installs the Vite access plugin on each parent project that owns a Browser Mode server.
|
|
506
514
|
*
|
|
507
515
|
* @param {object[]|undefined} testSpecifications
|
|
508
|
-
* @returns {void}
|
|
509
516
|
*/
|
|
510
517
|
function addVitestBrowserSetupFileAccess (testSpecifications) {
|
|
511
518
|
if (!Array.isArray(testSpecifications)) return
|
|
@@ -545,7 +552,6 @@ function addVitestBrowserRuntimeCommand (project) {
|
|
|
545
552
|
* Adds the private EFD admission command to a Vitest Browser Mode configuration.
|
|
546
553
|
*
|
|
547
554
|
* @param {object|undefined} config
|
|
548
|
-
* @returns {void}
|
|
549
555
|
*/
|
|
550
556
|
function addVitestBrowserCommand (config) {
|
|
551
557
|
const browserConfig = config?.browser
|
|
@@ -927,6 +933,7 @@ function createMainProcessReporter (reporterState) {
|
|
|
927
933
|
const { flakyTestRetriesConfiguration } = testOptimizationData
|
|
928
934
|
const isFlakyTestRetries = !!flakyTestRetriesConfiguration && isFlakyTestRetriesEnabledForTask({
|
|
929
935
|
isFlakyTestRetriesEnabled: state.isFlakyTestRetriesEnabled,
|
|
936
|
+
isDynamicAtrEnabled: state.isDynamicAtrEnabled,
|
|
930
937
|
flakyTestRetriesIncludesUnnamedProject: flakyTestRetriesConfiguration.includesUnnamedProject,
|
|
931
938
|
flakyTestRetriesProjectNames: flakyTestRetriesConfiguration.projectNames,
|
|
932
939
|
}, task)
|
|
@@ -1169,7 +1176,6 @@ function getRepeatedTestReport (task, testName, testSuiteAbsolutePath, testPrope
|
|
|
1169
1176
|
* @param {'attempt_to_fix'|'early_flake_detection'|'external'} type
|
|
1170
1177
|
* @param {string[]} statuses
|
|
1171
1178
|
* @param {boolean} isFinalAttempt
|
|
1172
|
-
* @returns {boolean}
|
|
1173
1179
|
*/
|
|
1174
1180
|
function hasFailedAllManagedRetries (task, testProperties, type, statuses, isFinalAttempt) {
|
|
1175
1181
|
if (!isFinalAttempt || statuses.length === 0 || !statuses.every(status => status === 'fail')) {
|
|
@@ -1207,7 +1213,6 @@ function getEarlyFlakeDetectionFinalStatus (statuses, testProperties) {
|
|
|
1207
1213
|
*
|
|
1208
1214
|
* @param {string} status
|
|
1209
1215
|
* @param {{ isDisabled?: boolean, isQuarantined?: boolean }} testProperties
|
|
1210
|
-
* @returns {string}
|
|
1211
1216
|
*/
|
|
1212
1217
|
function getExternalFinalStatus (status, testProperties) {
|
|
1213
1218
|
return testProperties.isDisabled || testProperties.isQuarantined ? 'skip' : status
|
|
@@ -1692,7 +1697,6 @@ function getEffectiveTestSpecificationPool (testSpecification, defaultPool) {
|
|
|
1692
1697
|
* Resolves Vitest's default worker pool when the user did not configure one.
|
|
1693
1698
|
*
|
|
1694
1699
|
* @param {{ pool?: string }|undefined} config
|
|
1695
|
-
* @returns {string}
|
|
1696
1700
|
*/
|
|
1697
1701
|
function getEffectiveConfigPool (config) {
|
|
1698
1702
|
return config?.pool || VITEST_DEFAULT_POOL
|
|
@@ -1747,7 +1751,6 @@ function normalizeProjectName (name) {
|
|
|
1747
1751
|
* Returns whether a Vitest specification runs in Browser Mode.
|
|
1748
1752
|
*
|
|
1749
1753
|
* @param {object} testSpecification
|
|
1750
|
-
* @returns {boolean}
|
|
1751
1754
|
*/
|
|
1752
1755
|
function isBrowserTestSpecification (testSpecification) {
|
|
1753
1756
|
return getTestSpecificationPool(testSpecification) === 'browser' ||
|
|
@@ -1758,7 +1761,6 @@ function isBrowserTestSpecification (testSpecification) {
|
|
|
1758
1761
|
* Returns whether a Vitest project has Browser Mode enabled.
|
|
1759
1762
|
*
|
|
1760
1763
|
* @param {object|undefined} project
|
|
1761
|
-
* @returns {boolean}
|
|
1762
1764
|
*/
|
|
1763
1765
|
function isBrowserProject (project) {
|
|
1764
1766
|
try {
|
|
@@ -1771,7 +1773,6 @@ function isBrowserProject (project) {
|
|
|
1771
1773
|
* Returns whether Vitest can overlap tests or their setup and teardown.
|
|
1772
1774
|
*
|
|
1773
1775
|
* @param {object|undefined} config
|
|
1774
|
-
* @returns {boolean}
|
|
1775
1776
|
*/
|
|
1776
1777
|
function hasConcurrentTestExecution (config) {
|
|
1777
1778
|
const sequence = config?.sequence
|
|
@@ -1785,7 +1786,6 @@ function hasConcurrentTestExecution (config) {
|
|
|
1785
1786
|
*
|
|
1786
1787
|
* @param {object} ctx
|
|
1787
1788
|
* @param {object[]|undefined} testSpecifications
|
|
1788
|
-
* @returns {boolean}
|
|
1789
1789
|
*/
|
|
1790
1790
|
function canRaceRumCorrelation (ctx, testSpecifications) {
|
|
1791
1791
|
if (!Array.isArray(testSpecifications)) {
|
|
@@ -71,6 +71,8 @@ const runErrorsByContext = new WeakMap()
|
|
|
71
71
|
const typecheckPoolWorkerRequests = new WeakMap()
|
|
72
72
|
let isFlakyTestRetriesEnabled = false
|
|
73
73
|
let flakyTestRetriesCount = 0
|
|
74
|
+
let isDynamicAtrEnabled = false
|
|
75
|
+
let dynamicAtrBuckets
|
|
74
76
|
let isEarlyFlakeDetectionEnabled = false
|
|
75
77
|
let earlyFlakeDetectionRetryPolicy = EMPTY_EFD_RETRY_POLICY
|
|
76
78
|
let earlyFlakeDetectionFaultyThreshold = 0
|
|
@@ -232,7 +234,6 @@ function getTestFilepaths (ctx, testSpecifications) {
|
|
|
232
234
|
*
|
|
233
235
|
* @param {string} testFilepath
|
|
234
236
|
* @param {string} repositoryRoot
|
|
235
|
-
* @returns {string}
|
|
236
237
|
*/
|
|
237
238
|
function getNormalizedTestSuitePath (testFilepath, repositoryRoot) {
|
|
238
239
|
const testSuiteAbsolutePath = path.isAbsolute(testFilepath) ? testFilepath : path.join(repositoryRoot, testFilepath)
|
|
@@ -242,7 +243,6 @@ function getNormalizedTestSuitePath (testFilepath, repositoryRoot) {
|
|
|
242
243
|
/**
|
|
243
244
|
* Resets suite-level EFD admission state between Vitest runs.
|
|
244
245
|
*
|
|
245
|
-
* @returns {void}
|
|
246
246
|
*/
|
|
247
247
|
function resetEfdSuiteTracker () {
|
|
248
248
|
activeNoWorkerInitState = undefined
|
|
@@ -255,7 +255,6 @@ function resetEfdSuiteTracker () {
|
|
|
255
255
|
* Returns whether a Vitest pool has a transport for runtime EFD suite admission.
|
|
256
256
|
*
|
|
257
257
|
* @param {string|undefined} pool
|
|
258
|
-
* @returns {boolean}
|
|
259
258
|
*/
|
|
260
259
|
function isEfdSuiteAdmissionPool (pool) {
|
|
261
260
|
return pool === undefined || pool === 'forks' || pool === 'threads' || pool === 'browser'
|
|
@@ -267,7 +266,6 @@ function isEfdSuiteAdmissionPool (pool) {
|
|
|
267
266
|
* @param {string} frameworkVersion
|
|
268
267
|
* @param {object[]|undefined} testSpecifications
|
|
269
268
|
* @param {object} ctx
|
|
270
|
-
* @returns {boolean}
|
|
271
269
|
*/
|
|
272
270
|
function supportsEfdSuiteAdmission (frameworkVersion, testSpecifications, ctx) {
|
|
273
271
|
if (!satisfies(frameworkVersion, '>=4.0.0')) return false
|
|
@@ -288,7 +286,6 @@ function supportsEfdSuiteAdmission (frameworkVersion, testSpecifications, ctx) {
|
|
|
288
286
|
*
|
|
289
287
|
* @param {string[]} testFilepaths
|
|
290
288
|
* @param {string} repositoryRoot
|
|
291
|
-
* @returns {void}
|
|
292
289
|
*/
|
|
293
290
|
function configureEfdSuiteTracker (testFilepaths, repositoryRoot) {
|
|
294
291
|
const testSuites = new Set()
|
|
@@ -308,7 +305,6 @@ function configureEfdSuiteTracker (testFilepaths, repositoryRoot) {
|
|
|
308
305
|
*
|
|
309
306
|
* @param {string} testSuite
|
|
310
307
|
* @param {boolean} hasNewTest
|
|
311
|
-
* @returns {boolean}
|
|
312
308
|
*/
|
|
313
309
|
function reserveEarlyFlakeDetectionSuite (testSuite, hasNewTest) {
|
|
314
310
|
if (!isEfdSuiteAdmissionEnabled || typeof testSuite !== 'string') return false
|
|
@@ -651,6 +647,8 @@ function wrapSessionFinish (ctx) {
|
|
|
651
647
|
function resetLibraryConfig () {
|
|
652
648
|
isFlakyTestRetriesEnabled = false
|
|
653
649
|
flakyTestRetriesCount = 0
|
|
650
|
+
isDynamicAtrEnabled = false
|
|
651
|
+
dynamicAtrBuckets = undefined
|
|
654
652
|
isEarlyFlakeDetectionEnabled = false
|
|
655
653
|
earlyFlakeDetectionRetryPolicy = EMPTY_EFD_RETRY_POLICY
|
|
656
654
|
earlyFlakeDetectionFaultyThreshold = 0
|
|
@@ -667,6 +665,8 @@ function resetLibraryConfig () {
|
|
|
667
665
|
function applyLibraryConfig (libraryConfig) {
|
|
668
666
|
isFlakyTestRetriesEnabled = libraryConfig.isFlakyTestRetriesEnabled
|
|
669
667
|
flakyTestRetriesCount = libraryConfig.flakyTestRetriesCount
|
|
668
|
+
isDynamicAtrEnabled = libraryConfig.isDynamicAtrEnabled
|
|
669
|
+
dynamicAtrBuckets = libraryConfig.dynamicAtrBuckets
|
|
670
670
|
isEarlyFlakeDetectionEnabled = libraryConfig.isEarlyFlakeDetectionEnabled
|
|
671
671
|
earlyFlakeDetectionRetryPolicy = libraryConfig.earlyFlakeDetectionRetryPolicy ?? EMPTY_EFD_RETRY_POLICY
|
|
672
672
|
earlyFlakeDetectionFaultyThreshold = libraryConfig.earlyFlakeDetectionFaultyThreshold ?? 0
|
|
@@ -688,6 +688,8 @@ function resetMainProcessProvidedContext (ctx) {
|
|
|
688
688
|
_ddIsEfdSuiteAdmissionEnabled: false,
|
|
689
689
|
_ddIsFlakyTestRetriesEnabled: false,
|
|
690
690
|
_ddFlakyTestRetriesCount: 0,
|
|
691
|
+
_ddIsDynamicAtrEnabled: false,
|
|
692
|
+
_ddDynamicAtrBuckets: undefined,
|
|
691
693
|
_ddFlakyTestRetriesIncludesUnnamedProject: false,
|
|
692
694
|
_ddFlakyTestRetriesProjectNames: undefined,
|
|
693
695
|
_ddIsImpactedTestsEnabled: false,
|
|
@@ -766,6 +768,8 @@ async function runMainProcessSetup (
|
|
|
766
768
|
resetLibraryConfig()
|
|
767
769
|
} else {
|
|
768
770
|
applyLibraryConfig(libraryConfig)
|
|
771
|
+
// Older runners cache a numeric ceiling and cannot stop retries before the next lifecycle starts.
|
|
772
|
+
isDynamicAtrEnabled &&= satisfies(frameworkVersion, '>=4.1.0')
|
|
769
773
|
}
|
|
770
774
|
} catch {
|
|
771
775
|
requestErrorTags = {}
|
|
@@ -832,6 +836,8 @@ async function runMainProcessSetup (
|
|
|
832
836
|
setProvidedContext(ctx, {
|
|
833
837
|
_ddIsFlakyTestRetriesEnabled: isFlakyTestRetriesEnabled,
|
|
834
838
|
_ddFlakyTestRetriesCount: flakyTestRetriesCount,
|
|
839
|
+
_ddIsDynamicAtrEnabled: isDynamicAtrEnabled,
|
|
840
|
+
_ddDynamicAtrBuckets: dynamicAtrBuckets,
|
|
835
841
|
_ddFlakyTestRetriesIncludesUnnamedProject: flakyTestRetriesConfiguration.includesUnnamedProject,
|
|
836
842
|
_ddFlakyTestRetriesProjectNames: flakyTestRetriesConfiguration.projectNames,
|
|
837
843
|
}, 'Could not send library configuration to workers.')
|
|
@@ -972,6 +978,8 @@ function getNoWorkerInitState () {
|
|
|
972
978
|
isEarlyFlakeDetectionEnabled,
|
|
973
979
|
isEarlyFlakeDetectionFaulty,
|
|
974
980
|
isFlakyTestRetriesEnabled,
|
|
981
|
+
isDynamicAtrEnabled,
|
|
982
|
+
dynamicAtrBuckets,
|
|
975
983
|
isKnownTestsEnabled,
|
|
976
984
|
newTestsWithDynamicNames,
|
|
977
985
|
requestErrorTags,
|
|
@@ -1039,14 +1047,21 @@ function shouldUseBrowserReporter (frameworkVersion, testSpecifications) {
|
|
|
1039
1047
|
}
|
|
1040
1048
|
|
|
1041
1049
|
function configureFlakyTestRetries (ctx, testSpecifications) {
|
|
1042
|
-
if (!isFlakyTestRetriesEnabled || flakyTestRetriesCount <= 0) return
|
|
1043
|
-
|
|
1050
|
+
if (!isFlakyTestRetriesEnabled || (!isDynamicAtrEnabled && flakyTestRetriesCount <= 0)) return
|
|
1051
|
+
|
|
1052
|
+
const maximumDynamicAtrRetries = dynamicAtrBuckets
|
|
1053
|
+
? Math.max(...dynamicAtrBuckets)
|
|
1054
|
+
: earlyFlakeDetectionRetryPolicy.schedulingRetryCount
|
|
1055
|
+
const retryCount = isDynamicAtrEnabled
|
|
1056
|
+
? Math.max(1, maximumDynamicAtrRetries)
|
|
1057
|
+
: flakyTestRetriesCount
|
|
1044
1058
|
let configured = false
|
|
1045
1059
|
let includesUnnamedProject = false
|
|
1046
1060
|
const projectNames = []
|
|
1047
1061
|
for (const { config, projectName } of getVitestProjectConfigs(ctx, testSpecifications)) {
|
|
1048
|
-
if (!config.retry) {
|
|
1049
|
-
|
|
1062
|
+
if (!config.retry || config.retry.__ddTestOptAtr) {
|
|
1063
|
+
// The serializable marker survives task inheritance and setup refreshes, unlike numeric retry counts.
|
|
1064
|
+
config.retry = isDynamicAtrEnabled ? { count: retryCount, __ddTestOptAtr: true } : retryCount
|
|
1050
1065
|
configured = true
|
|
1051
1066
|
if (projectName) {
|
|
1052
1067
|
projectNames.push(projectName)
|
|
@@ -1208,8 +1223,19 @@ function getFinishWrapper (exitOrClose) {
|
|
|
1208
1223
|
error = new Error(`Test suites failed: ${failedSuites.length}.`)
|
|
1209
1224
|
}
|
|
1210
1225
|
|
|
1226
|
+
const hasNoTestFiles = this.state.pathsSet.size === 0
|
|
1227
|
+
const hasUnexpectedEmptySession = hasNoTestFiles && !areAllSuitesSkipped && !this.config.passWithNoTests
|
|
1228
|
+
if (!error && hasUnexpectedEmptySession) {
|
|
1229
|
+
error = new Error('No test files were found.')
|
|
1230
|
+
}
|
|
1231
|
+
const status = runError || hasUnexpectedEmptySession
|
|
1232
|
+
? 'fail'
|
|
1233
|
+
: (areAllSuitesSkipped ? 'skip' : getSessionStatus(this.state))
|
|
1234
|
+
const isExpectedEmptySession = !runError && !hasUnexpectedEmptySession &&
|
|
1235
|
+
(areAllSuitesSkipped || hasNoTestFiles)
|
|
1211
1236
|
const flushPromise = getChannelPromise(testSessionFinishCh, {
|
|
1212
|
-
status
|
|
1237
|
+
status,
|
|
1238
|
+
isExpectedEmptySession,
|
|
1213
1239
|
testCodeCoverageLinesTotal,
|
|
1214
1240
|
error,
|
|
1215
1241
|
isEarlyFlakeDetectionEnabled,
|
|
@@ -1306,7 +1332,6 @@ function getTestSpecificationPool (testSpecification) {
|
|
|
1306
1332
|
* Detect whether Vitest selected only TypeScript typecheck specifications.
|
|
1307
1333
|
*
|
|
1308
1334
|
* @param {unknown} testSpecifications
|
|
1309
|
-
* @returns {boolean}
|
|
1310
1335
|
*/
|
|
1311
1336
|
function hasOnlyTypecheckTestSpecifications (testSpecifications) {
|
|
1312
1337
|
if (!Array.isArray(testSpecifications) || testSpecifications.length === 0) return false
|
|
@@ -1413,7 +1438,6 @@ function getTypecheckTaskStatus (task) {
|
|
|
1413
1438
|
*
|
|
1414
1439
|
* @param {string|undefined} suiteName
|
|
1415
1440
|
* @param {string} testSuiteAbsolutePath
|
|
1416
|
-
* @returns {boolean}
|
|
1417
1441
|
*/
|
|
1418
1442
|
function isTypecheckFileSuiteName (suiteName, testSuiteAbsolutePath) {
|
|
1419
1443
|
if (!suiteName || !testSuiteAbsolutePath) return false
|
|
@@ -1429,7 +1453,6 @@ function isTypecheckFileSuiteName (suiteName, testSuiteAbsolutePath) {
|
|
|
1429
1453
|
*
|
|
1430
1454
|
* @param {object} task
|
|
1431
1455
|
* @param {string} testSuiteAbsolutePath
|
|
1432
|
-
* @returns {string}
|
|
1433
1456
|
*/
|
|
1434
1457
|
function getTypecheckTestName (task, testSuiteAbsolutePath) {
|
|
1435
1458
|
let testName = task.name || task.fullTestName
|
|
@@ -1508,7 +1531,6 @@ function updateTypecheckTaskResultForTestManagement (task, status, testManagemen
|
|
|
1508
1531
|
* Recompute suite/file typecheck results after Test Management rewrites child test results.
|
|
1509
1532
|
*
|
|
1510
1533
|
* @param {object} task
|
|
1511
|
-
* @returns {string}
|
|
1512
1534
|
*/
|
|
1513
1535
|
function updateTypecheckTaskTreeResult (task) {
|
|
1514
1536
|
if (!Array.isArray(task.tasks)) return getTypecheckTaskStatus(task)
|
|
@@ -1552,7 +1574,6 @@ function updateTypecheckTaskTreeResult (task) {
|
|
|
1552
1574
|
* sourceErrors?: object[],
|
|
1553
1575
|
* state?: string
|
|
1554
1576
|
* }} result
|
|
1555
|
-
* @returns {boolean}
|
|
1556
1577
|
*/
|
|
1557
1578
|
function updateTypecheckResult (result) {
|
|
1558
1579
|
if (result.sourceErrors?.length) return false
|
|
@@ -1945,7 +1966,6 @@ function getWrappedOn (on) {
|
|
|
1945
1966
|
* @param {object} workerProcess
|
|
1946
1967
|
* @param {number} interprocessCode
|
|
1947
1968
|
* @param {object} data
|
|
1948
|
-
* @returns {boolean}
|
|
1949
1969
|
*/
|
|
1950
1970
|
function handleEfdAdmissionMessage (workerProcess, interprocessCode, data) {
|
|
1951
1971
|
if (interprocessCode !== VITEST_WORKER_EFD_SUITE_ADMISSION_REQUEST_CODE) return false
|
|
@@ -45,7 +45,6 @@ const codeCoverageReportCh = channel('ci:vitest:coverage-report')
|
|
|
45
45
|
* Resolves a path without failing Test Optimization when the path is unavailable.
|
|
46
46
|
*
|
|
47
47
|
* @param {string} filepath
|
|
48
|
-
* @returns {string}
|
|
49
48
|
*/
|
|
50
49
|
function realpath (filepath) {
|
|
51
50
|
try {
|
|
@@ -179,6 +178,8 @@ function getProvidedContext () {
|
|
|
179
178
|
_ddTestManagementAttemptToFixRetries: testManagementAttemptToFixRetries,
|
|
180
179
|
_ddIsFlakyTestRetriesEnabled: isFlakyTestRetriesEnabled,
|
|
181
180
|
_ddFlakyTestRetriesCount: flakyTestRetriesCount,
|
|
181
|
+
_ddIsDynamicAtrEnabled: isDynamicAtrEnabled,
|
|
182
|
+
_ddDynamicAtrBuckets: dynamicAtrBuckets,
|
|
182
183
|
_ddFlakyTestRetriesIncludesUnnamedProject: flakyTestRetriesIncludesUnnamedProject,
|
|
183
184
|
_ddFlakyTestRetriesProjectNames: flakyTestRetriesProjectNames,
|
|
184
185
|
_ddIsImpactedTestsEnabled: isImpactedTestsEnabled,
|
|
@@ -206,6 +207,8 @@ function getProvidedContext () {
|
|
|
206
207
|
testManagementAttemptToFixRetries,
|
|
207
208
|
isFlakyTestRetriesEnabled,
|
|
208
209
|
flakyTestRetriesCount: flakyTestRetriesCount ?? 0,
|
|
210
|
+
isDynamicAtrEnabled,
|
|
211
|
+
dynamicAtrBuckets,
|
|
209
212
|
flakyTestRetriesIncludesUnnamedProject,
|
|
210
213
|
flakyTestRetriesProjectNames,
|
|
211
214
|
isImpactedTestsEnabled,
|
|
@@ -232,6 +235,8 @@ function getProvidedContext () {
|
|
|
232
235
|
testManagementAttemptToFixRetries: 0,
|
|
233
236
|
isFlakyTestRetriesEnabled: false,
|
|
234
237
|
flakyTestRetriesCount: 0,
|
|
238
|
+
isDynamicAtrEnabled: false,
|
|
239
|
+
dynamicAtrBuckets: undefined,
|
|
235
240
|
flakyTestRetriesIncludesUnnamedProject: false,
|
|
236
241
|
flakyTestRetriesProjectNames: undefined,
|
|
237
242
|
isImpactedTestsEnabled: false,
|
|
@@ -250,6 +255,7 @@ function getProvidedContext () {
|
|
|
250
255
|
|
|
251
256
|
function isFlakyTestRetriesEnabledForTask (providedContext, task) {
|
|
252
257
|
if (!providedContext.isFlakyTestRetriesEnabled) return false
|
|
258
|
+
if (providedContext.isDynamicAtrEnabled && !task.retry?.__ddTestOptAtr) return false
|
|
253
259
|
|
|
254
260
|
const { flakyTestRetriesProjectNames } = providedContext
|
|
255
261
|
if (!Array.isArray(flakyTestRetriesProjectNames)) return true
|
|
@@ -9,7 +9,11 @@ const { isMainThread, parentPort } = require('node:worker_threads')
|
|
|
9
9
|
const { channel } = require('dc-polyfill')
|
|
10
10
|
const shimmer = require('../../datadog-shimmer')
|
|
11
11
|
const log = require('../../dd-trace/src/log')
|
|
12
|
-
const {
|
|
12
|
+
const {
|
|
13
|
+
getEfdRetryCountForDuration,
|
|
14
|
+
EMPTY_EFD_RETRY_POLICY,
|
|
15
|
+
} = require('../../dd-trace/src/ci-visibility/efd-retry-policy')
|
|
16
|
+
const { getDynamicAtrRetryCount } = require('../../dd-trace/src/ci-visibility/dynamic-atr-retries')
|
|
13
17
|
const {
|
|
14
18
|
DYNAMIC_NAME_RE,
|
|
15
19
|
getTestSuitePath,
|
|
@@ -63,6 +67,8 @@ const modifiedTasks = new WeakSet()
|
|
|
63
67
|
const efdRetryTasks = new WeakSet()
|
|
64
68
|
const efdDeterminedRetries = new WeakMap()
|
|
65
69
|
const efdSlowAbortedTasks = new WeakSet()
|
|
70
|
+
// Each native repetition selects its own budget from its first attempt.
|
|
71
|
+
const dynamicAtrStateByTask = new WeakMap()
|
|
66
72
|
const efdExecutionStartByTask = new WeakMap()
|
|
67
73
|
const efdSkippedRetryResults = new WeakMap()
|
|
68
74
|
const attemptToFixExecutions = new Map()
|
|
@@ -184,7 +190,6 @@ function getVitestCoverageOptions () {
|
|
|
184
190
|
/**
|
|
185
191
|
* Check whether the current Vitest worker reuses its module cache across test suites.
|
|
186
192
|
*
|
|
187
|
-
* @returns {boolean}
|
|
188
193
|
*/
|
|
189
194
|
function isNonIsolatedRun () {
|
|
190
195
|
const config = globalThis.__vitest_worker__?.config
|
|
@@ -287,7 +292,6 @@ function getFinalAttemptToFixStatus (task, state, isSwitchedStatus, testCtx) {
|
|
|
287
292
|
* Return the normalized test suite path prepared by the main process for a Vitest task.
|
|
288
293
|
*
|
|
289
294
|
* @param {{ file: { filepath: string } }} task
|
|
290
|
-
* @returns {string}
|
|
291
295
|
*/
|
|
292
296
|
function getTaskTestSuite (task) {
|
|
293
297
|
return taskToTestProperties.get(task)?.testSuite || task.file.filepath
|
|
@@ -343,7 +347,6 @@ function wrapBeforeEachCleanupResult (task, result) {
|
|
|
343
347
|
* Returns whether a Vitest task tree includes any concurrent task.
|
|
344
348
|
*
|
|
345
349
|
* @param {Array<{ type?: string, concurrent?: boolean, tasks?: object[] }>|undefined} tasks
|
|
346
|
-
* @returns {boolean}
|
|
347
350
|
*/
|
|
348
351
|
function hasConcurrentTask (tasks) {
|
|
349
352
|
if (!tasks) return false
|
|
@@ -360,7 +363,6 @@ function hasConcurrentTask (tasks) {
|
|
|
360
363
|
* Returns whether a Vitest file includes any concurrent test.
|
|
361
364
|
*
|
|
362
365
|
* @param {{ tasks?: object[] }} file
|
|
363
|
-
* @returns {boolean}
|
|
364
366
|
*/
|
|
365
367
|
function hasConcurrentTests (file) {
|
|
366
368
|
const cached = fileToHasConcurrentTests.get(file)
|
|
@@ -376,7 +378,6 @@ function hasConcurrentTests (file) {
|
|
|
376
378
|
*
|
|
377
379
|
* @param {{ filepath: string, tasks?: object[] }} file
|
|
378
380
|
* @param {object} providedContext
|
|
379
|
-
* @returns {boolean}
|
|
380
381
|
*/
|
|
381
382
|
function hasRunnableNewTest (file, providedContext) {
|
|
382
383
|
for (const task of getTypeTasks(file.tasks)) {
|
|
@@ -395,7 +396,6 @@ function hasRunnableNewTest (file, providedContext) {
|
|
|
395
396
|
*
|
|
396
397
|
* @param {number} requestId
|
|
397
398
|
* @param {boolean} allowed
|
|
398
|
-
* @returns {void}
|
|
399
399
|
*/
|
|
400
400
|
function finishEfdSuiteAdmissionRequest (requestId, allowed) {
|
|
401
401
|
const request = pendingEfdSuiteAdmissionRequests.get(requestId)
|
|
@@ -410,7 +410,6 @@ function finishEfdSuiteAdmissionRequest (requestId, allowed) {
|
|
|
410
410
|
* Handles an EFD suite admission response from the Vitest main process.
|
|
411
411
|
*
|
|
412
412
|
* @param {unknown} message
|
|
413
|
-
* @returns {void}
|
|
414
413
|
*/
|
|
415
414
|
function handleEfdSuiteAdmissionResponse (message) {
|
|
416
415
|
if (!Array.isArray(message) || message[0] !== VITEST_WORKER_EFD_SUITE_ADMISSION_RESPONSE_CODE) return
|
|
@@ -591,6 +590,31 @@ function wrapVitestTestRunner (VitestTestRunner) {
|
|
|
591
590
|
}
|
|
592
591
|
}
|
|
593
592
|
|
|
593
|
+
if (
|
|
594
|
+
providedContext.isDynamicAtrEnabled &&
|
|
595
|
+
isFlakyTestRetriesEnabledForTask(providedContext, task) &&
|
|
596
|
+
!attemptToFixTasks.has(task) &&
|
|
597
|
+
!efdRetryTasks.has(task) &&
|
|
598
|
+
task.retry?.__ddTestOptAtr && task.retry.count > 0
|
|
599
|
+
) {
|
|
600
|
+
const state = { executionStart: process.uptime(), retryOffset: 0, retryCount: undefined }
|
|
601
|
+
dynamicAtrStateByTask.set(task, state)
|
|
602
|
+
// The runner caches count, but evaluates condition after hooks and fixture cleanup.
|
|
603
|
+
task.retry = {
|
|
604
|
+
...task.retry,
|
|
605
|
+
condition () {
|
|
606
|
+
if (state.retryCount === undefined) {
|
|
607
|
+
state.retryCount = getDynamicAtrRetryCount(
|
|
608
|
+
(process.uptime() - state.executionStart) * 1000,
|
|
609
|
+
earlyFlakeDetectionRetryPolicy ?? EMPTY_EFD_RETRY_POLICY,
|
|
610
|
+
providedContext.dynamicAtrBuckets
|
|
611
|
+
)
|
|
612
|
+
}
|
|
613
|
+
return task.result.retryCount - state.retryOffset < state.retryCount
|
|
614
|
+
},
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
594
618
|
return onBeforeRunTask.apply(this, arguments)
|
|
595
619
|
})
|
|
596
620
|
|
|
@@ -653,6 +677,13 @@ function wrapVitestTestRunner (VitestTestRunner) {
|
|
|
653
677
|
}
|
|
654
678
|
|
|
655
679
|
const { retry: numAttempt, repeats: numRepetition } = retryInfo
|
|
680
|
+
const dynamicAtrState = dynamicAtrStateByTask.get(task)
|
|
681
|
+
if (dynamicAtrState && numAttempt === 0) {
|
|
682
|
+
if (numRepetition > 0) dynamicAtrState.executionStart = process.uptime()
|
|
683
|
+
// Vitest accumulates result.retryCount across native repetitions.
|
|
684
|
+
dynamicAtrState.retryOffset = task.result.retryCount
|
|
685
|
+
dynamicAtrState.retryCount = undefined
|
|
686
|
+
}
|
|
656
687
|
const isFailedTestReplayAllowed = !hasConcurrentTests(task.file)
|
|
657
688
|
const isEfdManagedTask = efdRetryTasks.has(task)
|
|
658
689
|
|
|
@@ -718,7 +749,7 @@ function wrapVitestTestRunner (VitestTestRunner) {
|
|
|
718
749
|
const isAtf = attemptToFixTasks.has(task)
|
|
719
750
|
const isEfd = efdRetryTasks.has(task)
|
|
720
751
|
const shouldTrackStatuses = isEfd || isAtf
|
|
721
|
-
const
|
|
752
|
+
const shouldResetStatus = isEfd || isAtf
|
|
722
753
|
const statuses = isAtf ? attemptToFixTaskToStatuses.get(task) : taskToStatuses.get(task)
|
|
723
754
|
|
|
724
755
|
// These clauses handle task.repeats, whether EFD is enabled or not
|
|
@@ -738,13 +769,10 @@ function wrapVitestTestRunner (VitestTestRunner) {
|
|
|
738
769
|
if (shouldTrackStatuses && statuses) {
|
|
739
770
|
statuses.push(lastExecutionStatus)
|
|
740
771
|
}
|
|
741
|
-
if (
|
|
742
|
-
//
|
|
743
|
-
//
|
|
744
|
-
|
|
745
|
-
// if the last attempt passes, vitest would consider the test as failed
|
|
746
|
-
// but after this change, it will consider the test as passed
|
|
747
|
-
task.result.state = 'pass'
|
|
772
|
+
if (shouldResetStatus) {
|
|
773
|
+
// Reset to Vitest's neutral state so a previous failure does not affect the next repetition.
|
|
774
|
+
// A terminal pass state can leak into reporters before the next repetition determines its status.
|
|
775
|
+
task.result.state = 'run'
|
|
748
776
|
}
|
|
749
777
|
}
|
|
750
778
|
} else if (numRepetition === task.repeats) {
|
|
@@ -759,8 +787,8 @@ function wrapVitestTestRunner (VitestTestRunner) {
|
|
|
759
787
|
} else {
|
|
760
788
|
testPassCh.publish({ task, ...ctx.currentStore })
|
|
761
789
|
}
|
|
762
|
-
if (
|
|
763
|
-
task.result.state = '
|
|
790
|
+
if (shouldResetStatus) {
|
|
791
|
+
task.result.state = 'run'
|
|
764
792
|
}
|
|
765
793
|
}
|
|
766
794
|
|
|
@@ -839,15 +867,16 @@ function wrapVitestTestRunner (VitestTestRunner) {
|
|
|
839
867
|
}
|
|
840
868
|
const result = await onAfterTryTask.apply(this, arguments)
|
|
841
869
|
|
|
870
|
+
const providedContext = getProvidedContext()
|
|
842
871
|
const {
|
|
843
872
|
testManagementAttemptToFixRetries,
|
|
844
873
|
earlyFlakeDetectionRetryPolicy,
|
|
845
|
-
} =
|
|
874
|
+
} = providedContext
|
|
846
875
|
|
|
847
876
|
const status = getVitestTestStatus(task, retryInfo.retry)
|
|
848
877
|
const ctx = taskToCtx.get(task)
|
|
849
878
|
|
|
850
|
-
const { isDiEnabled } =
|
|
879
|
+
const { isDiEnabled } = providedContext
|
|
851
880
|
const isFailedTestReplayAllowed = !hasConcurrentTests(task.file)
|
|
852
881
|
|
|
853
882
|
if (efdSkippedRetryResults.has(task)) {
|
|
@@ -1116,10 +1145,14 @@ function getStartTestsWrapper (frameworkVersion) {
|
|
|
1116
1145
|
|
|
1117
1146
|
// ATR: set hasFailedAllRetries when all auto test retries were exhausted and every attempt failed
|
|
1118
1147
|
const isAtrRetry = isFlakyTestRetriesEnabledForTask(providedContext, task) && !attemptToFixTasks.has(task) &&
|
|
1119
|
-
!
|
|
1148
|
+
!efdRetryTasks.has(task)
|
|
1120
1149
|
if (isAtrRetry) {
|
|
1121
|
-
|
|
1122
|
-
|
|
1150
|
+
// Dynamic ATR: use the per-test duration-based count instead of the flat limit.
|
|
1151
|
+
const dynamicAtrState = dynamicAtrStateByTask.get(task)
|
|
1152
|
+
const maxRetries = dynamicAtrState?.retryCount === undefined
|
|
1153
|
+
? (providedContext.flakyTestRetriesCount ?? 0)
|
|
1154
|
+
: dynamicAtrState.retryOffset + dynamicAtrState.retryCount
|
|
1155
|
+
if (maxRetries > 0 && task.result?.retryCount >= maxRetries) {
|
|
1123
1156
|
hasFailedAllRetries = true
|
|
1124
1157
|
}
|
|
1125
1158
|
}
|