@depup/dd-trace 5.90.0-depup.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 +6 -0
- package/LICENSE-3rdparty.csv +102 -0
- package/LICENSE.Apache +200 -0
- package/LICENSE.BSD3 +29 -0
- package/README.md +25 -0
- package/changes.json +5 -0
- package/ci/cypress/after-run.js +3 -0
- package/ci/cypress/after-spec.js +3 -0
- package/ci/cypress/plugin.js +13 -0
- package/ci/cypress/polyfills.js +25 -0
- package/ci/cypress/support.js +3 -0
- package/ci/init.js +86 -0
- package/esbuild.js +3 -0
- package/ext/exporters.d.ts +14 -0
- package/ext/exporters.js +13 -0
- package/ext/formats.d.ts +11 -0
- package/ext/formats.js +9 -0
- package/ext/index.d.ts +8 -0
- package/ext/index.js +17 -0
- package/ext/kinds.d.ts +9 -0
- package/ext/kinds.js +9 -0
- package/ext/priority.d.ts +8 -0
- package/ext/priority.js +8 -0
- package/ext/scopes.d.ts +9 -0
- package/ext/scopes.js +9 -0
- package/ext/tags.d.ts +26 -0
- package/ext/tags.js +40 -0
- package/ext/types.d.ts +7 -0
- package/ext/types.js +7 -0
- package/index.d.ts +3811 -0
- package/index.js +3 -0
- package/init.js +7 -0
- package/initialize.mjs +85 -0
- package/loader-hook.mjs +77 -0
- package/package.json +215 -0
- package/packages/datadog-code-origin/index.js +66 -0
- package/packages/datadog-core/index.js +5 -0
- package/packages/datadog-core/src/storage.js +132 -0
- package/packages/datadog-core/src/utils/src/kebabcase.js +14 -0
- package/packages/datadog-core/src/utils/src/parse-tags.js +33 -0
- package/packages/datadog-core/src/utils/src/pick.js +11 -0
- package/packages/datadog-core/src/utils/src/set.js +18 -0
- package/packages/datadog-core/src/utils/src/uniq.js +5 -0
- package/packages/datadog-esbuild/index.js +403 -0
- package/packages/datadog-esbuild/src/log.js +32 -0
- package/packages/datadog-esbuild/src/utils.js +218 -0
- package/packages/datadog-instrumentations/index.js +5 -0
- package/packages/datadog-instrumentations/src/aerospike.js +48 -0
- package/packages/datadog-instrumentations/src/ai.js +119 -0
- package/packages/datadog-instrumentations/src/amqp10.js +73 -0
- package/packages/datadog-instrumentations/src/amqplib.js +146 -0
- package/packages/datadog-instrumentations/src/anthropic.js +127 -0
- package/packages/datadog-instrumentations/src/apollo-server-core.js +40 -0
- package/packages/datadog-instrumentations/src/apollo-server.js +135 -0
- package/packages/datadog-instrumentations/src/apollo.js +101 -0
- package/packages/datadog-instrumentations/src/avsc.js +39 -0
- package/packages/datadog-instrumentations/src/aws-sdk.js +264 -0
- package/packages/datadog-instrumentations/src/azure-durable-functions.js +75 -0
- package/packages/datadog-instrumentations/src/azure-event-hubs.js +38 -0
- package/packages/datadog-instrumentations/src/azure-functions.js +56 -0
- package/packages/datadog-instrumentations/src/azure-service-bus.js +71 -0
- package/packages/datadog-instrumentations/src/bluebird.js +26 -0
- package/packages/datadog-instrumentations/src/body-parser.js +44 -0
- package/packages/datadog-instrumentations/src/bullmq.js +11 -0
- package/packages/datadog-instrumentations/src/bunyan.js +22 -0
- package/packages/datadog-instrumentations/src/cassandra-driver.js +179 -0
- package/packages/datadog-instrumentations/src/child_process.js +246 -0
- package/packages/datadog-instrumentations/src/confluentinc-kafka-javascript.js +421 -0
- package/packages/datadog-instrumentations/src/connect.js +118 -0
- package/packages/datadog-instrumentations/src/cookie-parser.js +36 -0
- package/packages/datadog-instrumentations/src/cookie.js +21 -0
- package/packages/datadog-instrumentations/src/couchbase.js +324 -0
- package/packages/datadog-instrumentations/src/crypto.js +33 -0
- package/packages/datadog-instrumentations/src/cucumber.js +1096 -0
- package/packages/datadog-instrumentations/src/cypress.js +11 -0
- package/packages/datadog-instrumentations/src/dd-trace-api.js +7 -0
- package/packages/datadog-instrumentations/src/dns.js +98 -0
- package/packages/datadog-instrumentations/src/elasticsearch.js +129 -0
- package/packages/datadog-instrumentations/src/express-mongo-sanitize.js +45 -0
- package/packages/datadog-instrumentations/src/express-session.js +41 -0
- package/packages/datadog-instrumentations/src/express.js +253 -0
- package/packages/datadog-instrumentations/src/fastify.js +300 -0
- package/packages/datadog-instrumentations/src/fetch.js +33 -0
- package/packages/datadog-instrumentations/src/find-my-way.js +31 -0
- package/packages/datadog-instrumentations/src/fs.js +372 -0
- package/packages/datadog-instrumentations/src/generic-pool.js +48 -0
- package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +287 -0
- package/packages/datadog-instrumentations/src/google-cloud-vertexai.js +101 -0
- package/packages/datadog-instrumentations/src/google-genai.js +120 -0
- package/packages/datadog-instrumentations/src/graphql.js +382 -0
- package/packages/datadog-instrumentations/src/grpc/client.js +258 -0
- package/packages/datadog-instrumentations/src/grpc/server.js +154 -0
- package/packages/datadog-instrumentations/src/grpc/types.js +10 -0
- package/packages/datadog-instrumentations/src/grpc.js +4 -0
- package/packages/datadog-instrumentations/src/handlebars.js +40 -0
- package/packages/datadog-instrumentations/src/hapi.js +178 -0
- package/packages/datadog-instrumentations/src/helpers/bundler-register.js +68 -0
- package/packages/datadog-instrumentations/src/helpers/check-require-cache.js +103 -0
- package/packages/datadog-instrumentations/src/helpers/extract-package-and-module-path.js +42 -0
- package/packages/datadog-instrumentations/src/helpers/fetch.js +26 -0
- package/packages/datadog-instrumentations/src/helpers/hook.js +75 -0
- package/packages/datadog-instrumentations/src/helpers/hooks.js +151 -0
- package/packages/datadog-instrumentations/src/helpers/instrument.js +57 -0
- package/packages/datadog-instrumentations/src/helpers/instrumentations.js +8 -0
- package/packages/datadog-instrumentations/src/helpers/promise.js +29 -0
- package/packages/datadog-instrumentations/src/helpers/register.js +242 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +70 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/ai.js +103 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/bullmq.js +108 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +7 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/langchain.js +237 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/loader.js +9 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/loader.mjs +11 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/orchestrion/compiler.js +74 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/orchestrion/index.js +43 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/orchestrion/matcher.js +49 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/orchestrion/transformer.js +121 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/orchestrion/transforms.js +322 -0
- package/packages/datadog-instrumentations/src/helpers/router-helper.js +238 -0
- package/packages/datadog-instrumentations/src/helpers/shared-utils.js +9 -0
- package/packages/datadog-instrumentations/src/hono.js +150 -0
- package/packages/datadog-instrumentations/src/http/client.js +315 -0
- package/packages/datadog-instrumentations/src/http/server.js +223 -0
- package/packages/datadog-instrumentations/src/http.js +4 -0
- package/packages/datadog-instrumentations/src/http2/client.js +76 -0
- package/packages/datadog-instrumentations/src/http2/server.js +64 -0
- package/packages/datadog-instrumentations/src/http2.js +4 -0
- package/packages/datadog-instrumentations/src/ioredis.js +57 -0
- package/packages/datadog-instrumentations/src/iovalkey.js +47 -0
- package/packages/datadog-instrumentations/src/jest.js +1895 -0
- package/packages/datadog-instrumentations/src/kafkajs.js +266 -0
- package/packages/datadog-instrumentations/src/knex.js +86 -0
- package/packages/datadog-instrumentations/src/koa.js +173 -0
- package/packages/datadog-instrumentations/src/langchain.js +7 -0
- package/packages/datadog-instrumentations/src/ldapjs.js +101 -0
- package/packages/datadog-instrumentations/src/light-my-request.js +93 -0
- package/packages/datadog-instrumentations/src/limitd-client.js +22 -0
- package/packages/datadog-instrumentations/src/lodash.js +30 -0
- package/packages/datadog-instrumentations/src/mariadb.js +186 -0
- package/packages/datadog-instrumentations/src/memcached.js +45 -0
- package/packages/datadog-instrumentations/src/microgateway-core.js +69 -0
- package/packages/datadog-instrumentations/src/mocha/common.js +50 -0
- package/packages/datadog-instrumentations/src/mocha/main.js +753 -0
- package/packages/datadog-instrumentations/src/mocha/utils.js +526 -0
- package/packages/datadog-instrumentations/src/mocha/worker.js +104 -0
- package/packages/datadog-instrumentations/src/mocha.js +13 -0
- package/packages/datadog-instrumentations/src/moleculer/client.js +44 -0
- package/packages/datadog-instrumentations/src/moleculer/server.js +58 -0
- package/packages/datadog-instrumentations/src/moleculer.js +4 -0
- package/packages/datadog-instrumentations/src/mongodb-core.js +213 -0
- package/packages/datadog-instrumentations/src/mongodb.js +59 -0
- package/packages/datadog-instrumentations/src/mongoose.js +179 -0
- package/packages/datadog-instrumentations/src/mquery.js +65 -0
- package/packages/datadog-instrumentations/src/multer.js +37 -0
- package/packages/datadog-instrumentations/src/mysql.js +105 -0
- package/packages/datadog-instrumentations/src/mysql2.js +380 -0
- package/packages/datadog-instrumentations/src/net.js +143 -0
- package/packages/datadog-instrumentations/src/next.js +320 -0
- package/packages/datadog-instrumentations/src/node-serialize.js +22 -0
- package/packages/datadog-instrumentations/src/nyc.js +59 -0
- package/packages/datadog-instrumentations/src/openai.js +326 -0
- package/packages/datadog-instrumentations/src/opensearch.js +11 -0
- package/packages/datadog-instrumentations/src/oracledb.js +162 -0
- package/packages/datadog-instrumentations/src/orchestrion-config/index.js +86 -0
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +24 -0
- package/packages/datadog-instrumentations/src/passport-http.js +10 -0
- package/packages/datadog-instrumentations/src/passport-local.js +10 -0
- package/packages/datadog-instrumentations/src/passport-utils.js +61 -0
- package/packages/datadog-instrumentations/src/passport.js +45 -0
- package/packages/datadog-instrumentations/src/pg.js +201 -0
- package/packages/datadog-instrumentations/src/pino.js +117 -0
- package/packages/datadog-instrumentations/src/playwright.js +1383 -0
- package/packages/datadog-instrumentations/src/prisma.js +272 -0
- package/packages/datadog-instrumentations/src/process.js +29 -0
- package/packages/datadog-instrumentations/src/promise-js.js +15 -0
- package/packages/datadog-instrumentations/src/promise.js +14 -0
- package/packages/datadog-instrumentations/src/protobufjs.js +128 -0
- package/packages/datadog-instrumentations/src/pug.js +23 -0
- package/packages/datadog-instrumentations/src/q.js +21 -0
- package/packages/datadog-instrumentations/src/redis.js +161 -0
- package/packages/datadog-instrumentations/src/restify.js +89 -0
- package/packages/datadog-instrumentations/src/rhea.js +237 -0
- package/packages/datadog-instrumentations/src/router.js +326 -0
- package/packages/datadog-instrumentations/src/selenium.js +80 -0
- package/packages/datadog-instrumentations/src/sequelize.js +45 -0
- package/packages/datadog-instrumentations/src/sharedb.js +72 -0
- package/packages/datadog-instrumentations/src/stripe.js +92 -0
- package/packages/datadog-instrumentations/src/tedious.js +63 -0
- package/packages/datadog-instrumentations/src/undici.js +29 -0
- package/packages/datadog-instrumentations/src/url.js +80 -0
- package/packages/datadog-instrumentations/src/vitest.js +1116 -0
- package/packages/datadog-instrumentations/src/vm.js +49 -0
- package/packages/datadog-instrumentations/src/when.js +14 -0
- package/packages/datadog-instrumentations/src/winston.js +78 -0
- package/packages/datadog-instrumentations/src/ws.js +264 -0
- package/packages/datadog-plugin-aerospike/src/index.js +113 -0
- package/packages/datadog-plugin-ai/src/index.js +17 -0
- package/packages/datadog-plugin-ai/src/tracing.js +33 -0
- package/packages/datadog-plugin-ai/src/utils.js +28 -0
- package/packages/datadog-plugin-amqp10/src/consumer.js +34 -0
- package/packages/datadog-plugin-amqp10/src/index.js +17 -0
- package/packages/datadog-plugin-amqp10/src/producer.js +37 -0
- package/packages/datadog-plugin-amqp10/src/util.js +15 -0
- package/packages/datadog-plugin-amqplib/src/client.js +44 -0
- package/packages/datadog-plugin-amqplib/src/consumer.js +57 -0
- package/packages/datadog-plugin-amqplib/src/index.js +20 -0
- package/packages/datadog-plugin-amqplib/src/producer.js +63 -0
- package/packages/datadog-plugin-amqplib/src/util.js +14 -0
- package/packages/datadog-plugin-anthropic/src/index.js +17 -0
- package/packages/datadog-plugin-anthropic/src/tracing.js +30 -0
- package/packages/datadog-plugin-apollo/src/gateway/execute.js +18 -0
- package/packages/datadog-plugin-apollo/src/gateway/fetch.js +39 -0
- package/packages/datadog-plugin-apollo/src/gateway/index.js +36 -0
- package/packages/datadog-plugin-apollo/src/gateway/plan.js +18 -0
- package/packages/datadog-plugin-apollo/src/gateway/postprocessing.js +15 -0
- package/packages/datadog-plugin-apollo/src/gateway/request.js +122 -0
- package/packages/datadog-plugin-apollo/src/gateway/validate.js +23 -0
- package/packages/datadog-plugin-apollo/src/index.js +43 -0
- package/packages/datadog-plugin-avsc/src/index.js +11 -0
- package/packages/datadog-plugin-avsc/src/schema_iterator.js +176 -0
- package/packages/datadog-plugin-aws-sdk/src/base.js +335 -0
- package/packages/datadog-plugin-aws-sdk/src/index.js +26 -0
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/index.js +16 -0
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/tracing.js +31 -0
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +487 -0
- package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +19 -0
- package/packages/datadog-plugin-aws-sdk/src/services/default.js +7 -0
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +197 -0
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +53 -0
- package/packages/datadog-plugin-aws-sdk/src/services/index.js +16 -0
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +214 -0
- package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +67 -0
- package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +19 -0
- package/packages/datadog-plugin-aws-sdk/src/services/s3.js +55 -0
- package/packages/datadog-plugin-aws-sdk/src/services/sfn.js +7 -0
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +125 -0
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +298 -0
- package/packages/datadog-plugin-aws-sdk/src/services/states.js +7 -0
- package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +64 -0
- package/packages/datadog-plugin-aws-sdk/src/util.js +151 -0
- package/packages/datadog-plugin-azure-durable-functions/src/index.js +49 -0
- package/packages/datadog-plugin-azure-event-hubs/src/index.js +15 -0
- package/packages/datadog-plugin-azure-event-hubs/src/producer.js +96 -0
- package/packages/datadog-plugin-azure-functions/src/index.js +171 -0
- package/packages/datadog-plugin-azure-service-bus/src/index.js +15 -0
- package/packages/datadog-plugin-azure-service-bus/src/producer.js +97 -0
- package/packages/datadog-plugin-bullmq/src/consumer.js +82 -0
- package/packages/datadog-plugin-bullmq/src/index.js +18 -0
- package/packages/datadog-plugin-bullmq/src/producer.js +207 -0
- package/packages/datadog-plugin-bunyan/src/index.js +8 -0
- package/packages/datadog-plugin-cassandra-driver/src/index.js +47 -0
- package/packages/datadog-plugin-child_process/src/index.js +111 -0
- package/packages/datadog-plugin-child_process/src/scrub-cmd-params.js +127 -0
- package/packages/datadog-plugin-confluentinc-kafka-javascript/src/batch-consumer.js +9 -0
- package/packages/datadog-plugin-confluentinc-kafka-javascript/src/consumer.js +9 -0
- package/packages/datadog-plugin-confluentinc-kafka-javascript/src/index.js +25 -0
- package/packages/datadog-plugin-confluentinc-kafka-javascript/src/producer.js +9 -0
- package/packages/datadog-plugin-connect/src/index.js +17 -0
- package/packages/datadog-plugin-couchbase/src/index.js +94 -0
- package/packages/datadog-plugin-cucumber/src/index.js +461 -0
- package/packages/datadog-plugin-cypress/src/after-run.js +5 -0
- package/packages/datadog-plugin-cypress/src/after-spec.js +5 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +1089 -0
- package/packages/datadog-plugin-cypress/src/index.js +11 -0
- package/packages/datadog-plugin-cypress/src/plugin.js +57 -0
- package/packages/datadog-plugin-cypress/src/source-map-utils.js +297 -0
- package/packages/datadog-plugin-cypress/src/support.js +303 -0
- package/packages/datadog-plugin-dd-trace-api/src/index.js +117 -0
- package/packages/datadog-plugin-dns/src/index.js +23 -0
- package/packages/datadog-plugin-dns/src/lookup.js +45 -0
- package/packages/datadog-plugin-dns/src/lookup_service.js +28 -0
- package/packages/datadog-plugin-dns/src/resolve.js +27 -0
- package/packages/datadog-plugin-dns/src/reverse.js +25 -0
- package/packages/datadog-plugin-elasticsearch/src/index.js +49 -0
- package/packages/datadog-plugin-express/src/code_origin.js +47 -0
- package/packages/datadog-plugin-express/src/index.js +17 -0
- package/packages/datadog-plugin-express/src/tracing.js +17 -0
- package/packages/datadog-plugin-fastify/src/code_origin.js +41 -0
- package/packages/datadog-plugin-fastify/src/index.js +17 -0
- package/packages/datadog-plugin-fastify/src/tracing.js +34 -0
- package/packages/datadog-plugin-fetch/src/index.js +40 -0
- package/packages/datadog-plugin-find-my-way/src/index.js +18 -0
- package/packages/datadog-plugin-fs/src/index.js +52 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/client.js +39 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +212 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/index.js +19 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +191 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +217 -0
- package/packages/datadog-plugin-google-cloud-vertexai/src/index.js +17 -0
- package/packages/datadog-plugin-google-cloud-vertexai/src/tracing.js +49 -0
- package/packages/datadog-plugin-google-cloud-vertexai/src/utils.js +21 -0
- package/packages/datadog-plugin-google-genai/src/index.js +17 -0
- package/packages/datadog-plugin-google-genai/src/tracing.js +41 -0
- package/packages/datadog-plugin-graphql/src/execute.js +88 -0
- package/packages/datadog-plugin-graphql/src/index.js +72 -0
- package/packages/datadog-plugin-graphql/src/parse.js +35 -0
- package/packages/datadog-plugin-graphql/src/resolve.js +191 -0
- package/packages/datadog-plugin-graphql/src/tools/index.js +6 -0
- package/packages/datadog-plugin-graphql/src/tools/signature.js +9 -0
- package/packages/datadog-plugin-graphql/src/tools/transforms.js +108 -0
- package/packages/datadog-plugin-graphql/src/utils.js +49 -0
- package/packages/datadog-plugin-graphql/src/validate.js +40 -0
- package/packages/datadog-plugin-grpc/src/client.js +129 -0
- package/packages/datadog-plugin-grpc/src/index.js +17 -0
- package/packages/datadog-plugin-grpc/src/server.js +112 -0
- package/packages/datadog-plugin-grpc/src/util.js +66 -0
- package/packages/datadog-plugin-hapi/src/index.js +39 -0
- package/packages/datadog-plugin-hono/src/index.js +26 -0
- package/packages/datadog-plugin-http/src/client.js +244 -0
- package/packages/datadog-plugin-http/src/index.js +37 -0
- package/packages/datadog-plugin-http/src/server.js +92 -0
- package/packages/datadog-plugin-http2/src/client.js +217 -0
- package/packages/datadog-plugin-http2/src/index.js +17 -0
- package/packages/datadog-plugin-http2/src/server.js +73 -0
- package/packages/datadog-plugin-ioredis/src/index.js +9 -0
- package/packages/datadog-plugin-iovalkey/src/index.js +16 -0
- package/packages/datadog-plugin-jest/src/index.js +558 -0
- package/packages/datadog-plugin-jest/src/util.js +176 -0
- package/packages/datadog-plugin-kafkajs/src/batch-consumer.js +28 -0
- package/packages/datadog-plugin-kafkajs/src/consumer.js +128 -0
- package/packages/datadog-plugin-kafkajs/src/index.js +19 -0
- package/packages/datadog-plugin-kafkajs/src/producer.js +129 -0
- package/packages/datadog-plugin-kafkajs/src/utils.js +27 -0
- package/packages/datadog-plugin-koa/src/index.js +22 -0
- package/packages/datadog-plugin-langchain/src/handlers/default.js +11 -0
- package/packages/datadog-plugin-langchain/src/handlers/embedding.js +18 -0
- package/packages/datadog-plugin-langchain/src/handlers/language_models.js +18 -0
- package/packages/datadog-plugin-langchain/src/index.js +26 -0
- package/packages/datadog-plugin-langchain/src/tokens.js +35 -0
- package/packages/datadog-plugin-langchain/src/tracing.js +155 -0
- package/packages/datadog-plugin-mariadb/src/index.js +21 -0
- package/packages/datadog-plugin-memcached/src/index.js +54 -0
- package/packages/datadog-plugin-microgateway-core/src/index.js +26 -0
- package/packages/datadog-plugin-mocha/src/index.js +480 -0
- package/packages/datadog-plugin-moleculer/src/client.js +42 -0
- package/packages/datadog-plugin-moleculer/src/index.js +19 -0
- package/packages/datadog-plugin-moleculer/src/server.js +30 -0
- package/packages/datadog-plugin-moleculer/src/util.js +21 -0
- package/packages/datadog-plugin-mongodb-core/src/index.js +215 -0
- package/packages/datadog-plugin-mongoose/src/index.js +20 -0
- package/packages/datadog-plugin-mysql/src/index.js +42 -0
- package/packages/datadog-plugin-mysql2/src/index.js +25 -0
- package/packages/datadog-plugin-net/src/index.js +23 -0
- package/packages/datadog-plugin-net/src/ipc.js +23 -0
- package/packages/datadog-plugin-net/src/tcp.js +53 -0
- package/packages/datadog-plugin-next/src/index.js +155 -0
- package/packages/datadog-plugin-nyc/src/index.js +95 -0
- package/packages/datadog-plugin-openai/src/index.js +17 -0
- package/packages/datadog-plugin-openai/src/services.js +48 -0
- package/packages/datadog-plugin-openai/src/stream-helpers.js +159 -0
- package/packages/datadog-plugin-openai/src/token-estimator.js +20 -0
- package/packages/datadog-plugin-openai/src/tracing.js +723 -0
- package/packages/datadog-plugin-opensearch/src/index.js +9 -0
- package/packages/datadog-plugin-oracledb/src/connection-parser.js +37 -0
- package/packages/datadog-plugin-oracledb/src/index.js +44 -0
- package/packages/datadog-plugin-pg/src/index.js +41 -0
- package/packages/datadog-plugin-pino/src/index.js +9 -0
- package/packages/datadog-plugin-playwright/src/index.js +497 -0
- package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +118 -0
- package/packages/datadog-plugin-prisma/src/index.js +144 -0
- package/packages/datadog-plugin-protobufjs/src/index.js +12 -0
- package/packages/datadog-plugin-protobufjs/src/schema_iterator.js +181 -0
- package/packages/datadog-plugin-redis/src/index.js +95 -0
- package/packages/datadog-plugin-restify/src/index.js +29 -0
- package/packages/datadog-plugin-rhea/src/consumer.js +68 -0
- package/packages/datadog-plugin-rhea/src/index.js +17 -0
- package/packages/datadog-plugin-rhea/src/producer.js +54 -0
- package/packages/datadog-plugin-router/src/index.js +170 -0
- package/packages/datadog-plugin-selenium/src/index.js +66 -0
- package/packages/datadog-plugin-sharedb/src/index.js +68 -0
- package/packages/datadog-plugin-tedious/src/index.js +36 -0
- package/packages/datadog-plugin-undici/src/index.js +313 -0
- package/packages/datadog-plugin-vitest/src/index.js +444 -0
- package/packages/datadog-plugin-web/src/index.js +18 -0
- package/packages/datadog-plugin-winston/src/index.js +8 -0
- package/packages/datadog-plugin-ws/src/close.js +121 -0
- package/packages/datadog-plugin-ws/src/index.js +30 -0
- package/packages/datadog-plugin-ws/src/producer.js +99 -0
- package/packages/datadog-plugin-ws/src/receiver.js +110 -0
- package/packages/datadog-plugin-ws/src/server.js +106 -0
- package/packages/datadog-plugin-ws/src/util.js +139 -0
- package/packages/datadog-shimmer/index.js +3 -0
- package/packages/datadog-shimmer/src/shimmer.js +279 -0
- package/packages/dd-trace/index.js +36 -0
- package/packages/dd-trace/src/agent/info.js +57 -0
- package/packages/dd-trace/src/agent/url.js +28 -0
- package/packages/dd-trace/src/aiguard/client.js +25 -0
- package/packages/dd-trace/src/aiguard/noop.js +9 -0
- package/packages/dd-trace/src/aiguard/sdk.js +223 -0
- package/packages/dd-trace/src/aiguard/tags.js +14 -0
- package/packages/dd-trace/src/analytics_sampler.js +15 -0
- package/packages/dd-trace/src/appsec/activation.js +29 -0
- package/packages/dd-trace/src/appsec/addresses.js +51 -0
- package/packages/dd-trace/src/appsec/api_security_sampler.js +117 -0
- package/packages/dd-trace/src/appsec/blocked_templates.js +14 -0
- package/packages/dd-trace/src/appsec/blocking.js +196 -0
- package/packages/dd-trace/src/appsec/channels.js +50 -0
- package/packages/dd-trace/src/appsec/downstream_requests.js +302 -0
- package/packages/dd-trace/src/appsec/graphql.js +166 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/analyzers.js +24 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/code-injection-analyzer.js +36 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/command-injection-analyzer.js +15 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/cookie-analyzer.js +62 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-base-analyzer.js +72 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-password-analyzer.js +18 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-password-rules.js +11 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-rule-type.js +6 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secret-analyzer.js +15 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secret-rules.js +741 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/hsts-header-missing-analyzer.js +44 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/index.js +23 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/injection-analyzer.js +42 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/insecure-cookie-analyzer.js +12 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/ldap-injection-analyzer.js +22 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/missing-header-analyzer.js +82 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/no-httponly-cookie-analyzer.js +12 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/no-samesite-cookie-analyzer.js +12 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +192 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/path-traversal-analyzer.js +108 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/set-cookies-header-interceptor.js +58 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/sql-injection-analyzer.js +102 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/ssrf-analyzer.js +37 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/stored-injection-analyzer.js +11 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/template-injection-analyzer.js +18 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/untrusted-deserialization-analyzer.js +16 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/unvalidated-redirect-analyzer.js +64 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/vulnerability-analyzer.js +181 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/weak-cipher-analyzer.js +31 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/weak-hash-analyzer.js +64 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/weak-randomness-analyzer.js +19 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/xcontenttype-header-missing-analyzer.js +19 -0
- package/packages/dd-trace/src/appsec/iast/context/context-plugin.js +89 -0
- package/packages/dd-trace/src/appsec/iast/context/kafka-ctx-plugin.js +14 -0
- package/packages/dd-trace/src/appsec/iast/iast-context.js +75 -0
- package/packages/dd-trace/src/appsec/iast/iast-plugin.js +230 -0
- package/packages/dd-trace/src/appsec/iast/index.js +126 -0
- package/packages/dd-trace/src/appsec/iast/overhead-controller.js +209 -0
- package/packages/dd-trace/src/appsec/iast/path-line.js +116 -0
- package/packages/dd-trace/src/appsec/iast/security-controls/index.js +179 -0
- package/packages/dd-trace/src/appsec/iast/security-controls/parser.js +128 -0
- package/packages/dd-trace/src/appsec/iast/tags.js +7 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/constants.js +6 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/csi-methods.js +24 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/filter.js +16 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +36 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/operations-taint-object.js +88 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/operations.js +108 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +293 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugins/kafka.js +46 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter-esm.mjs +76 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter-telemetry.js +13 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +266 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/secure-marks-generator.js +13 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/secure-marks.js +30 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/source-types.js +15 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +258 -0
- package/packages/dd-trace/src/appsec/iast/telemetry/iast-metric.js +113 -0
- package/packages/dd-trace/src/appsec/iast/telemetry/index.js +41 -0
- package/packages/dd-trace/src/appsec/iast/telemetry/namespaces.js +112 -0
- package/packages/dd-trace/src/appsec/iast/telemetry/span-tags.js +54 -0
- package/packages/dd-trace/src/appsec/iast/telemetry/verbosity.js +41 -0
- package/packages/dd-trace/src/appsec/iast/utils.js +24 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/constants.js +7 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/range-utils.js +36 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/command-sensitive-analyzer.js +22 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/hardcoded-password-analyzer.js +13 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/json-sensitive-analyzer.js +12 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/ldap-sensitive-analyzer.js +28 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +112 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/tainted-range-based-sensitive-analyzer.js +25 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/url-sensitive-analyzer.js +40 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +294 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/index.js +126 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +168 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities.js +24 -0
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +169 -0
- package/packages/dd-trace/src/appsec/index.js +560 -0
- package/packages/dd-trace/src/appsec/rasp/command_injection.js +56 -0
- package/packages/dd-trace/src/appsec/rasp/fs-plugin.js +103 -0
- package/packages/dd-trace/src/appsec/rasp/index.js +140 -0
- package/packages/dd-trace/src/appsec/rasp/lfi.js +129 -0
- package/packages/dd-trace/src/appsec/rasp/sql_injection.js +108 -0
- package/packages/dd-trace/src/appsec/rasp/ssrf.js +102 -0
- package/packages/dd-trace/src/appsec/rasp/utils.js +85 -0
- package/packages/dd-trace/src/appsec/rc-products.js +10 -0
- package/packages/dd-trace/src/appsec/recommended.json +10731 -0
- package/packages/dd-trace/src/appsec/remote_config.js +177 -0
- package/packages/dd-trace/src/appsec/reporter.js +599 -0
- package/packages/dd-trace/src/appsec/rule_manager.js +168 -0
- package/packages/dd-trace/src/appsec/sdk/index.js +63 -0
- package/packages/dd-trace/src/appsec/sdk/noop.js +27 -0
- package/packages/dd-trace/src/appsec/sdk/set_user.js +44 -0
- package/packages/dd-trace/src/appsec/sdk/track_event.js +230 -0
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +60 -0
- package/packages/dd-trace/src/appsec/sdk/utils.js +29 -0
- package/packages/dd-trace/src/appsec/stack_trace.js +117 -0
- package/packages/dd-trace/src/appsec/telemetry/common.js +28 -0
- package/packages/dd-trace/src/appsec/telemetry/index.js +184 -0
- package/packages/dd-trace/src/appsec/telemetry/rasp.js +103 -0
- package/packages/dd-trace/src/appsec/telemetry/user.js +32 -0
- package/packages/dd-trace/src/appsec/telemetry/waf.js +143 -0
- package/packages/dd-trace/src/appsec/user_tracking.js +190 -0
- package/packages/dd-trace/src/appsec/waf/diagnostics.js +15 -0
- package/packages/dd-trace/src/appsec/waf/index.js +149 -0
- package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +188 -0
- package/packages/dd-trace/src/appsec/waf/waf_manager.js +98 -0
- package/packages/dd-trace/src/azure_metadata.js +137 -0
- package/packages/dd-trace/src/baggage.js +72 -0
- package/packages/dd-trace/src/ci-visibility/coverage-report-discovery.js +82 -0
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +159 -0
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +156 -0
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +111 -0
- package/packages/dd-trace/src/ci-visibility/encode/json-encoder.js +27 -0
- package/packages/dd-trace/src/ci-visibility/exporters/agent-proxy/index.js +104 -0
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +78 -0
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +56 -0
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/index.js +52 -0
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +83 -0
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +420 -0
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +317 -0
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +114 -0
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/writer.js +76 -0
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +120 -0
- package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +54 -0
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +156 -0
- package/packages/dd-trace/src/ci-visibility/requests/request.js +236 -0
- package/packages/dd-trace/src/ci-visibility/requests/upload-coverage-report.js +107 -0
- package/packages/dd-trace/src/ci-visibility/telemetry.js +204 -0
- package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +63 -0
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +121 -0
- package/packages/dd-trace/src/ci-visibility/test-optimization-cache.js +61 -0
- package/packages/dd-trace/src/config/defaults.js +174 -0
- package/packages/dd-trace/src/config/git_properties.js +120 -0
- package/packages/dd-trace/src/config/helper.js +214 -0
- package/packages/dd-trace/src/config/index.js +1676 -0
- package/packages/dd-trace/src/config/remote_config.js +203 -0
- package/packages/dd-trace/src/config/stable.js +93 -0
- package/packages/dd-trace/src/config/supported-configurations.json +4136 -0
- package/packages/dd-trace/src/constants.js +61 -0
- package/packages/dd-trace/src/crashtracking/crashtracker.js +120 -0
- package/packages/dd-trace/src/crashtracking/index.js +15 -0
- package/packages/dd-trace/src/crashtracking/noop.js +11 -0
- package/packages/dd-trace/src/datastreams/checkpointer.js +80 -0
- package/packages/dd-trace/src/datastreams/context.js +20 -0
- package/packages/dd-trace/src/datastreams/encoding.js +99 -0
- package/packages/dd-trace/src/datastreams/fnv.js +25 -0
- package/packages/dd-trace/src/datastreams/index.js +129 -0
- package/packages/dd-trace/src/datastreams/manager.js +36 -0
- package/packages/dd-trace/src/datastreams/pathway.js +187 -0
- package/packages/dd-trace/src/datastreams/processor.js +494 -0
- package/packages/dd-trace/src/datastreams/schemas/schema.js +10 -0
- package/packages/dd-trace/src/datastreams/schemas/schema_builder.js +140 -0
- package/packages/dd-trace/src/datastreams/schemas/schema_sampler.js +27 -0
- package/packages/dd-trace/src/datastreams/size.js +53 -0
- package/packages/dd-trace/src/datastreams/writer.js +70 -0
- package/packages/dd-trace/src/debugger/config.js +18 -0
- package/packages/dd-trace/src/debugger/constants.js +7 -0
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +320 -0
- package/packages/dd-trace/src/debugger/devtools_client/condition.js +294 -0
- package/packages/dd-trace/src/debugger/devtools_client/config.js +23 -0
- package/packages/dd-trace/src/debugger/devtools_client/defaults.js +7 -0
- package/packages/dd-trace/src/debugger/devtools_client/index.js +336 -0
- package/packages/dd-trace/src/debugger/devtools_client/inspector_promises_polyfill.js +27 -0
- package/packages/dd-trace/src/debugger/devtools_client/json-buffer.js +41 -0
- package/packages/dd-trace/src/debugger/devtools_client/log.js +30 -0
- package/packages/dd-trace/src/debugger/devtools_client/remote_config.js +106 -0
- package/packages/dd-trace/src/debugger/devtools_client/send.js +138 -0
- package/packages/dd-trace/src/debugger/devtools_client/session.js +17 -0
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/collector.js +336 -0
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/constants.js +25 -0
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +215 -0
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +349 -0
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/redaction.js +112 -0
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/symbols.js +8 -0
- package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +404 -0
- package/packages/dd-trace/src/debugger/devtools_client/source-maps.js +72 -0
- package/packages/dd-trace/src/debugger/devtools_client/state.js +238 -0
- package/packages/dd-trace/src/debugger/devtools_client/status.js +123 -0
- package/packages/dd-trace/src/debugger/index.js +259 -0
- package/packages/dd-trace/src/dogstatsd.js +412 -0
- package/packages/dd-trace/src/encode/0.4.js +425 -0
- package/packages/dd-trace/src/encode/0.5.js +77 -0
- package/packages/dd-trace/src/encode/agentless-ci-visibility.js +361 -0
- package/packages/dd-trace/src/encode/agentless-json.js +200 -0
- package/packages/dd-trace/src/encode/coverage-ci-visibility.js +131 -0
- package/packages/dd-trace/src/encode/span-stats.js +136 -0
- package/packages/dd-trace/src/encode/tags-processors.js +91 -0
- package/packages/dd-trace/src/exporter.js +32 -0
- package/packages/dd-trace/src/exporters/agent/index.js +65 -0
- package/packages/dd-trace/src/exporters/agent/writer.js +110 -0
- package/packages/dd-trace/src/exporters/agentless/index.js +132 -0
- package/packages/dd-trace/src/exporters/agentless/writer.js +201 -0
- package/packages/dd-trace/src/exporters/common/agents.js +42 -0
- package/packages/dd-trace/src/exporters/common/buffering-exporter.js +62 -0
- package/packages/dd-trace/src/exporters/common/docker.js +52 -0
- package/packages/dd-trace/src/exporters/common/form-data.js +59 -0
- package/packages/dd-trace/src/exporters/common/request.js +190 -0
- package/packages/dd-trace/src/exporters/common/url-to-http-options-polyfill.js +31 -0
- package/packages/dd-trace/src/exporters/common/util.js +13 -0
- package/packages/dd-trace/src/exporters/common/writer.js +49 -0
- package/packages/dd-trace/src/exporters/log/index.js +52 -0
- package/packages/dd-trace/src/exporters/span-stats/index.js +20 -0
- package/packages/dd-trace/src/exporters/span-stats/writer.js +54 -0
- package/packages/dd-trace/src/external-logger/src/index.js +139 -0
- package/packages/dd-trace/src/flare/file.js +40 -0
- package/packages/dd-trace/src/flare/index.js +101 -0
- package/packages/dd-trace/src/git_metadata_tagger.js +19 -0
- package/packages/dd-trace/src/guardrails/index.js +76 -0
- package/packages/dd-trace/src/guardrails/log.js +32 -0
- package/packages/dd-trace/src/guardrails/telemetry.js +92 -0
- package/packages/dd-trace/src/guardrails/util.js +8 -0
- package/packages/dd-trace/src/heap_snapshots.js +58 -0
- package/packages/dd-trace/src/histogram.js +35 -0
- package/packages/dd-trace/src/id.js +247 -0
- package/packages/dd-trace/src/iitm.js +15 -0
- package/packages/dd-trace/src/index.js +15 -0
- package/packages/dd-trace/src/lambda/context.js +27 -0
- package/packages/dd-trace/src/lambda/handler.js +87 -0
- package/packages/dd-trace/src/lambda/index.js +17 -0
- package/packages/dd-trace/src/lambda/runtime/errors.js +20 -0
- package/packages/dd-trace/src/lambda/runtime/patch.js +77 -0
- package/packages/dd-trace/src/lambda/runtime/ritm.js +133 -0
- package/packages/dd-trace/src/llmobs/constants/tags.js +55 -0
- package/packages/dd-trace/src/llmobs/constants/text.js +6 -0
- package/packages/dd-trace/src/llmobs/constants/writers.js +17 -0
- package/packages/dd-trace/src/llmobs/index.js +149 -0
- package/packages/dd-trace/src/llmobs/noop.js +88 -0
- package/packages/dd-trace/src/llmobs/plugins/ai/index.js +399 -0
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +218 -0
- package/packages/dd-trace/src/llmobs/plugins/anthropic.js +288 -0
- package/packages/dd-trace/src/llmobs/plugins/base.js +96 -0
- package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +137 -0
- package/packages/dd-trace/src/llmobs/plugins/genai/index.js +104 -0
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +486 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chain.js +20 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chat_model.js +111 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/embedding.js +42 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/index.js +106 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/llm.js +32 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/tool.js +15 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/vectorstore.js +36 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/index.js +214 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/constants.js +16 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/index.js +501 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +126 -0
- package/packages/dd-trace/src/llmobs/plugins/vertexai.js +195 -0
- package/packages/dd-trace/src/llmobs/sdk.js +578 -0
- package/packages/dd-trace/src/llmobs/span_processor.js +311 -0
- package/packages/dd-trace/src/llmobs/storage.js +6 -0
- package/packages/dd-trace/src/llmobs/tagger.js +648 -0
- package/packages/dd-trace/src/llmobs/telemetry.js +174 -0
- package/packages/dd-trace/src/llmobs/util.js +182 -0
- package/packages/dd-trace/src/llmobs/writers/base.js +242 -0
- package/packages/dd-trace/src/llmobs/writers/evaluations.js +32 -0
- package/packages/dd-trace/src/llmobs/writers/spans.js +69 -0
- package/packages/dd-trace/src/llmobs/writers/util.js +54 -0
- package/packages/dd-trace/src/log/channels.js +78 -0
- package/packages/dd-trace/src/log/index.js +157 -0
- package/packages/dd-trace/src/log/log.js +76 -0
- package/packages/dd-trace/src/log/utils.js +16 -0
- package/packages/dd-trace/src/log/writer.js +72 -0
- package/packages/dd-trace/src/msgpack/chunk.js +69 -0
- package/packages/dd-trace/src/msgpack/encoder.js +308 -0
- package/packages/dd-trace/src/msgpack/index.js +6 -0
- package/packages/dd-trace/src/noop/dogstatsd.js +19 -0
- package/packages/dd-trace/src/noop/proxy.js +106 -0
- package/packages/dd-trace/src/noop/scope.js +19 -0
- package/packages/dd-trace/src/noop/span.js +50 -0
- package/packages/dd-trace/src/noop/span_context.js +16 -0
- package/packages/dd-trace/src/noop/tracer.js +47 -0
- package/packages/dd-trace/src/openfeature/constants/constants.js +51 -0
- package/packages/dd-trace/src/openfeature/flagging_provider.js +47 -0
- package/packages/dd-trace/src/openfeature/index.js +77 -0
- package/packages/dd-trace/src/openfeature/noop.js +101 -0
- package/packages/dd-trace/src/openfeature/remote_config.js +31 -0
- package/packages/dd-trace/src/openfeature/writers/base.js +174 -0
- package/packages/dd-trace/src/openfeature/writers/exposures.js +173 -0
- package/packages/dd-trace/src/openfeature/writers/util.js +38 -0
- package/packages/dd-trace/src/opentelemetry/context_manager.js +91 -0
- package/packages/dd-trace/src/opentelemetry/logs/batch_log_processor.js +100 -0
- package/packages/dd-trace/src/opentelemetry/logs/index.js +87 -0
- package/packages/dd-trace/src/opentelemetry/logs/logger.js +83 -0
- package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +126 -0
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +55 -0
- package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +245 -0
- package/packages/dd-trace/src/opentelemetry/metrics/constants.js +34 -0
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +81 -0
- package/packages/dd-trace/src/opentelemetry/metrics/instruments.js +225 -0
- package/packages/dd-trace/src/opentelemetry/metrics/meter.js +171 -0
- package/packages/dd-trace/src/opentelemetry/metrics/meter_provider.js +54 -0
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +62 -0
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_transformer.js +251 -0
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +557 -0
- package/packages/dd-trace/src/opentelemetry/otlp/common.proto +116 -0
- package/packages/dd-trace/src/opentelemetry/otlp/logs.proto +226 -0
- package/packages/dd-trace/src/opentelemetry/otlp/logs_service.proto +78 -0
- package/packages/dd-trace/src/opentelemetry/otlp/metrics.proto +720 -0
- package/packages/dd-trace/src/opentelemetry/otlp/metrics_service.proto +78 -0
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +168 -0
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +181 -0
- package/packages/dd-trace/src/opentelemetry/otlp/protobuf_loader.js +66 -0
- package/packages/dd-trace/src/opentelemetry/otlp/resource.proto +45 -0
- package/packages/dd-trace/src/opentelemetry/sampler.js +18 -0
- package/packages/dd-trace/src/opentelemetry/span.js +317 -0
- package/packages/dd-trace/src/opentelemetry/span_context.js +44 -0
- package/packages/dd-trace/src/opentelemetry/span_processor.js +50 -0
- package/packages/dd-trace/src/opentelemetry/tracer.js +226 -0
- package/packages/dd-trace/src/opentelemetry/tracer_provider.js +80 -0
- package/packages/dd-trace/src/opentracing/propagation/binary.js +11 -0
- package/packages/dd-trace/src/opentracing/propagation/http.js +7 -0
- package/packages/dd-trace/src/opentracing/propagation/log.js +54 -0
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +818 -0
- package/packages/dd-trace/src/opentracing/propagation/text_map_dsm.js +47 -0
- package/packages/dd-trace/src/opentracing/propagation/tracestate.js +103 -0
- package/packages/dd-trace/src/opentracing/span.js +412 -0
- package/packages/dd-trace/src/opentracing/span_context.js +75 -0
- package/packages/dd-trace/src/opentracing/tracer.js +145 -0
- package/packages/dd-trace/src/payload-tagging/config/aws.json +106 -0
- package/packages/dd-trace/src/payload-tagging/config/index.js +44 -0
- package/packages/dd-trace/src/payload-tagging/index.js +110 -0
- package/packages/dd-trace/src/payload-tagging/tagging.js +94 -0
- package/packages/dd-trace/src/pkg.js +44 -0
- package/packages/dd-trace/src/plugin_manager.js +219 -0
- package/packages/dd-trace/src/plugins/apollo.js +59 -0
- package/packages/dd-trace/src/plugins/cache.js +16 -0
- package/packages/dd-trace/src/plugins/ci_plugin.js +786 -0
- package/packages/dd-trace/src/plugins/client.js +11 -0
- package/packages/dd-trace/src/plugins/composite.js +29 -0
- package/packages/dd-trace/src/plugins/consumer.js +21 -0
- package/packages/dd-trace/src/plugins/database.js +123 -0
- package/packages/dd-trace/src/plugins/inbound.js +11 -0
- package/packages/dd-trace/src/plugins/index.js +117 -0
- package/packages/dd-trace/src/plugins/log_plugin.js +54 -0
- package/packages/dd-trace/src/plugins/outbound.js +159 -0
- package/packages/dd-trace/src/plugins/plugin.js +195 -0
- package/packages/dd-trace/src/plugins/producer.js +27 -0
- package/packages/dd-trace/src/plugins/schema.js +35 -0
- package/packages/dd-trace/src/plugins/server.js +11 -0
- package/packages/dd-trace/src/plugins/storage.js +23 -0
- package/packages/dd-trace/src/plugins/structured_log_plugin.js +9 -0
- package/packages/dd-trace/src/plugins/tracing.js +222 -0
- package/packages/dd-trace/src/plugins/util/ci.js +843 -0
- package/packages/dd-trace/src/plugins/util/env.js +31 -0
- package/packages/dd-trace/src/plugins/util/git-cache.js +129 -0
- package/packages/dd-trace/src/plugins/util/git.js +613 -0
- package/packages/dd-trace/src/plugins/util/inferred_proxy.js +157 -0
- package/packages/dd-trace/src/plugins/util/ip_extractor.js +139 -0
- package/packages/dd-trace/src/plugins/util/llm.js +54 -0
- package/packages/dd-trace/src/plugins/util/stacktrace.js +244 -0
- package/packages/dd-trace/src/plugins/util/tags.js +81 -0
- package/packages/dd-trace/src/plugins/util/test.js +1202 -0
- package/packages/dd-trace/src/plugins/util/url.js +146 -0
- package/packages/dd-trace/src/plugins/util/urlfilter.js +32 -0
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +91 -0
- package/packages/dd-trace/src/plugins/util/web.js +631 -0
- package/packages/dd-trace/src/priority_sampler.js +374 -0
- package/packages/dd-trace/src/process-tags/index.js +83 -0
- package/packages/dd-trace/src/profiler.js +17 -0
- package/packages/dd-trace/src/profiling/config.js +473 -0
- package/packages/dd-trace/src/profiling/constants.js +15 -0
- package/packages/dd-trace/src/profiling/exporter_cli.js +74 -0
- package/packages/dd-trace/src/profiling/exporters/agent.js +199 -0
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +91 -0
- package/packages/dd-trace/src/profiling/exporters/file.js +35 -0
- package/packages/dd-trace/src/profiling/index.js +20 -0
- package/packages/dd-trace/src/profiling/libuv-size.js +49 -0
- package/packages/dd-trace/src/profiling/loggers/console.js +41 -0
- package/packages/dd-trace/src/profiling/profiler.js +430 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/dns.js +11 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_lookup.js +16 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_lookupservice.js +16 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_resolve.js +24 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_reverse.js +16 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/event.js +66 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/fs.js +45 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/net.js +20 -0
- package/packages/dd-trace/src/profiling/profilers/events.js +466 -0
- package/packages/dd-trace/src/profiling/profilers/poisson.js +105 -0
- package/packages/dd-trace/src/profiling/profilers/shared.js +55 -0
- package/packages/dd-trace/src/profiling/profilers/space.js +77 -0
- package/packages/dd-trace/src/profiling/profilers/wall.js +434 -0
- package/packages/dd-trace/src/profiling/ssi-heuristics.js +84 -0
- package/packages/dd-trace/src/profiling/tagger.js +40 -0
- package/packages/dd-trace/src/profiling/webspan-utils.js +25 -0
- package/packages/dd-trace/src/propagation-hash/index.js +145 -0
- package/packages/dd-trace/src/proxy.js +351 -0
- package/packages/dd-trace/src/random_sampler.js +40 -0
- package/packages/dd-trace/src/rate_limiter.js +82 -0
- package/packages/dd-trace/src/remote_config/apply_states.js +7 -0
- package/packages/dd-trace/src/remote_config/capabilities.js +47 -0
- package/packages/dd-trace/src/remote_config/index.js +574 -0
- package/packages/dd-trace/src/remote_config/scheduler.js +30 -0
- package/packages/dd-trace/src/require-package-json.js +33 -0
- package/packages/dd-trace/src/ritm.js +211 -0
- package/packages/dd-trace/src/runtime_metrics/index.js +34 -0
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +373 -0
- package/packages/dd-trace/src/sampler.js +63 -0
- package/packages/dd-trace/src/sampling_rule.js +267 -0
- package/packages/dd-trace/src/scope.js +63 -0
- package/packages/dd-trace/src/serverless.js +52 -0
- package/packages/dd-trace/src/service-naming/extra-services.js +24 -0
- package/packages/dd-trace/src/service-naming/index.js +75 -0
- package/packages/dd-trace/src/service-naming/schemas/definition.js +19 -0
- package/packages/dd-trace/src/service-naming/schemas/util.js +25 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/graphql.js +14 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/index.js +11 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +102 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/serverless.js +18 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +118 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/web.js +92 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/websocket.js +30 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/graphql.js +14 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/index.js +11 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +90 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/serverless.js +18 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +86 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/web.js +92 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/websocket.js +30 -0
- package/packages/dd-trace/src/span_format.js +264 -0
- package/packages/dd-trace/src/span_processor.js +171 -0
- package/packages/dd-trace/src/span_sampler.js +58 -0
- package/packages/dd-trace/src/span_stats.js +227 -0
- package/packages/dd-trace/src/spanleak.js +97 -0
- package/packages/dd-trace/src/standalone/index.js +70 -0
- package/packages/dd-trace/src/standalone/product.js +36 -0
- package/packages/dd-trace/src/standalone/tracesource.js +36 -0
- package/packages/dd-trace/src/standalone/tracesource_priority_sampler.js +59 -0
- package/packages/dd-trace/src/startup-log.js +146 -0
- package/packages/dd-trace/src/tagger.js +58 -0
- package/packages/dd-trace/src/telemetry/dependencies.js +174 -0
- package/packages/dd-trace/src/telemetry/endpoints.js +212 -0
- package/packages/dd-trace/src/telemetry/index.js +26 -0
- package/packages/dd-trace/src/telemetry/logs/index.js +90 -0
- package/packages/dd-trace/src/telemetry/logs/log-collector.js +128 -0
- package/packages/dd-trace/src/telemetry/metrics.js +288 -0
- package/packages/dd-trace/src/telemetry/send-data.js +225 -0
- package/packages/dd-trace/src/telemetry/telemetry.js +535 -0
- package/packages/dd-trace/src/tracer.js +171 -0
- package/packages/dd-trace/src/tracer_metadata.js +29 -0
- package/packages/dd-trace/src/util.js +94 -0
- package/register.js +8 -0
- package/scripts/preinstall.js +34 -0
- package/vendor/dist/@datadog/sketches-js/LICENSE +39 -0
- package/vendor/dist/@datadog/sketches-js/index.js +1 -0
- package/vendor/dist/@datadog/source-map/LICENSE +28 -0
- package/vendor/dist/@datadog/source-map/index.js +1 -0
- package/vendor/dist/@isaacs/ttlcache/LICENSE +55 -0
- package/vendor/dist/@isaacs/ttlcache/index.js +1 -0
- package/vendor/dist/@opentelemetry/core/LICENSE +201 -0
- package/vendor/dist/@opentelemetry/core/index.js +1 -0
- package/vendor/dist/@opentelemetry/resources/LICENSE +201 -0
- package/vendor/dist/@opentelemetry/resources/index.js +1 -0
- package/vendor/dist/astring/LICENSE +19 -0
- package/vendor/dist/astring/index.js +1 -0
- package/vendor/dist/crypto-randomuuid/index.js +1 -0
- package/vendor/dist/escape-string-regexp/LICENSE +9 -0
- package/vendor/dist/escape-string-regexp/index.js +1 -0
- package/vendor/dist/esquery/LICENSE +24 -0
- package/vendor/dist/esquery/index.js +1 -0
- package/vendor/dist/ignore/LICENSE +21 -0
- package/vendor/dist/ignore/index.js +1 -0
- package/vendor/dist/istanbul-lib-coverage/LICENSE +24 -0
- package/vendor/dist/istanbul-lib-coverage/index.js +1 -0
- package/vendor/dist/jest-docblock/LICENSE +21 -0
- package/vendor/dist/jest-docblock/index.js +1 -0
- package/vendor/dist/jsonpath-plus/LICENSE +22 -0
- package/vendor/dist/jsonpath-plus/index.js +1 -0
- package/vendor/dist/limiter/LICENSE +19 -0
- package/vendor/dist/limiter/index.js +1 -0
- package/vendor/dist/lodash.sortby/LICENSE +47 -0
- package/vendor/dist/lodash.sortby/index.js +1 -0
- package/vendor/dist/lru-cache/LICENSE +15 -0
- package/vendor/dist/lru-cache/index.js +1 -0
- package/vendor/dist/meriyah/LICENSE +7 -0
- package/vendor/dist/meriyah/index.js +1 -0
- package/vendor/dist/module-details-from-path/LICENSE +21 -0
- package/vendor/dist/module-details-from-path/index.js +1 -0
- package/vendor/dist/mutexify/promise/LICENSE +21 -0
- package/vendor/dist/mutexify/promise/index.js +1 -0
- package/vendor/dist/opentracing/LICENSE +201 -0
- package/vendor/dist/opentracing/binary_carrier.d.ts +11 -0
- package/vendor/dist/opentracing/constants.d.ts +61 -0
- package/vendor/dist/opentracing/examples/demo/demo.d.ts +2 -0
- package/vendor/dist/opentracing/ext/tags.d.ts +90 -0
- package/vendor/dist/opentracing/functions.d.ts +20 -0
- package/vendor/dist/opentracing/global_tracer.d.ts +14 -0
- package/vendor/dist/opentracing/index.d.ts +12 -0
- package/vendor/dist/opentracing/index.js +1 -0
- package/vendor/dist/opentracing/mock_tracer/index.d.ts +5 -0
- package/vendor/dist/opentracing/mock_tracer/mock_context.d.ts +13 -0
- package/vendor/dist/opentracing/mock_tracer/mock_report.d.ts +16 -0
- package/vendor/dist/opentracing/mock_tracer/mock_span.d.ts +50 -0
- package/vendor/dist/opentracing/mock_tracer/mock_tracer.d.ts +26 -0
- package/vendor/dist/opentracing/noop.d.ts +8 -0
- package/vendor/dist/opentracing/reference.d.ts +33 -0
- package/vendor/dist/opentracing/span.d.ts +147 -0
- package/vendor/dist/opentracing/span_context.d.ts +26 -0
- package/vendor/dist/opentracing/test/api_compatibility.d.ts +16 -0
- package/vendor/dist/opentracing/test/mocktracer_implemenation.d.ts +3 -0
- package/vendor/dist/opentracing/test/noop_implementation.d.ts +4 -0
- package/vendor/dist/opentracing/test/opentracing_api.d.ts +3 -0
- package/vendor/dist/opentracing/test/unittest.d.ts +2 -0
- package/vendor/dist/opentracing/tracer.d.ts +127 -0
- package/vendor/dist/path-to-regexp/LICENSE +21 -0
- package/vendor/dist/path-to-regexp/index.js +1 -0
- package/vendor/dist/pprof-format/LICENSE +8 -0
- package/vendor/dist/pprof-format/index.js +1 -0
- package/vendor/dist/protobufjs/LICENSE +39 -0
- package/vendor/dist/protobufjs/index.js +1 -0
- package/vendor/dist/protobufjs/minimal/LICENSE +39 -0
- package/vendor/dist/protobufjs/minimal/index.js +1 -0
- package/vendor/dist/retry/LICENSE +21 -0
- package/vendor/dist/retry/index.js +1 -0
- package/vendor/dist/rfdc/LICENSE +15 -0
- package/vendor/dist/rfdc/index.js +1 -0
- package/vendor/dist/semifies/LICENSE +201 -0
- package/vendor/dist/semifies/index.js +1 -0
- package/vendor/dist/shell-quote/LICENSE +24 -0
- package/vendor/dist/shell-quote/index.js +1 -0
- package/vendor/dist/source-map/LICENSE +28 -0
- package/vendor/dist/source-map/index.js +1 -0
- package/vendor/dist/source-map/lib/util/LICENSE +28 -0
- package/vendor/dist/source-map/lib/util/index.js +1 -0
- package/vendor/dist/source-map/mappings.wasm +0 -0
- package/vendor/dist/tlhunter-sorted-set/LICENSE +21 -0
- package/vendor/dist/tlhunter-sorted-set/index.js +1 -0
- package/vendor/dist/ttl-set/LICENSE +21 -0
- package/vendor/dist/ttl-set/index.js +1 -0
- package/version.js +18 -0
|
@@ -0,0 +1,1096 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { createCoverageMap } = require('../../../vendor/dist/istanbul-lib-coverage')
|
|
4
|
+
const shimmer = require('../../datadog-shimmer')
|
|
5
|
+
const log = require('../../dd-trace/src/log')
|
|
6
|
+
const { getEnvironmentVariable } = require('../../dd-trace/src/config/helper')
|
|
7
|
+
const {
|
|
8
|
+
getCoveredFilenamesFromCoverage,
|
|
9
|
+
resetCoverage,
|
|
10
|
+
mergeCoverage,
|
|
11
|
+
fromCoverageMapToCoverage,
|
|
12
|
+
getTestSuitePath,
|
|
13
|
+
CUCUMBER_WORKER_TRACE_PAYLOAD_CODE,
|
|
14
|
+
getIsFaultyEarlyFlakeDetection,
|
|
15
|
+
} = require('../../dd-trace/src/plugins/util/test')
|
|
16
|
+
const satisfies = require('../../../vendor/dist/semifies')
|
|
17
|
+
const { addHook, channel } = require('./helpers/instrument')
|
|
18
|
+
|
|
19
|
+
const testStartCh = channel('ci:cucumber:test:start')
|
|
20
|
+
const testRetryCh = channel('ci:cucumber:test:retry')
|
|
21
|
+
const testFinishCh = channel('ci:cucumber:test:finish') // used for test steps too
|
|
22
|
+
const testFnCh = channel('ci:cucumber:test:fn')
|
|
23
|
+
|
|
24
|
+
const testStepStartCh = channel('ci:cucumber:test-step:start')
|
|
25
|
+
|
|
26
|
+
const errorCh = channel('ci:cucumber:error')
|
|
27
|
+
|
|
28
|
+
const testSuiteStartCh = channel('ci:cucumber:test-suite:start')
|
|
29
|
+
const testSuiteFinishCh = channel('ci:cucumber:test-suite:finish')
|
|
30
|
+
const testSuiteCodeCoverageCh = channel('ci:cucumber:test-suite:code-coverage')
|
|
31
|
+
|
|
32
|
+
const libraryConfigurationCh = channel('ci:cucumber:library-configuration')
|
|
33
|
+
const knownTestsCh = channel('ci:cucumber:known-tests')
|
|
34
|
+
const skippableSuitesCh = channel('ci:cucumber:test-suite:skippable')
|
|
35
|
+
const sessionStartCh = channel('ci:cucumber:session:start')
|
|
36
|
+
const sessionFinishCh = channel('ci:cucumber:session:finish')
|
|
37
|
+
const testManagementTestsCh = channel('ci:cucumber:test-management-tests')
|
|
38
|
+
const modifiedFilesCh = channel('ci:cucumber:modified-files')
|
|
39
|
+
const isModifiedCh = channel('ci:cucumber:is-modified-test')
|
|
40
|
+
|
|
41
|
+
const workerReportTraceCh = channel('ci:cucumber:worker-report:trace')
|
|
42
|
+
|
|
43
|
+
const itrSkippedSuitesCh = channel('ci:cucumber:itr:skipped-suites')
|
|
44
|
+
|
|
45
|
+
const getCodeCoverageCh = channel('ci:nyc:get-coverage')
|
|
46
|
+
|
|
47
|
+
const isMarkedAsUnskippable = (pickle) => {
|
|
48
|
+
return pickle.tags.some(tag => tag.name === '@datadog:unskippable')
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// We'll preserve the original coverage here
|
|
52
|
+
const originalCoverageMap = createCoverageMap()
|
|
53
|
+
|
|
54
|
+
// TODO: remove in a later major version
|
|
55
|
+
const patched = new WeakSet()
|
|
56
|
+
|
|
57
|
+
const lastStatusByPickleId = new Map()
|
|
58
|
+
/** For ATR: statuses keyed by stable scenario id (uri:name) so retries accumulate correctly */
|
|
59
|
+
const atrStatusesByScenarioKey = new Map()
|
|
60
|
+
const numRetriesByPickleId = new Map()
|
|
61
|
+
const numAttemptToCtx = new Map()
|
|
62
|
+
const newTestsByTestFullname = new Map()
|
|
63
|
+
const modifiedTestsByPickleId = new Map()
|
|
64
|
+
|
|
65
|
+
let eventDataCollector = null
|
|
66
|
+
let pickleByFile = {}
|
|
67
|
+
const pickleResultByFile = {}
|
|
68
|
+
|
|
69
|
+
let skippableSuites = []
|
|
70
|
+
let itrCorrelationId = ''
|
|
71
|
+
let isForcedToRun = false
|
|
72
|
+
let isUnskippable = false
|
|
73
|
+
let isSuitesSkippingEnabled = false
|
|
74
|
+
let isEarlyFlakeDetectionEnabled = false
|
|
75
|
+
let earlyFlakeDetectionNumRetries = 0
|
|
76
|
+
let earlyFlakeDetectionFaultyThreshold = 0
|
|
77
|
+
let isEarlyFlakeDetectionFaulty = false
|
|
78
|
+
let isFlakyTestRetriesEnabled = false
|
|
79
|
+
let isKnownTestsEnabled = false
|
|
80
|
+
let isTestManagementTestsEnabled = false
|
|
81
|
+
let isImpactedTestsEnabled = false
|
|
82
|
+
let testManagementAttemptToFixRetries = 0
|
|
83
|
+
let testManagementTests = {}
|
|
84
|
+
let modifiedFiles = {}
|
|
85
|
+
let numTestRetries = 0
|
|
86
|
+
let knownTests = {}
|
|
87
|
+
let skippedSuites = []
|
|
88
|
+
let isSuitesSkipped = false
|
|
89
|
+
|
|
90
|
+
function isValidKnownTests (receivedKnownTests) {
|
|
91
|
+
return !!receivedKnownTests.cucumber
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function getSuiteStatusFromTestStatuses (testStatuses) {
|
|
95
|
+
if (testStatuses.includes('fail')) {
|
|
96
|
+
return 'fail'
|
|
97
|
+
}
|
|
98
|
+
if (testStatuses.every(status => status === 'skip')) {
|
|
99
|
+
return 'skip'
|
|
100
|
+
}
|
|
101
|
+
return 'pass'
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function getStatusFromResult (result) {
|
|
105
|
+
if (result.status === 1) {
|
|
106
|
+
return { status: 'pass' }
|
|
107
|
+
}
|
|
108
|
+
if (result.status === 2) {
|
|
109
|
+
return { status: 'skip' }
|
|
110
|
+
}
|
|
111
|
+
if (result.status === 4) {
|
|
112
|
+
return { status: 'skip', skipReason: 'not implemented' }
|
|
113
|
+
}
|
|
114
|
+
return { status: 'fail', errorMessage: result.message }
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function getStatusFromResultLatest (result) {
|
|
118
|
+
if (result.status === 'PASSED') {
|
|
119
|
+
return { status: 'pass' }
|
|
120
|
+
}
|
|
121
|
+
if (result.status === 'SKIPPED' || result.status === 'PENDING') {
|
|
122
|
+
return { status: 'skip' }
|
|
123
|
+
}
|
|
124
|
+
if (result.status === 'UNDEFINED') {
|
|
125
|
+
return { status: 'skip', skipReason: 'not implemented' }
|
|
126
|
+
}
|
|
127
|
+
return { status: 'fail', errorMessage: result.message }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function isNewTest (testSuite, testName) {
|
|
131
|
+
if (!isValidKnownTests(knownTests)) {
|
|
132
|
+
return false
|
|
133
|
+
}
|
|
134
|
+
const testsForSuite = knownTests.cucumber[testSuite] || []
|
|
135
|
+
return !testsForSuite.includes(testName)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function getTestProperties (testSuite, testName) {
|
|
139
|
+
const { attempt_to_fix: attemptToFix, disabled, quarantined } =
|
|
140
|
+
testManagementTests?.cucumber?.suites?.[testSuite]?.tests?.[testName]?.properties || {}
|
|
141
|
+
|
|
142
|
+
return { attemptToFix, disabled, quarantined }
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function getTestStatusFromRetries (testStatuses) {
|
|
146
|
+
if (testStatuses.every(status => status === 'fail')) {
|
|
147
|
+
return 'fail'
|
|
148
|
+
}
|
|
149
|
+
if (testStatuses.includes('pass')) {
|
|
150
|
+
return 'pass'
|
|
151
|
+
}
|
|
152
|
+
return 'pass'
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function getErrorFromCucumberResult (cucumberResult) {
|
|
156
|
+
if (!cucumberResult.message) {
|
|
157
|
+
return
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const [message] = cucumberResult.message.split('\n')
|
|
161
|
+
const error = new Error(message)
|
|
162
|
+
if (cucumberResult.exception) {
|
|
163
|
+
error.type = cucumberResult.exception.type
|
|
164
|
+
}
|
|
165
|
+
error.stack = cucumberResult.message
|
|
166
|
+
return error
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function getChannelPromise (channelToPublishTo, isParallel = false, frameworkVersion = null) {
|
|
170
|
+
return new Promise(resolve => {
|
|
171
|
+
channelToPublishTo.publish({ onDone: resolve, isParallel, frameworkVersion })
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function getShouldBeSkippedSuite (pickle, suitesToSkip) {
|
|
176
|
+
const testSuitePath = getTestSuitePath(pickle.uri, process.cwd())
|
|
177
|
+
const isUnskippable = isMarkedAsUnskippable(pickle)
|
|
178
|
+
const isSkipped = suitesToSkip.includes(testSuitePath)
|
|
179
|
+
|
|
180
|
+
return [isSkipped && !isUnskippable, testSuitePath]
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// From cucumber@>=11
|
|
184
|
+
function getFilteredPicklesNew (coordinator, suitesToSkip) {
|
|
185
|
+
return coordinator.sourcedPickles.reduce((acc, sourcedPickle) => {
|
|
186
|
+
const { pickle } = sourcedPickle
|
|
187
|
+
const [shouldBeSkipped, testSuitePath] = getShouldBeSkippedSuite(pickle, suitesToSkip)
|
|
188
|
+
|
|
189
|
+
if (shouldBeSkipped) {
|
|
190
|
+
acc.skippedSuites.add(testSuitePath)
|
|
191
|
+
} else {
|
|
192
|
+
acc.picklesToRun.push(sourcedPickle)
|
|
193
|
+
}
|
|
194
|
+
return acc
|
|
195
|
+
}, { skippedSuites: new Set(), picklesToRun: [] })
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function getFilteredPickles (runtime, suitesToSkip) {
|
|
199
|
+
return runtime.pickleIds.reduce((acc, pickleId) => {
|
|
200
|
+
const pickle = runtime.eventDataCollector.getPickle(pickleId)
|
|
201
|
+
const [shouldBeSkipped, testSuitePath] = getShouldBeSkippedSuite(pickle, suitesToSkip)
|
|
202
|
+
|
|
203
|
+
if (shouldBeSkipped) {
|
|
204
|
+
acc.skippedSuites.add(testSuitePath)
|
|
205
|
+
} else {
|
|
206
|
+
acc.picklesToRun.push(pickleId)
|
|
207
|
+
}
|
|
208
|
+
return acc
|
|
209
|
+
}, { skippedSuites: new Set(), picklesToRun: [] })
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// From cucumber@>=11
|
|
213
|
+
function getPickleByFileNew (coordinator) {
|
|
214
|
+
return coordinator.sourcedPickles.reduce((acc, { pickle }) => {
|
|
215
|
+
if (acc[pickle.uri]) {
|
|
216
|
+
acc[pickle.uri].push(pickle)
|
|
217
|
+
} else {
|
|
218
|
+
acc[pickle.uri] = [pickle]
|
|
219
|
+
}
|
|
220
|
+
return acc
|
|
221
|
+
}, {})
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function getPickleByFile (runtimeOrCoodinator) {
|
|
225
|
+
return runtimeOrCoodinator.pickleIds.reduce((acc, pickleId) => {
|
|
226
|
+
const test = runtimeOrCoodinator.eventDataCollector.getPickle(pickleId)
|
|
227
|
+
if (acc[test.uri]) {
|
|
228
|
+
acc[test.uri].push(test)
|
|
229
|
+
} else {
|
|
230
|
+
acc[test.uri] = [test]
|
|
231
|
+
}
|
|
232
|
+
return acc
|
|
233
|
+
}, {})
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function wrapRun (pl, isLatestVersion, version) {
|
|
237
|
+
if (patched.has(pl)) return
|
|
238
|
+
|
|
239
|
+
patched.add(pl)
|
|
240
|
+
|
|
241
|
+
shimmer.wrap(pl.prototype, 'run', run => function () {
|
|
242
|
+
if (!testFinishCh.hasSubscribers) {
|
|
243
|
+
return run.apply(this, arguments)
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
let numAttempt = 0
|
|
247
|
+
|
|
248
|
+
const testFileAbsolutePath = this.pickle.uri
|
|
249
|
+
|
|
250
|
+
const testSourceLine = this.gherkinDocument?.feature?.location?.line
|
|
251
|
+
|
|
252
|
+
const testStartPayload = {
|
|
253
|
+
testName: this.pickle.name,
|
|
254
|
+
testFileAbsolutePath,
|
|
255
|
+
testSourceLine,
|
|
256
|
+
isParallel: !!getEnvironmentVariable('CUCUMBER_WORKER_ID'),
|
|
257
|
+
}
|
|
258
|
+
const ctx = testStartPayload
|
|
259
|
+
numAttemptToCtx.set(numAttempt, ctx)
|
|
260
|
+
testStartCh.runStores(ctx, () => {})
|
|
261
|
+
const promises = {}
|
|
262
|
+
try {
|
|
263
|
+
this.eventBroadcaster.on('envelope', async (testCase) => {
|
|
264
|
+
// Only supported from >=8.0.0
|
|
265
|
+
if (testCase?.testCaseFinished) {
|
|
266
|
+
const { testCaseFinished: { willBeRetried } } = testCase
|
|
267
|
+
if (willBeRetried) { // test case failed and will be retried
|
|
268
|
+
let error
|
|
269
|
+
try {
|
|
270
|
+
const cucumberResult = this.getWorstStepResult()
|
|
271
|
+
error = getErrorFromCucumberResult(cucumberResult)
|
|
272
|
+
} catch {
|
|
273
|
+
// ignore error
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const failedAttemptCtx = numAttemptToCtx.get(numAttempt)
|
|
277
|
+
const isFirstAttempt = numAttempt++ === 0
|
|
278
|
+
const isAtrRetry = !isFirstAttempt && isFlakyTestRetriesEnabled
|
|
279
|
+
|
|
280
|
+
// ATR: record this attempt as failed so when run().finally runs (after retry) we have all statuses
|
|
281
|
+
if (isFlakyTestRetriesEnabled && isAtrRetry === false) {
|
|
282
|
+
const nameForKey = this.pickle.name.replace(/\s*\(attempt \d+(?:, retried)?\)\s*$/, '')
|
|
283
|
+
const atrKey = `${this.pickle.uri}:${nameForKey}`
|
|
284
|
+
if (atrStatusesByScenarioKey.has(atrKey)) {
|
|
285
|
+
atrStatusesByScenarioKey.get(atrKey).push('fail')
|
|
286
|
+
} else {
|
|
287
|
+
atrStatusesByScenarioKey.set(atrKey, ['fail'])
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (promises.hitBreakpointPromise) {
|
|
292
|
+
await promises.hitBreakpointPromise
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// the current span will be finished and a new one will be created
|
|
296
|
+
testRetryCh.publish({ isFirstAttempt, error, isAtrRetry, ...failedAttemptCtx.currentStore })
|
|
297
|
+
|
|
298
|
+
const newCtx = { ...testStartPayload, promises }
|
|
299
|
+
numAttemptToCtx.set(numAttempt, newCtx)
|
|
300
|
+
|
|
301
|
+
testStartCh.runStores(newCtx, () => {})
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
})
|
|
305
|
+
let promise
|
|
306
|
+
|
|
307
|
+
testFnCh.runStores(ctx, () => {
|
|
308
|
+
promise = run.apply(this, arguments)
|
|
309
|
+
})
|
|
310
|
+
promise.finally(async () => {
|
|
311
|
+
const result = this.getWorstStepResult()
|
|
312
|
+
const { status, skipReason } = isLatestVersion
|
|
313
|
+
? getStatusFromResultLatest(result)
|
|
314
|
+
: getStatusFromResult(result)
|
|
315
|
+
|
|
316
|
+
if (lastStatusByPickleId.has(this.pickle.id)) {
|
|
317
|
+
lastStatusByPickleId.get(this.pickle.id).push(status)
|
|
318
|
+
} else {
|
|
319
|
+
lastStatusByPickleId.set(this.pickle.id, [status])
|
|
320
|
+
}
|
|
321
|
+
let isNew = false
|
|
322
|
+
let isEfdRetry = false
|
|
323
|
+
let isAttemptToFix = false
|
|
324
|
+
let isAttemptToFixRetry = false
|
|
325
|
+
let hasFailedAllRetries = false
|
|
326
|
+
let hasPassedAllRetries = false
|
|
327
|
+
let hasFailedAttemptToFix = false
|
|
328
|
+
let isDisabled = false
|
|
329
|
+
let isQuarantined = false
|
|
330
|
+
let isModified = false
|
|
331
|
+
|
|
332
|
+
if (isTestManagementTestsEnabled) {
|
|
333
|
+
const testSuitePath = getTestSuitePath(testFileAbsolutePath, process.cwd())
|
|
334
|
+
const testProperties = getTestProperties(testSuitePath, this.pickle.name)
|
|
335
|
+
const numRetries = numRetriesByPickleId.get(this.pickle.id)
|
|
336
|
+
isAttemptToFix = testProperties.attemptToFix
|
|
337
|
+
isAttemptToFixRetry = isAttemptToFix && numRetries > 0
|
|
338
|
+
isDisabled = testProperties.disabled
|
|
339
|
+
isQuarantined = testProperties.quarantined
|
|
340
|
+
|
|
341
|
+
if (isAttemptToFixRetry) {
|
|
342
|
+
const statuses = lastStatusByPickleId.get(this.pickle.id)
|
|
343
|
+
if (statuses.length === testManagementAttemptToFixRetries + 1) {
|
|
344
|
+
const { pass, fail } = statuses.reduce((acc, status) => {
|
|
345
|
+
acc[status]++
|
|
346
|
+
return acc
|
|
347
|
+
}, { pass: 0, fail: 0 })
|
|
348
|
+
hasFailedAllRetries = fail === testManagementAttemptToFixRetries + 1
|
|
349
|
+
hasPassedAllRetries = pass === testManagementAttemptToFixRetries + 1
|
|
350
|
+
hasFailedAttemptToFix = fail > 0
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
const numRetries = numRetriesByPickleId.get(this.pickle.id)
|
|
356
|
+
|
|
357
|
+
if (isImpactedTestsEnabled) {
|
|
358
|
+
isModified = modifiedTestsByPickleId.get(this.pickle.id)
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (isKnownTestsEnabled && status !== 'skip') {
|
|
362
|
+
isNew = numRetries !== undefined
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
if (isNew || isModified) {
|
|
366
|
+
isEfdRetry = numRetries > 0
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// Check if all EFD retries failed
|
|
370
|
+
if (isEfdRetry && (isNew || isModified)) {
|
|
371
|
+
const statuses = lastStatusByPickleId.get(this.pickle.id)
|
|
372
|
+
if (statuses.length === earlyFlakeDetectionNumRetries + 1) {
|
|
373
|
+
const { fail } = statuses.reduce((acc, status) => {
|
|
374
|
+
acc[status]++
|
|
375
|
+
return acc
|
|
376
|
+
}, { pass: 0, fail: 0 })
|
|
377
|
+
if (fail === earlyFlakeDetectionNumRetries + 1) {
|
|
378
|
+
hasFailedAllRetries = true
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// ATR: accumulate statuses by stable scenario key (uri:name) so retries are grouped.
|
|
384
|
+
// Cucumber appends " (attempt N)" or " (attempt N, retried)" to the scenario name; normalize for keying.
|
|
385
|
+
if (isFlakyTestRetriesEnabled && !isAttemptToFix && !isEfdRetry && numTestRetries > 0) {
|
|
386
|
+
const nameForKey = this.pickle.name.replace(/\s*\(attempt \d+(?:, retried)?\)\s*$/, '')
|
|
387
|
+
const atrKey = `${this.pickle.uri}:${nameForKey}`
|
|
388
|
+
if (atrStatusesByScenarioKey.has(atrKey)) {
|
|
389
|
+
atrStatusesByScenarioKey.get(atrKey).push(status)
|
|
390
|
+
} else {
|
|
391
|
+
atrStatusesByScenarioKey.set(atrKey, [status])
|
|
392
|
+
}
|
|
393
|
+
const atrStatuses = atrStatusesByScenarioKey.get(atrKey)
|
|
394
|
+
const pickleStatuses = lastStatusByPickleId.get(this.pickle.id)
|
|
395
|
+
const statusesToCheck = atrStatuses?.length >= (numTestRetries + 1) ? atrStatuses : pickleStatuses
|
|
396
|
+
if (statusesToCheck && statusesToCheck.length === numTestRetries + 1 &&
|
|
397
|
+
statusesToCheck.every(s => s === 'fail')) {
|
|
398
|
+
hasFailedAllRetries = true
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
const attemptCtx = numAttemptToCtx.get(numAttempt)
|
|
403
|
+
|
|
404
|
+
const error = getErrorFromCucumberResult(result)
|
|
405
|
+
|
|
406
|
+
if (promises.hitBreakpointPromise) {
|
|
407
|
+
await promises.hitBreakpointPromise
|
|
408
|
+
}
|
|
409
|
+
testFinishCh.publish({
|
|
410
|
+
status,
|
|
411
|
+
skipReason,
|
|
412
|
+
error,
|
|
413
|
+
isNew,
|
|
414
|
+
isEfdRetry,
|
|
415
|
+
isFlakyRetry: numAttempt > 0,
|
|
416
|
+
isAttemptToFix,
|
|
417
|
+
isAttemptToFixRetry,
|
|
418
|
+
hasFailedAllRetries,
|
|
419
|
+
hasPassedAllRetries,
|
|
420
|
+
hasFailedAttemptToFix,
|
|
421
|
+
isDisabled,
|
|
422
|
+
isQuarantined,
|
|
423
|
+
isModified,
|
|
424
|
+
...attemptCtx.currentStore,
|
|
425
|
+
})
|
|
426
|
+
})
|
|
427
|
+
return promise
|
|
428
|
+
} catch (err) {
|
|
429
|
+
ctx.err = err
|
|
430
|
+
errorCh.runStores(ctx, () => {
|
|
431
|
+
throw err
|
|
432
|
+
})
|
|
433
|
+
}
|
|
434
|
+
})
|
|
435
|
+
shimmer.wrap(pl.prototype, 'runStep', runStep => function () {
|
|
436
|
+
if (!testFinishCh.hasSubscribers) {
|
|
437
|
+
return runStep.apply(this, arguments)
|
|
438
|
+
}
|
|
439
|
+
const testStep = arguments[0]
|
|
440
|
+
let resource
|
|
441
|
+
|
|
442
|
+
if (isLatestVersion) {
|
|
443
|
+
resource = testStep.text
|
|
444
|
+
} else {
|
|
445
|
+
resource = testStep.isHook ? 'hook' : testStep.pickleStep.text
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
const ctx = { resource }
|
|
449
|
+
return testStepStartCh.runStores(ctx, () => {
|
|
450
|
+
try {
|
|
451
|
+
const promise = runStep.apply(this, arguments)
|
|
452
|
+
|
|
453
|
+
promise.then((result) => {
|
|
454
|
+
const finalResult = satisfies(version, '>=12.0.0') ? result.result : result
|
|
455
|
+
const getStatus = satisfies(version, '>=7.3.0') ? getStatusFromResultLatest : getStatusFromResult
|
|
456
|
+
|
|
457
|
+
const { status, skipReason, errorMessage } = getStatus(finalResult)
|
|
458
|
+
|
|
459
|
+
testFinishCh.publish({ isStep: true, status, skipReason, errorMessage, ...ctx.currentStore })
|
|
460
|
+
})
|
|
461
|
+
return promise
|
|
462
|
+
} catch (err) {
|
|
463
|
+
ctx.err = err
|
|
464
|
+
errorCh.runStores(ctx, () => {
|
|
465
|
+
throw err
|
|
466
|
+
})
|
|
467
|
+
}
|
|
468
|
+
})
|
|
469
|
+
})
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
function pickleHook (PickleRunner, version) {
|
|
473
|
+
const pl = PickleRunner.default
|
|
474
|
+
|
|
475
|
+
wrapRun(pl, false, version)
|
|
476
|
+
|
|
477
|
+
return PickleRunner
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
function testCaseHook (TestCaseRunner, version) {
|
|
481
|
+
const pl = TestCaseRunner.default
|
|
482
|
+
|
|
483
|
+
wrapRun(pl, true, version)
|
|
484
|
+
|
|
485
|
+
return TestCaseRunner
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// Valid for old and new cucumber versions
|
|
489
|
+
function getCucumberOptions (adapterOrCoordinator) {
|
|
490
|
+
if (adapterOrCoordinator.adapter) {
|
|
491
|
+
return adapterOrCoordinator.adapter.worker?.options || adapterOrCoordinator.adapter.options
|
|
492
|
+
}
|
|
493
|
+
return adapterOrCoordinator.options
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordinator = false) {
|
|
497
|
+
return async function () {
|
|
498
|
+
if (!libraryConfigurationCh.hasSubscribers) {
|
|
499
|
+
return start.apply(this, arguments)
|
|
500
|
+
}
|
|
501
|
+
const options = getCucumberOptions(this)
|
|
502
|
+
|
|
503
|
+
if (!isParallel && this.adapter?.options) {
|
|
504
|
+
isParallel = options.parallel > 0
|
|
505
|
+
}
|
|
506
|
+
let errorSkippableRequest
|
|
507
|
+
|
|
508
|
+
const configurationResponse = await getChannelPromise(libraryConfigurationCh, isParallel, frameworkVersion)
|
|
509
|
+
|
|
510
|
+
isEarlyFlakeDetectionEnabled = configurationResponse.libraryConfig?.isEarlyFlakeDetectionEnabled
|
|
511
|
+
earlyFlakeDetectionNumRetries = configurationResponse.libraryConfig?.earlyFlakeDetectionNumRetries
|
|
512
|
+
earlyFlakeDetectionFaultyThreshold = configurationResponse.libraryConfig?.earlyFlakeDetectionFaultyThreshold
|
|
513
|
+
isSuitesSkippingEnabled = configurationResponse.libraryConfig?.isSuitesSkippingEnabled
|
|
514
|
+
isFlakyTestRetriesEnabled = configurationResponse.libraryConfig?.isFlakyTestRetriesEnabled
|
|
515
|
+
const configRetryCount = configurationResponse.libraryConfig?.flakyTestRetriesCount
|
|
516
|
+
numTestRetries = (typeof configRetryCount === 'number' && configRetryCount > 0) ? configRetryCount : 0
|
|
517
|
+
isKnownTestsEnabled = configurationResponse.libraryConfig?.isKnownTestsEnabled
|
|
518
|
+
isTestManagementTestsEnabled = configurationResponse.libraryConfig?.isTestManagementEnabled
|
|
519
|
+
testManagementAttemptToFixRetries = configurationResponse.libraryConfig?.testManagementAttemptToFixRetries
|
|
520
|
+
isImpactedTestsEnabled = configurationResponse.libraryConfig?.isImpactedTestsEnabled
|
|
521
|
+
|
|
522
|
+
if (isKnownTestsEnabled) {
|
|
523
|
+
const knownTestsResponse = await getChannelPromise(knownTestsCh)
|
|
524
|
+
if (knownTestsResponse.err) {
|
|
525
|
+
isEarlyFlakeDetectionEnabled = false
|
|
526
|
+
isKnownTestsEnabled = false
|
|
527
|
+
} else {
|
|
528
|
+
knownTests = knownTestsResponse.knownTests
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
if (isSuitesSkippingEnabled) {
|
|
533
|
+
const skippableResponse = await getChannelPromise(skippableSuitesCh)
|
|
534
|
+
|
|
535
|
+
errorSkippableRequest = skippableResponse.err
|
|
536
|
+
skippableSuites = skippableResponse.skippableSuites
|
|
537
|
+
|
|
538
|
+
if (!errorSkippableRequest) {
|
|
539
|
+
const filteredPickles = isCoordinator
|
|
540
|
+
? getFilteredPicklesNew(this, skippableSuites)
|
|
541
|
+
: getFilteredPickles(this, skippableSuites)
|
|
542
|
+
|
|
543
|
+
const { picklesToRun } = filteredPickles
|
|
544
|
+
const oldPickles = isCoordinator ? this.sourcedPickles : this.pickleIds
|
|
545
|
+
|
|
546
|
+
isSuitesSkipped = picklesToRun.length !== oldPickles.length
|
|
547
|
+
|
|
548
|
+
log.debug('%s out of %s suites are going to run.', picklesToRun.length, oldPickles.length)
|
|
549
|
+
|
|
550
|
+
if (isCoordinator) {
|
|
551
|
+
this.sourcedPickles = picklesToRun
|
|
552
|
+
} else {
|
|
553
|
+
this.pickleIds = picklesToRun
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
skippedSuites = [...filteredPickles.skippedSuites]
|
|
557
|
+
itrCorrelationId = skippableResponse.itrCorrelationId
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
pickleByFile = isCoordinator ? getPickleByFileNew(this) : getPickleByFile(this)
|
|
562
|
+
|
|
563
|
+
if (isKnownTestsEnabled) {
|
|
564
|
+
const isFaulty = !isValidKnownTests(knownTests) || getIsFaultyEarlyFlakeDetection(
|
|
565
|
+
Object.keys(pickleByFile),
|
|
566
|
+
knownTests.cucumber,
|
|
567
|
+
earlyFlakeDetectionFaultyThreshold
|
|
568
|
+
)
|
|
569
|
+
if (isFaulty) {
|
|
570
|
+
isEarlyFlakeDetectionEnabled = false
|
|
571
|
+
isKnownTestsEnabled = false
|
|
572
|
+
isEarlyFlakeDetectionFaulty = true
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
if (isTestManagementTestsEnabled) {
|
|
577
|
+
const testManagementTestsResponse = await getChannelPromise(testManagementTestsCh)
|
|
578
|
+
if (testManagementTestsResponse.err) {
|
|
579
|
+
isTestManagementTestsEnabled = false
|
|
580
|
+
} else {
|
|
581
|
+
testManagementTests = testManagementTestsResponse.testManagementTests
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
if (isImpactedTestsEnabled) {
|
|
586
|
+
const impactedTestsResponse = await getChannelPromise(modifiedFilesCh)
|
|
587
|
+
if (!impactedTestsResponse.err) {
|
|
588
|
+
modifiedFiles = impactedTestsResponse.modifiedFiles
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
const processArgv = process.argv.slice(2).join(' ')
|
|
593
|
+
const command = getEnvironmentVariable('npm_lifecycle_script') || `cucumber-js ${processArgv}`
|
|
594
|
+
|
|
595
|
+
if (isFlakyTestRetriesEnabled && !options.retry && numTestRetries > 0) {
|
|
596
|
+
options.retry = numTestRetries
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
atrStatusesByScenarioKey.clear()
|
|
600
|
+
sessionStartCh.publish({ command, frameworkVersion })
|
|
601
|
+
|
|
602
|
+
if (!errorSkippableRequest && skippedSuites.length) {
|
|
603
|
+
itrSkippedSuitesCh.publish({ skippedSuites, frameworkVersion })
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
const success = await start.apply(this, arguments)
|
|
607
|
+
|
|
608
|
+
let untestedCoverage
|
|
609
|
+
if (getCodeCoverageCh.hasSubscribers) {
|
|
610
|
+
untestedCoverage = await getChannelPromise(getCodeCoverageCh)
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
let testCodeCoverageLinesTotal
|
|
614
|
+
|
|
615
|
+
if (global.__coverage__) {
|
|
616
|
+
try {
|
|
617
|
+
if (untestedCoverage) {
|
|
618
|
+
originalCoverageMap.merge(fromCoverageMapToCoverage(untestedCoverage))
|
|
619
|
+
}
|
|
620
|
+
testCodeCoverageLinesTotal = originalCoverageMap.getCoverageSummary().lines.pct
|
|
621
|
+
} catch {
|
|
622
|
+
// ignore errors
|
|
623
|
+
}
|
|
624
|
+
// restore the original coverage
|
|
625
|
+
global.__coverage__ = fromCoverageMapToCoverage(originalCoverageMap)
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
sessionFinishCh.publish({
|
|
629
|
+
status: success ? 'pass' : 'fail',
|
|
630
|
+
isSuitesSkipped,
|
|
631
|
+
testCodeCoverageLinesTotal,
|
|
632
|
+
numSkippedSuites: skippedSuites.length,
|
|
633
|
+
hasUnskippableSuites: isUnskippable,
|
|
634
|
+
hasForcedToRunSuites: isForcedToRun,
|
|
635
|
+
isEarlyFlakeDetectionEnabled,
|
|
636
|
+
isEarlyFlakeDetectionFaulty,
|
|
637
|
+
isTestManagementTestsEnabled,
|
|
638
|
+
isParallel,
|
|
639
|
+
})
|
|
640
|
+
eventDataCollector = null
|
|
641
|
+
return success
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
// Generates suite start and finish events in the main process.
|
|
646
|
+
// Handles EFD in both the main process and the worker process.
|
|
647
|
+
function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = false, isWorker = false) {
|
|
648
|
+
return async function () {
|
|
649
|
+
if (!testSuiteFinishCh.hasSubscribers) {
|
|
650
|
+
return runTestCaseFunction.apply(this, arguments)
|
|
651
|
+
}
|
|
652
|
+
const pickle = isNewerCucumberVersion
|
|
653
|
+
? arguments[0].pickle
|
|
654
|
+
: this.eventDataCollector.getPickle(arguments[0])
|
|
655
|
+
const testCase = isNewerCucumberVersion
|
|
656
|
+
? arguments[0].testCase
|
|
657
|
+
: arguments[1]
|
|
658
|
+
const gherkinDocument = isNewerCucumberVersion
|
|
659
|
+
? arguments[0].gherkinDocument
|
|
660
|
+
: this.eventDataCollector.getGherkinDocument(pickle.uri)
|
|
661
|
+
|
|
662
|
+
const testFileAbsolutePath = pickle.uri
|
|
663
|
+
const testSuitePath = getTestSuitePath(testFileAbsolutePath, process.cwd())
|
|
664
|
+
|
|
665
|
+
// If it's a worker, suite events are handled in `getWrappedParseWorkerMessage`
|
|
666
|
+
if (!isWorker && !pickleResultByFile[testFileAbsolutePath]) { // first test in suite
|
|
667
|
+
isUnskippable = isMarkedAsUnskippable(pickle)
|
|
668
|
+
isForcedToRun = isUnskippable && skippableSuites.includes(testSuitePath)
|
|
669
|
+
|
|
670
|
+
testSuiteStartCh.publish({
|
|
671
|
+
testFileAbsolutePath,
|
|
672
|
+
isUnskippable,
|
|
673
|
+
isForcedToRun,
|
|
674
|
+
itrCorrelationId,
|
|
675
|
+
})
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
let isNew = false
|
|
679
|
+
let isAttemptToFix = false
|
|
680
|
+
let isDisabled = false
|
|
681
|
+
let isQuarantined = false
|
|
682
|
+
let isModified = false
|
|
683
|
+
|
|
684
|
+
if (isTestManagementTestsEnabled) {
|
|
685
|
+
const testProperties = getTestProperties(testSuitePath, pickle.name)
|
|
686
|
+
isAttemptToFix = testProperties.attemptToFix
|
|
687
|
+
isDisabled = testProperties.disabled
|
|
688
|
+
isQuarantined = testProperties.quarantined
|
|
689
|
+
// If attempt to fix is enabled, we run even if the test is disabled
|
|
690
|
+
if (!isAttemptToFix && isDisabled) {
|
|
691
|
+
this.options.dryRun = true
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
if (isImpactedTestsEnabled) {
|
|
696
|
+
const setIsModified = (receivedIsModified) => { isModified = receivedIsModified }
|
|
697
|
+
const scenarios = gherkinDocument.feature?.children?.filter(
|
|
698
|
+
children => pickle.astNodeIds.includes(children.scenario.id)
|
|
699
|
+
).map(scenario => scenario.scenario)
|
|
700
|
+
const stepIds = testCase?.testSteps?.flatMap(testStep => testStep.stepDefinitionIds)
|
|
701
|
+
|
|
702
|
+
isModifiedCh.publish({
|
|
703
|
+
scenarios,
|
|
704
|
+
testFileAbsolutePath: gherkinDocument.uri,
|
|
705
|
+
modifiedFiles,
|
|
706
|
+
stepIds,
|
|
707
|
+
stepDefinitions: this.supportCodeLibrary.stepDefinitions,
|
|
708
|
+
setIsModified,
|
|
709
|
+
})
|
|
710
|
+
modifiedTestsByPickleId.set(pickle.id, isModified)
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
if (isKnownTestsEnabled && !isAttemptToFix) {
|
|
714
|
+
isNew = isNewTest(testSuitePath, pickle.name)
|
|
715
|
+
if (isNew) {
|
|
716
|
+
numRetriesByPickleId.set(pickle.id, 0)
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
// TODO: for >=11 we could use `runTestCaseResult` instead of accumulating results in `lastStatusByPickleId`
|
|
720
|
+
let runTestCaseResult = await runTestCaseFunction.apply(this, arguments)
|
|
721
|
+
|
|
722
|
+
const testStatuses = lastStatusByPickleId.get(pickle.id)
|
|
723
|
+
const lastTestStatus = testStatuses.at(-1)
|
|
724
|
+
|
|
725
|
+
// New tests should not be marked as attempt to fix, so EFD + Attempt to fix should not be enabled at the same time
|
|
726
|
+
if (isAttemptToFix && lastTestStatus !== 'skip') {
|
|
727
|
+
for (let retryIndex = 0; retryIndex < testManagementAttemptToFixRetries; retryIndex++) {
|
|
728
|
+
numRetriesByPickleId.set(pickle.id, retryIndex + 1)
|
|
729
|
+
// eslint-disable-next-line no-await-in-loop
|
|
730
|
+
runTestCaseResult = await runTestCaseFunction.apply(this, arguments)
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
// If it's a new test and it hasn't been skipped, we run it again
|
|
735
|
+
if (isEarlyFlakeDetectionEnabled && lastTestStatus !== 'skip' && (isNew || isModified)) {
|
|
736
|
+
for (let retryIndex = 0; retryIndex < earlyFlakeDetectionNumRetries; retryIndex++) {
|
|
737
|
+
numRetriesByPickleId.set(pickle.id, retryIndex + 1)
|
|
738
|
+
// eslint-disable-next-line no-await-in-loop
|
|
739
|
+
runTestCaseResult = await runTestCaseFunction.apply(this, arguments)
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
let testStatus = lastTestStatus
|
|
743
|
+
let shouldBePassedByEFD = false
|
|
744
|
+
let shouldBePassedByTestManagement = false
|
|
745
|
+
if ((isNew || isModified) && isEarlyFlakeDetectionEnabled) {
|
|
746
|
+
/**
|
|
747
|
+
* If Early Flake Detection (EFD) is enabled the logic is as follows:
|
|
748
|
+
* - If all attempts for a test are failing, the test has failed and we will let the test process fail.
|
|
749
|
+
* - If just a single attempt passes, we will prevent the test process from failing.
|
|
750
|
+
* The rationale behind is the following: you may still be able to block your CI pipeline by gating
|
|
751
|
+
* on flakiness (the test will be considered flaky), but you may choose to unblock the pipeline too.
|
|
752
|
+
*/
|
|
753
|
+
testStatus = getTestStatusFromRetries(testStatuses)
|
|
754
|
+
if (testStatus === 'pass') {
|
|
755
|
+
// for cucumber@>=11, setting `this.success` does not work, so we have to change the returned value
|
|
756
|
+
shouldBePassedByEFD = true
|
|
757
|
+
this.success = true
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
if (isTestManagementTestsEnabled && (isDisabled || isQuarantined)) {
|
|
762
|
+
this.success = true
|
|
763
|
+
shouldBePassedByTestManagement = true
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
if (pickleResultByFile[testFileAbsolutePath]) {
|
|
767
|
+
pickleResultByFile[testFileAbsolutePath].push(testStatus)
|
|
768
|
+
} else {
|
|
769
|
+
pickleResultByFile[testFileAbsolutePath] = [testStatus]
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
// If it's a worker, suite events are handled in `getWrappedParseWorkerMessage`
|
|
773
|
+
if (!isWorker && pickleResultByFile[testFileAbsolutePath].length === pickleByFile[testFileAbsolutePath].length) {
|
|
774
|
+
// last test in suite
|
|
775
|
+
const testSuiteStatus = getSuiteStatusFromTestStatuses(pickleResultByFile[testFileAbsolutePath])
|
|
776
|
+
if (global.__coverage__) {
|
|
777
|
+
const coverageFiles = getCoveredFilenamesFromCoverage(global.__coverage__)
|
|
778
|
+
|
|
779
|
+
testSuiteCodeCoverageCh.publish({
|
|
780
|
+
coverageFiles,
|
|
781
|
+
suiteFile: testFileAbsolutePath,
|
|
782
|
+
testSuitePath,
|
|
783
|
+
})
|
|
784
|
+
// We need to reset coverage to get a code coverage per suite
|
|
785
|
+
// Before that, we preserve the original coverage
|
|
786
|
+
mergeCoverage(global.__coverage__, originalCoverageMap)
|
|
787
|
+
resetCoverage(global.__coverage__)
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
testSuiteFinishCh.publish({ status: testSuiteStatus, testSuitePath })
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
if (isNewerCucumberVersion && isEarlyFlakeDetectionEnabled && (isNew || isModified)) {
|
|
794
|
+
return shouldBePassedByEFD
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
if (isNewerCucumberVersion && isTestManagementTestsEnabled && (isQuarantined || isDisabled)) {
|
|
798
|
+
return shouldBePassedByTestManagement
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
return runTestCaseResult
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
function getWrappedParseWorkerMessage (parseWorkerMessageFunction, isNewVersion) {
|
|
806
|
+
return function (worker, message) {
|
|
807
|
+
if (!testSuiteFinishCh.hasSubscribers) {
|
|
808
|
+
return parseWorkerMessageFunction.apply(this, arguments)
|
|
809
|
+
}
|
|
810
|
+
// If the message is an array, it's a dd-trace message, so we need to stop cucumber processing,
|
|
811
|
+
// or cucumber will throw an error
|
|
812
|
+
// TODO: identify the message better
|
|
813
|
+
if (Array.isArray(message)) {
|
|
814
|
+
const [messageCode, payload] = message
|
|
815
|
+
if (messageCode === CUCUMBER_WORKER_TRACE_PAYLOAD_CODE) {
|
|
816
|
+
workerReportTraceCh.publish(payload)
|
|
817
|
+
return
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
const envelope = isNewVersion ? message.envelope : message.jsonEnvelope
|
|
822
|
+
|
|
823
|
+
if (!envelope) {
|
|
824
|
+
return parseWorkerMessageFunction.apply(this, arguments)
|
|
825
|
+
}
|
|
826
|
+
let parsed = envelope
|
|
827
|
+
|
|
828
|
+
if (typeof parsed === 'string') {
|
|
829
|
+
try {
|
|
830
|
+
parsed = JSON.parse(envelope)
|
|
831
|
+
} catch {
|
|
832
|
+
// ignore errors and continue
|
|
833
|
+
return parseWorkerMessageFunction.apply(this, arguments)
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
let pickle
|
|
837
|
+
|
|
838
|
+
if (parsed.testCaseStarted) {
|
|
839
|
+
if (isNewVersion) {
|
|
840
|
+
pickle = this.inProgress[worker.id].pickle
|
|
841
|
+
} else {
|
|
842
|
+
const { pickleId } = this.eventDataCollector.testCaseMap[parsed.testCaseStarted.testCaseId]
|
|
843
|
+
pickle = this.eventDataCollector.getPickle(pickleId)
|
|
844
|
+
}
|
|
845
|
+
// THIS FAILS IN PARALLEL MODE
|
|
846
|
+
const testFileAbsolutePath = pickle.uri
|
|
847
|
+
// First test in suite
|
|
848
|
+
if (!pickleResultByFile[testFileAbsolutePath]) {
|
|
849
|
+
pickleResultByFile[testFileAbsolutePath] = []
|
|
850
|
+
testSuiteStartCh.publish({
|
|
851
|
+
testFileAbsolutePath,
|
|
852
|
+
})
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
const parseWorkerResponse = parseWorkerMessageFunction.apply(this, arguments)
|
|
857
|
+
|
|
858
|
+
// after calling `parseWorkerMessageFunction`, the test status can already be read
|
|
859
|
+
if (parsed.testCaseFinished) {
|
|
860
|
+
let worstTestStepResult
|
|
861
|
+
if (isNewVersion && eventDataCollector) {
|
|
862
|
+
pickle = this.inProgress[worker.id].pickle
|
|
863
|
+
worstTestStepResult =
|
|
864
|
+
eventDataCollector.getTestCaseAttempt(parsed.testCaseFinished.testCaseStartedId).worstTestStepResult
|
|
865
|
+
} else {
|
|
866
|
+
const testCase = this.eventDataCollector.getTestCaseAttempt(parsed.testCaseFinished.testCaseStartedId)
|
|
867
|
+
worstTestStepResult = testCase.worstTestStepResult
|
|
868
|
+
pickle = testCase.pickle
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
const { status } = getStatusFromResultLatest(worstTestStepResult)
|
|
872
|
+
let isNew = false
|
|
873
|
+
|
|
874
|
+
if (isKnownTestsEnabled) {
|
|
875
|
+
isNew = isNewTest(pickle.uri, pickle.name)
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
const testFileAbsolutePath = pickle.uri
|
|
879
|
+
const finished = pickleResultByFile[testFileAbsolutePath]
|
|
880
|
+
|
|
881
|
+
if (isEarlyFlakeDetectionEnabled && isNew) {
|
|
882
|
+
const testFullname = `${pickle.uri}:${pickle.name}`
|
|
883
|
+
let testStatuses = newTestsByTestFullname.get(testFullname)
|
|
884
|
+
if (testStatuses) {
|
|
885
|
+
testStatuses.push(status)
|
|
886
|
+
} else {
|
|
887
|
+
testStatuses = [status]
|
|
888
|
+
newTestsByTestFullname.set(testFullname, testStatuses)
|
|
889
|
+
}
|
|
890
|
+
// We have finished all retries
|
|
891
|
+
if (testStatuses.length === earlyFlakeDetectionNumRetries + 1) {
|
|
892
|
+
const newTestFinalStatus = getTestStatusFromRetries(testStatuses)
|
|
893
|
+
// we only push to `finished` if the retries have finished
|
|
894
|
+
finished.push(newTestFinalStatus)
|
|
895
|
+
}
|
|
896
|
+
} else {
|
|
897
|
+
// TODO: can we get error message?
|
|
898
|
+
const finished = pickleResultByFile[testFileAbsolutePath]
|
|
899
|
+
finished.push(status)
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
if (finished.length === pickleByFile[testFileAbsolutePath].length) {
|
|
903
|
+
testSuiteFinishCh.publish({
|
|
904
|
+
status: getSuiteStatusFromTestStatuses(finished),
|
|
905
|
+
testSuitePath: getTestSuitePath(testFileAbsolutePath, process.cwd()),
|
|
906
|
+
})
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
return parseWorkerResponse
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
// Test start / finish for older versions. The only hook executed in workers when in parallel mode
|
|
915
|
+
addHook({
|
|
916
|
+
name: '@cucumber/cucumber',
|
|
917
|
+
versions: ['7.0.0 - 7.2.1'],
|
|
918
|
+
file: 'lib/runtime/pickle_runner.js',
|
|
919
|
+
}, pickleHook)
|
|
920
|
+
|
|
921
|
+
// Test start / finish for newer versions. The only hook executed in workers when in parallel mode
|
|
922
|
+
addHook({
|
|
923
|
+
name: '@cucumber/cucumber',
|
|
924
|
+
versions: ['>=7.3.0'],
|
|
925
|
+
file: 'lib/runtime/test_case_runner.js',
|
|
926
|
+
}, testCaseHook)
|
|
927
|
+
|
|
928
|
+
// From 7.3.0 onwards, runPickle becomes runTestCase. Not executed in parallel mode.
|
|
929
|
+
// `getWrappedStart` generates session start and finish events
|
|
930
|
+
// `getWrappedRunTestCase` generates suite start and finish events and handles EFD.
|
|
931
|
+
// TODO (fix): there is a lib/runtime/index in >=11.0.0, but we don't instrument it because it's not useful for us
|
|
932
|
+
// This causes a info log saying "Found incompatible integration version".
|
|
933
|
+
addHook({
|
|
934
|
+
name: '@cucumber/cucumber',
|
|
935
|
+
versions: ['>=7.3.0 <11.0.0'],
|
|
936
|
+
file: 'lib/runtime/index.js',
|
|
937
|
+
}, (runtimePackage, frameworkVersion) => {
|
|
938
|
+
shimmer.wrap(runtimePackage.default.prototype, 'runTestCase', runTestCase => getWrappedRunTestCase(runTestCase))
|
|
939
|
+
|
|
940
|
+
shimmer.wrap(runtimePackage.default.prototype, 'start', start => getWrappedStart(start, frameworkVersion))
|
|
941
|
+
|
|
942
|
+
return runtimePackage
|
|
943
|
+
})
|
|
944
|
+
|
|
945
|
+
// Not executed in parallel mode.
|
|
946
|
+
// `getWrappedStart` generates session start and finish events
|
|
947
|
+
// `getWrappedRunTestCase` generates suite start and finish events and handles EFD.
|
|
948
|
+
addHook({
|
|
949
|
+
name: '@cucumber/cucumber',
|
|
950
|
+
versions: ['>=7.0.0 <7.3.0'],
|
|
951
|
+
file: 'lib/runtime/index.js',
|
|
952
|
+
}, (runtimePackage, frameworkVersion) => {
|
|
953
|
+
shimmer.wrap(runtimePackage.default.prototype, 'runPickle', runPickle => getWrappedRunTestCase(runPickle))
|
|
954
|
+
shimmer.wrap(runtimePackage.default.prototype, 'start', start => getWrappedStart(start, frameworkVersion))
|
|
955
|
+
|
|
956
|
+
return runtimePackage
|
|
957
|
+
})
|
|
958
|
+
|
|
959
|
+
// Only executed in parallel mode.
|
|
960
|
+
// `getWrappedStart` generates session start and finish events
|
|
961
|
+
// `getWrappedParseWorkerMessage` generates suite start and finish events
|
|
962
|
+
addHook({
|
|
963
|
+
name: '@cucumber/cucumber',
|
|
964
|
+
versions: ['>=8.0.0 <11.0.0'],
|
|
965
|
+
file: 'lib/runtime/parallel/coordinator.js',
|
|
966
|
+
}, (coordinatorPackage, frameworkVersion) => {
|
|
967
|
+
shimmer.wrap(coordinatorPackage.default.prototype, 'start', start => getWrappedStart(start, frameworkVersion, true))
|
|
968
|
+
shimmer.wrap(
|
|
969
|
+
coordinatorPackage.default.prototype,
|
|
970
|
+
'parseWorkerMessage',
|
|
971
|
+
parseWorkerMessage => getWrappedParseWorkerMessage(parseWorkerMessage)
|
|
972
|
+
)
|
|
973
|
+
return coordinatorPackage
|
|
974
|
+
})
|
|
975
|
+
|
|
976
|
+
// >=11.0.0 hooks
|
|
977
|
+
// `getWrappedRunTestCase` does two things:
|
|
978
|
+
// - generates suite start and finish events in the main process,
|
|
979
|
+
// - handles EFD in both the main process and the worker process.
|
|
980
|
+
addHook({
|
|
981
|
+
name: '@cucumber/cucumber',
|
|
982
|
+
versions: ['>=11.0.0'],
|
|
983
|
+
file: 'lib/runtime/worker.js',
|
|
984
|
+
}, (workerPackage) => {
|
|
985
|
+
shimmer.wrap(
|
|
986
|
+
workerPackage.Worker.prototype,
|
|
987
|
+
'runTestCase',
|
|
988
|
+
runTestCase => getWrappedRunTestCase(runTestCase, true, !!getEnvironmentVariable('CUCUMBER_WORKER_ID'))
|
|
989
|
+
)
|
|
990
|
+
return workerPackage
|
|
991
|
+
})
|
|
992
|
+
|
|
993
|
+
// `getWrappedStart` generates session start and finish events
|
|
994
|
+
addHook({
|
|
995
|
+
name: '@cucumber/cucumber',
|
|
996
|
+
versions: ['>=11.0.0'],
|
|
997
|
+
file: 'lib/runtime/coordinator.js',
|
|
998
|
+
}, (coordinatorPackage, frameworkVersion) => {
|
|
999
|
+
shimmer.wrap(
|
|
1000
|
+
coordinatorPackage.Coordinator.prototype,
|
|
1001
|
+
'run',
|
|
1002
|
+
run => getWrappedStart(run, frameworkVersion, false, true)
|
|
1003
|
+
)
|
|
1004
|
+
return coordinatorPackage
|
|
1005
|
+
})
|
|
1006
|
+
|
|
1007
|
+
// Necessary because `eventDataCollector` is no longer available in the runtime instance
|
|
1008
|
+
addHook({
|
|
1009
|
+
name: '@cucumber/cucumber',
|
|
1010
|
+
versions: ['>=11.0.0'],
|
|
1011
|
+
file: 'lib/formatter/helpers/event_data_collector.js',
|
|
1012
|
+
}, (eventDataCollectorPackage) => {
|
|
1013
|
+
shimmer.wrap(eventDataCollectorPackage.default.prototype, 'parseEnvelope', parseEnvelope => function () {
|
|
1014
|
+
eventDataCollector = this
|
|
1015
|
+
return parseEnvelope.apply(this, arguments)
|
|
1016
|
+
})
|
|
1017
|
+
return eventDataCollectorPackage
|
|
1018
|
+
})
|
|
1019
|
+
|
|
1020
|
+
// Only executed in parallel mode for >=11, in the main process.
|
|
1021
|
+
// `getWrappedParseWorkerMessage` generates suite start and finish events
|
|
1022
|
+
// In `startWorker` we pass early flake detection info to the worker.
|
|
1023
|
+
addHook({
|
|
1024
|
+
name: '@cucumber/cucumber',
|
|
1025
|
+
versions: ['>=11.0.0'],
|
|
1026
|
+
file: 'lib/runtime/parallel/adapter.js',
|
|
1027
|
+
}, (adapterPackage) => {
|
|
1028
|
+
shimmer.wrap(
|
|
1029
|
+
adapterPackage.ChildProcessAdapter.prototype,
|
|
1030
|
+
'parseWorkerMessage',
|
|
1031
|
+
parseWorkerMessage => getWrappedParseWorkerMessage(parseWorkerMessage, true)
|
|
1032
|
+
)
|
|
1033
|
+
// EFD in parallel mode only supported in >=11.0.0
|
|
1034
|
+
shimmer.wrap(adapterPackage.ChildProcessAdapter.prototype, 'startWorker', startWorker => function () {
|
|
1035
|
+
if (isKnownTestsEnabled && isValidKnownTests(knownTests)) {
|
|
1036
|
+
this.options.worldParameters._ddIsKnownTestsEnabled = true
|
|
1037
|
+
this.options.worldParameters._ddIsEarlyFlakeDetectionEnabled = isEarlyFlakeDetectionEnabled
|
|
1038
|
+
this.options.worldParameters._ddKnownTests = knownTests
|
|
1039
|
+
this.options.worldParameters._ddEarlyFlakeDetectionNumRetries = earlyFlakeDetectionNumRetries
|
|
1040
|
+
} else {
|
|
1041
|
+
isEarlyFlakeDetectionEnabled = false
|
|
1042
|
+
isKnownTestsEnabled = false
|
|
1043
|
+
this.options.worldParameters._ddIsEarlyFlakeDetectionEnabled = false
|
|
1044
|
+
this.options.worldParameters._ddIsKnownTestsEnabled = false
|
|
1045
|
+
this.options.worldParameters._ddEarlyFlakeDetectionNumRetries = 0
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
if (isImpactedTestsEnabled) {
|
|
1049
|
+
this.options.worldParameters._ddImpactedTestsEnabled = isImpactedTestsEnabled
|
|
1050
|
+
this.options.worldParameters._ddModifiedFiles = modifiedFiles
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
this.options.worldParameters._ddIsFlakyTestRetriesEnabled = isFlakyTestRetriesEnabled
|
|
1054
|
+
this.options.worldParameters._ddNumTestRetries = numTestRetries
|
|
1055
|
+
|
|
1056
|
+
return startWorker.apply(this, arguments)
|
|
1057
|
+
})
|
|
1058
|
+
return adapterPackage
|
|
1059
|
+
})
|
|
1060
|
+
|
|
1061
|
+
// Hook executed in the worker process when in parallel mode.
|
|
1062
|
+
// In this hook we read the information passed in `worldParameters` and make it available for
|
|
1063
|
+
// `getWrappedRunTestCase`.
|
|
1064
|
+
addHook({
|
|
1065
|
+
name: '@cucumber/cucumber',
|
|
1066
|
+
versions: ['>=11.0.0'],
|
|
1067
|
+
file: 'lib/runtime/parallel/worker.js',
|
|
1068
|
+
}, (workerPackage) => {
|
|
1069
|
+
shimmer.wrap(
|
|
1070
|
+
workerPackage.ChildProcessWorker.prototype,
|
|
1071
|
+
'initialize',
|
|
1072
|
+
initialize => async function () {
|
|
1073
|
+
await initialize.apply(this, arguments)
|
|
1074
|
+
isKnownTestsEnabled = !!this.options.worldParameters._ddIsKnownTestsEnabled
|
|
1075
|
+
if (isKnownTestsEnabled) {
|
|
1076
|
+
knownTests = this.options.worldParameters._ddKnownTests
|
|
1077
|
+
// if for whatever reason the worker does not receive valid known tests, we disable EFD and known tests
|
|
1078
|
+
if (!isValidKnownTests(knownTests)) {
|
|
1079
|
+
isKnownTestsEnabled = false
|
|
1080
|
+
knownTests = {}
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
isEarlyFlakeDetectionEnabled = !!this.options.worldParameters._ddIsEarlyFlakeDetectionEnabled
|
|
1084
|
+
if (isEarlyFlakeDetectionEnabled) {
|
|
1085
|
+
earlyFlakeDetectionNumRetries = this.options.worldParameters._ddEarlyFlakeDetectionNumRetries
|
|
1086
|
+
}
|
|
1087
|
+
isImpactedTestsEnabled = !!this.options.worldParameters._ddImpactedTestsEnabled
|
|
1088
|
+
if (isImpactedTestsEnabled) {
|
|
1089
|
+
modifiedFiles = this.options.worldParameters._ddModifiedFiles
|
|
1090
|
+
}
|
|
1091
|
+
isFlakyTestRetriesEnabled = !!this.options.worldParameters._ddIsFlakyTestRetriesEnabled
|
|
1092
|
+
numTestRetries = this.options.worldParameters._ddNumTestRetries ?? 0
|
|
1093
|
+
}
|
|
1094
|
+
)
|
|
1095
|
+
return workerPackage
|
|
1096
|
+
})
|