dd-trace 5.71.0 → 5.72.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.
Files changed (63) hide show
  1. package/LICENSE-3rdparty.csv +5 -0
  2. package/index.d.ts +93 -1
  3. package/package.json +21 -2
  4. package/packages/datadog-instrumentations/src/azure-event-hubs.js +37 -0
  5. package/packages/datadog-instrumentations/src/azure-functions.js +3 -0
  6. package/packages/datadog-instrumentations/src/cucumber.js +7 -7
  7. package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -0
  8. package/packages/datadog-instrumentations/src/jest.js +29 -36
  9. package/packages/datadog-instrumentations/src/mocha/main.js +8 -9
  10. package/packages/datadog-instrumentations/src/mocha/utils.js +1 -1
  11. package/packages/datadog-instrumentations/src/mocha/worker.js +2 -2
  12. package/packages/datadog-instrumentations/src/pg.js +1 -1
  13. package/packages/datadog-instrumentations/src/playwright.js +5 -5
  14. package/packages/datadog-instrumentations/src/vitest.js +8 -8
  15. package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +73 -27
  16. package/packages/datadog-plugin-azure-event-hubs/src/index.js +15 -0
  17. package/packages/datadog-plugin-azure-event-hubs/src/producer.js +82 -0
  18. package/packages/datadog-plugin-azure-functions/src/index.js +37 -0
  19. package/packages/datadog-plugin-cucumber/src/index.js +3 -3
  20. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +9 -9
  21. package/packages/datadog-plugin-jest/src/util.js +10 -2
  22. package/packages/datadog-plugin-mocha/src/index.js +2 -2
  23. package/packages/datadog-plugin-playwright/src/index.js +2 -2
  24. package/packages/datadog-plugin-vitest/src/index.js +2 -2
  25. package/packages/datadog-plugin-ws/src/server.js +5 -3
  26. package/packages/dd-trace/src/config.js +108 -26
  27. package/packages/dd-trace/src/config_defaults.js +12 -0
  28. package/packages/dd-trace/src/git_properties.js +90 -5
  29. package/packages/dd-trace/src/noop/proxy.js +3 -0
  30. package/packages/dd-trace/src/openfeature/constants/constants.js +51 -0
  31. package/packages/dd-trace/src/openfeature/flagging_provider.js +45 -0
  32. package/packages/dd-trace/src/openfeature/index.js +77 -0
  33. package/packages/dd-trace/src/openfeature/noop.js +101 -0
  34. package/packages/dd-trace/src/openfeature/writers/base.js +181 -0
  35. package/packages/dd-trace/src/openfeature/writers/exposures.js +173 -0
  36. package/packages/dd-trace/src/openfeature/writers/util.js +43 -0
  37. package/packages/dd-trace/src/opentelemetry/logs/batch_log_processor.js +100 -0
  38. package/packages/dd-trace/src/opentelemetry/logs/index.js +87 -0
  39. package/packages/dd-trace/src/opentelemetry/logs/logger.js +77 -0
  40. package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +126 -0
  41. package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +173 -0
  42. package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +367 -0
  43. package/packages/dd-trace/src/opentelemetry/protos/common.proto +116 -0
  44. package/packages/dd-trace/src/opentelemetry/protos/logs.proto +226 -0
  45. package/packages/dd-trace/src/opentelemetry/protos/logs_service.proto +78 -0
  46. package/packages/dd-trace/src/opentelemetry/protos/protobuf_loader.js +48 -0
  47. package/packages/dd-trace/src/opentelemetry/protos/resource.proto +45 -0
  48. package/packages/dd-trace/src/plugins/ci_plugin.js +7 -6
  49. package/packages/dd-trace/src/plugins/index.js +1 -0
  50. package/packages/dd-trace/src/plugins/util/test.js +6 -5
  51. package/packages/dd-trace/src/profiling/config.js +21 -1
  52. package/packages/dd-trace/src/profiling/exporters/event_serializer.js +3 -2
  53. package/packages/dd-trace/src/profiling/profiler.js +44 -22
  54. package/packages/dd-trace/src/profiling/profilers/events.js +12 -3
  55. package/packages/dd-trace/src/profiling/profilers/space.js +35 -24
  56. package/packages/dd-trace/src/profiling/profilers/wall.js +14 -6
  57. package/packages/dd-trace/src/proxy.js +22 -1
  58. package/packages/dd-trace/src/remote_config/capabilities.js +1 -0
  59. package/packages/dd-trace/src/remote_config/index.js +1 -0
  60. package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +4 -0
  61. package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +8 -0
  62. package/packages/dd-trace/src/supported-configurations.json +17 -0
  63. package/packages/dd-trace/src/telemetry/telemetry.js +13 -1
@@ -3,11 +3,14 @@ require,@datadog/libdatadog,Apache license 2.0,Copyright 2024 Datadog Inc.
3
3
  require,@datadog/native-appsec,Apache license 2.0,Copyright 2018 Datadog Inc.
4
4
  require,@datadog/native-metrics,Apache license 2.0,Copyright 2018 Datadog Inc.
5
5
  require,@datadog/native-iast-taint-tracking,Apache license 2.0,Copyright 2018 Datadog Inc.
6
+ require,@datadog/openfeature-node-server,Apache license 2.0,Copyright 2024 Datadog Inc.
6
7
  require,@datadog/pprof,Apache license 2.0,Copyright 2019 Google Inc.
7
8
  require,@datadog/sketches-js,Apache license 2.0,Copyright 2020 Datadog Inc.
8
9
  require,@datadog/wasm-js-rewriter,Apache license 2.0,Copyright 2018 Datadog Inc.
9
10
  require,@opentelemetry/api,Apache license 2.0,Copyright OpenTelemetry Authors
11
+ require,@opentelemetry/api-logs,Apache license 2.0,Copyright OpenTelemetry Authors
10
12
  require,@opentelemetry/core,Apache license 2.0,Copyright OpenTelemetry Authors
13
+ require,@opentelemetry/resources,Apache license 2.0,Copyright OpenTelemetry Authors
11
14
  require,@isaacs/ttlcache,ISC,Copyright (c) 2022-2023 - Isaac Z. Schlueter and Contributors
12
15
  require,crypto-randomuuid,MIT,Copyright 2021 Node.js Foundation and contributors
13
16
  require,dc-polyfill,MIT,Copyright 2023 Datadog Inc.
@@ -41,6 +44,8 @@ dev,@types/tap,MIT,Copyright (c) Microsoft Corp.
41
44
  dev,@eslint/eslintrc,MIT,Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
42
45
  dev,@eslint/js,MIT,Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
43
46
  dev,@msgpack/msgpack,ISC,Copyright 2019 The MessagePack Community
47
+ dev,@openfeature/core,Apache-2.0,Copyright OpenFeature Authors
48
+ dev,@openfeature/server-sdk,Apache-2.0,Copyright OpenFeature Authors
44
49
  dev,@stylistic/eslint-plugin,MIT,Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
45
50
  dev,axios,MIT,Copyright 2014-present Matt Zabriskie
46
51
  dev,benchmark,MIT,Copyright 2010-2016 Mathias Bynens Robert Kieffer John-David Dalton
package/index.d.ts CHANGED
@@ -139,6 +139,16 @@ interface Tracer extends opentracing.Tracer {
139
139
  */
140
140
  llmobs: tracer.llmobs.LLMObs;
141
141
 
142
+ /**
143
+ * OpenFeature Provider with Remote Config integration.
144
+ *
145
+ * Extends DatadogNodeServerProvider with Remote Config integration for dynamic flag configuration.
146
+ * Enable with DD_FLAGGING_PROVIDER_ENABLED=true.
147
+ *
148
+ * @beta This feature is in preview and not ready for production use
149
+ */
150
+ openfeature: tracer.OpenFeatureProvider;
151
+
142
152
  /**
143
153
  * AI Guard SDK
144
154
  */
@@ -172,6 +182,7 @@ interface Plugins {
172
182
  "apollo": tracer.plugins.apollo;
173
183
  "avsc": tracer.plugins.avsc;
174
184
  "aws-sdk": tracer.plugins.aws_sdk;
185
+ "azure-event-hubs": tracer.plugins.azure_event_hubs;
175
186
  "azure-functions": tracer.plugins.azure_functions;
176
187
  "azure-service-bus": tracer.plugins.azure_service_bus;
177
188
  "bunyan": tracer.plugins.bunyan;
@@ -199,7 +210,7 @@ interface Plugins {
199
210
  "ioredis": tracer.plugins.ioredis;
200
211
  "iovalkey": tracer.plugins.iovalkey;
201
212
  "jest": tracer.plugins.jest;
202
- "kafkajs": tracer.plugins.kafkajs
213
+ "kafkajs": tracer.plugins.kafkajs;
203
214
  "knex": tracer.plugins.knex;
204
215
  "koa": tracer.plugins.koa;
205
216
  "langchain": tracer.plugins.langchain;
@@ -623,6 +634,21 @@ declare namespace tracer {
623
634
  */
624
635
  maxContentSize?: number
625
636
  }
637
+
638
+ /**
639
+ * Configuration for Feature Flagging & Experimentation.
640
+ *
641
+ * @beta This feature is in preview and not ready for production use
642
+ */
643
+ flaggingProvider?: {
644
+ /**
645
+ * Whether to enable the feature flagging provider.
646
+ * Requires Remote Config to be properly configured.
647
+ *
648
+ * @default false
649
+ */
650
+ enabled?: boolean
651
+ }
626
652
  };
627
653
 
628
654
  /**
@@ -1098,6 +1124,65 @@ declare namespace tracer {
1098
1124
  eventTrackingV2: EventTrackingV2
1099
1125
  }
1100
1126
 
1127
+ /**
1128
+ * Flagging Provider (OpenFeature-compatible).
1129
+ *
1130
+ * Wraps @datadog/openfeature-node-server with Remote Config integration for dynamic flag configuration.
1131
+ * Implements the OpenFeature Provider interface for flag evaluation.
1132
+ *
1133
+ * @beta This feature is in preview and not ready for production use
1134
+ */
1135
+ export interface OpenFeatureProvider {
1136
+ /**
1137
+ * Metadata about this provider.
1138
+ */
1139
+ metadata: { name: string; [key: string]: any };
1140
+
1141
+ /**
1142
+ * Resolves a boolean flag value.
1143
+ *
1144
+ * @param flagKey The key of the flag to evaluate
1145
+ * @param defaultValue The default value to return if evaluation fails
1146
+ * @param context Evaluation context (e.g., user attributes)
1147
+ * @param logger Optional logger instance
1148
+ * @returns Promise resolving to evaluation result with value and reason
1149
+ */
1150
+ resolveBooleanEvaluation(flagKey: string, defaultValue: boolean, context: object, logger: object): Promise<{ value: boolean; reason?: string; [key: string]: any }>;
1151
+
1152
+ /**
1153
+ * Resolves a string flag value.
1154
+ *
1155
+ * @param flagKey The key of the flag to evaluate
1156
+ * @param defaultValue The default value to return if evaluation fails
1157
+ * @param context Evaluation context (e.g., user attributes)
1158
+ * @param logger Optional logger instance
1159
+ * @returns Promise resolving to evaluation result with value and reason
1160
+ */
1161
+ resolveStringEvaluation(flagKey: string, defaultValue: string, context: object, logger: object): Promise<{ value: string; reason?: string; [key: string]: any }>;
1162
+
1163
+ /**
1164
+ * Resolves a number flag value.
1165
+ *
1166
+ * @param flagKey The key of the flag to evaluate
1167
+ * @param defaultValue The default value to return if evaluation fails
1168
+ * @param context Evaluation context (e.g., user attributes)
1169
+ * @param logger Optional logger instance
1170
+ * @returns Promise resolving to evaluation result with value and reason
1171
+ */
1172
+ resolveNumberEvaluation(flagKey: string, defaultValue: number, context: object, logger: object): Promise<{ value: number; reason?: string; [key: string]: any }>;
1173
+
1174
+ /**
1175
+ * Resolves an object flag value.
1176
+ *
1177
+ * @param flagKey The key of the flag to evaluate
1178
+ * @param defaultValue The default value to return if evaluation fails
1179
+ * @param context Evaluation context (e.g., user attributes)
1180
+ * @param logger Optional logger instance
1181
+ * @returns Promise resolving to evaluation result with value and reason
1182
+ */
1183
+ resolveObjectEvaluation<T = any>(flagKey: string, defaultValue: T, context: object, logger: object): Promise<{ value: T; reason?: string; [key: string]: any }>;
1184
+ }
1185
+
1101
1186
  export namespace aiguard {
1102
1187
 
1103
1188
  /**
@@ -1618,6 +1703,12 @@ declare namespace tracer {
1618
1703
  [key: string]: boolean | Object | undefined;
1619
1704
  }
1620
1705
 
1706
+ /**
1707
+ * This plugin automatically instruments the
1708
+ * @azure/event-hubs module
1709
+ */
1710
+ interface azure_event_hubs extends Integration {}
1711
+
1621
1712
  /**
1622
1713
  * This plugin automatically instruments the
1623
1714
  * @azure/functions module.
@@ -1629,6 +1720,7 @@ declare namespace tracer {
1629
1720
  * @azure/service-bus module
1630
1721
  */
1631
1722
  interface azure_service_bus extends Integration {}
1723
+
1632
1724
  /**
1633
1725
  * This plugin patches the [bunyan](https://github.com/trentm/node-bunyan)
1634
1726
  * to automatically inject trace identifiers in log records when the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dd-trace",
3
- "version": "5.71.0",
3
+ "version": "5.72.0",
4
4
  "description": "Datadog APM tracing client for JavaScript",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -46,6 +46,7 @@
46
46
  "test:llmobs:plugins:ci": "yarn services && nyc --no-clean --include \"packages/dd-trace/src/llmobs/**/*.js\" -- npm run test:llmobs:plugins",
47
47
  "test:plugins": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/datadog-plugin-@($(echo $PLUGINS))/test/**/*.spec.js\"",
48
48
  "test:plugins:ci": "yarn services && nyc --no-clean --include \"packages/datadog-plugin-@($(echo $PLUGINS))/src/**/*.js\" -- npm run test:plugins",
49
+ "test:plugins:ci:flaky": "yarn services && nyc --no-clean --include \"packages/datadog-plugin-@($(echo $PLUGINS))/src/**/*.js\" -- npm run test:plugins -- --bail --retries 2",
49
50
  "test:plugins:upstream": "node ./packages/dd-trace/test/plugins/suite.js",
50
51
  "test:profiler": "tap \"packages/dd-trace/test/profiling/**/*.spec.js\"",
51
52
  "test:profiler:ci": "npm run test:profiler -- --coverage --nyc-arg=--include=\"packages/dd-trace/src/profiling/**/*.js\"",
@@ -56,6 +57,7 @@
56
57
  "test:integration:cypress": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/cypress/*.spec.js\"",
57
58
  "test:integration:debugger": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/debugger/*.spec.js\"",
58
59
  "test:integration:esbuild": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/esbuild/*.spec.js\"",
60
+ "test:integration:openfeature": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/openfeature/*.spec.js\"",
59
61
  "test:integration:jest": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/jest/*.spec.js\"",
60
62
  "test:integration:mocha": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/mocha/*.spec.js\"",
61
63
  "test:integration:playwright": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/playwright/*.spec.js\"",
@@ -121,12 +123,15 @@
121
123
  "@datadog/native-appsec": "10.2.1",
122
124
  "@datadog/native-iast-taint-tracking": "4.0.0",
123
125
  "@datadog/native-metrics": "3.1.1",
124
- "@datadog/pprof": "5.10.0",
126
+ "@datadog/openfeature-node-server": "0.1.0-preview.10",
127
+ "@datadog/pprof": "5.11.1",
125
128
  "@datadog/sketches-js": "2.1.1",
126
129
  "@datadog/wasm-js-rewriter": "4.0.1",
127
130
  "@isaacs/ttlcache": "^1.4.1",
128
131
  "@opentelemetry/api": ">=1.0.0 <1.10.0",
132
+ "@opentelemetry/api-logs": "<1.0.0",
129
133
  "@opentelemetry/core": ">=1.14.0 <1.31.0",
134
+ "@opentelemetry/resources": ">=1.0.0 <1.10.0",
130
135
  "crypto-randomuuid": "^1.0.0",
131
136
  "dc-polyfill": "^0.1.10",
132
137
  "ignore": "^7.0.5",
@@ -151,11 +156,25 @@
151
156
  "tlhunter-sorted-set": "^0.1.0",
152
157
  "ttl-set": "^1.0.0"
153
158
  },
159
+ "peerDependencies": {
160
+ "@openfeature/core": "^1.9.0",
161
+ "@openfeature/server-sdk": "~1.18.0"
162
+ },
163
+ "peerDependenciesMeta": {
164
+ "@openfeature/core": {
165
+ "optional": true
166
+ },
167
+ "@openfeature/server-sdk": {
168
+ "optional": true
169
+ }
170
+ },
154
171
  "devDependencies": {
155
172
  "@babel/helpers": "^7.27.6",
156
173
  "@eslint/eslintrc": "^3.3.1",
157
174
  "@eslint/js": "^9.29.0",
158
175
  "@msgpack/msgpack": "^3.1.2",
176
+ "@openfeature/core": "^1.8.1",
177
+ "@openfeature/server-sdk": "~1.18.0",
159
178
  "@stylistic/eslint-plugin": "^5.0.0",
160
179
  "@types/chai": "^4.3.16",
161
180
  "@types/mocha": "^10.0.10",
@@ -0,0 +1,37 @@
1
+ 'use strict'
2
+
3
+ const {
4
+ addHook
5
+ } = require('./helpers/instrument')
6
+ const shimmer = require('../../datadog-shimmer')
7
+ const dc = require('dc-polyfill')
8
+
9
+ const producerCh = dc.tracingChannel('apm:azure-event-hubs:send')
10
+
11
+ addHook({
12
+ name: '@azure/event-hubs',
13
+ versions: ['>=6.0.0']
14
+ }, obj => {
15
+ const EventHubProducerClient = obj.EventHubProducerClient
16
+ shimmer.wrap(EventHubProducerClient.prototype, 'createBatch',
17
+ createBatch => async function () {
18
+ const batch = await createBatch.apply(this, arguments)
19
+ shimmer.wrap(batch, 'tryAdd',
20
+ tryAdd => function (eventData) {
21
+ const config = this._context.config
22
+ const functionName = tryAdd.name
23
+ return producerCh.tracePromise(
24
+ tryAdd,
25
+ { functionName, eventData, batch: this, config },
26
+ this, ...arguments)
27
+ })
28
+ return batch
29
+ })
30
+ shimmer.wrap(EventHubProducerClient.prototype, 'sendBatch',
31
+ sendBatch => function (eventData) {
32
+ const config = this._context.config
33
+ const functionName = sendBatch.name
34
+ return producerCh.tracePromise(sendBatch, { functionName, eventData, config }, this, ...arguments)
35
+ })
36
+ return obj
37
+ })
@@ -23,6 +23,9 @@ addHook({ name: '@azure/functions', versions: ['>=4'], patchDefault: false }, (a
23
23
  shimmer.wrap(app, 'serviceBusQueue', wrapHandler)
24
24
  shimmer.wrap(app, 'serviceBusTopic', wrapHandler)
25
25
 
26
+ // Event Hub triggers
27
+ shimmer.wrap(app, 'eventHub', wrapHandler)
28
+
26
29
  return azureFunction
27
30
  })
28
31
 
@@ -25,7 +25,7 @@ const skippableSuitesCh = channel('ci:cucumber:test-suite:skippable')
25
25
  const sessionStartCh = channel('ci:cucumber:session:start')
26
26
  const sessionFinishCh = channel('ci:cucumber:session:finish')
27
27
  const testManagementTestsCh = channel('ci:cucumber:test-management-tests')
28
- const impactedTestsCh = channel('ci:cucumber:modified-tests')
28
+ const modifiedFilesCh = channel('ci:cucumber:modified-files')
29
29
  const isModifiedCh = channel('ci:cucumber:is-modified-test')
30
30
 
31
31
  const workerReportTraceCh = channel('ci:cucumber:worker-report:trace')
@@ -80,7 +80,7 @@ let isTestManagementTestsEnabled = false
80
80
  let isImpactedTestsEnabled = false
81
81
  let testManagementAttemptToFixRetries = 0
82
82
  let testManagementTests = {}
83
- let modifiedTests = {}
83
+ let modifiedFiles = {}
84
84
  let numTestRetries = 0
85
85
  let knownTests = {}
86
86
  let skippedSuites = []
@@ -537,9 +537,9 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
537
537
  }
538
538
 
539
539
  if (isImpactedTestsEnabled) {
540
- const impactedTestsResponse = await getChannelPromise(impactedTestsCh)
540
+ const impactedTestsResponse = await getChannelPromise(modifiedFilesCh)
541
541
  if (!impactedTestsResponse.err) {
542
- modifiedTests = impactedTestsResponse.modifiedTests
542
+ modifiedFiles = impactedTestsResponse.modifiedFiles
543
543
  }
544
544
  }
545
545
 
@@ -655,7 +655,7 @@ function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = fa
655
655
  isModifiedCh.publish({
656
656
  scenarios,
657
657
  testFileAbsolutePath: gherkinDocument.uri,
658
- modifiedTests,
658
+ modifiedFiles,
659
659
  stepIds,
660
660
  stepDefinitions: this.supportCodeLibrary.stepDefinitions,
661
661
  setIsModified
@@ -1000,7 +1000,7 @@ addHook({
1000
1000
 
1001
1001
  if (isImpactedTestsEnabled) {
1002
1002
  this.options.worldParameters._ddImpactedTestsEnabled = isImpactedTestsEnabled
1003
- this.options.worldParameters._ddModifiedTests = modifiedTests
1003
+ this.options.worldParameters._ddModifiedFiles = modifiedFiles
1004
1004
  }
1005
1005
 
1006
1006
  return startWorker.apply(this, arguments)
@@ -1036,7 +1036,7 @@ addHook({
1036
1036
  }
1037
1037
  isImpactedTestsEnabled = !!this.options.worldParameters._ddImpactedTestsEnabled
1038
1038
  if (isImpactedTestsEnabled) {
1039
- modifiedTests = this.options.worldParameters._ddModifiedTests
1039
+ modifiedFiles = this.options.worldParameters._ddModifiedFiles
1040
1040
  }
1041
1041
  }
1042
1042
  )
@@ -6,6 +6,7 @@ module.exports = {
6
6
  '@apollo/gateway': () => require('../apollo'),
7
7
  'apollo-server-core': () => require('../apollo-server-core'),
8
8
  '@aws-sdk/smithy-client': () => require('../aws-sdk'),
9
+ '@azure/event-hubs': () => require('../azure-event-hubs'),
9
10
  '@azure/functions': () => require('../azure-functions'),
10
11
  '@azure/service-bus': () => require('../azure-service-bus'),
11
12
  '@cucumber/cucumber': () => require('../cucumber'),
@@ -46,7 +46,7 @@ const skippableSuitesCh = channel('ci:jest:test-suite:skippable')
46
46
  const libraryConfigurationCh = channel('ci:jest:library-configuration')
47
47
  const knownTestsCh = channel('ci:jest:known-tests')
48
48
  const testManagementTestsCh = channel('ci:jest:test-management-tests')
49
- const impactedTestsCh = channel('ci:jest:modified-tests')
49
+ const modifiedFilesCh = channel('ci:jest:modified-files')
50
50
 
51
51
  const itrSkippedSuitesCh = channel('ci:jest:itr:skipped-suites')
52
52
 
@@ -78,7 +78,7 @@ let isTestManagementTestsEnabled = false
78
78
  let testManagementTests = {}
79
79
  let testManagementAttemptToFixRetries = 0
80
80
  let isImpactedTestsEnabled = false
81
- let modifiedTests = {}
81
+ let modifiedFiles = {}
82
82
 
83
83
  const testContexts = new WeakMap()
84
84
  const originalTestFns = new WeakMap()
@@ -89,6 +89,7 @@ const attemptToFixRetriedTestsStatuses = new Map()
89
89
  const wrappedWorkers = new WeakSet()
90
90
  const testSuiteMockedFiles = new Map()
91
91
  const testsToBeRetried = new Set()
92
+ const testSuiteAbsolutePathsWithFastCheck = new Set()
92
93
 
93
94
  const BREAKPOINT_HIT_GRACE_PERIOD_MS = 200
94
95
 
@@ -197,10 +198,8 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
197
198
 
198
199
  if (this.isImpactedTestsEnabled) {
199
200
  try {
200
- const hasImpactedTests = Object.keys(modifiedTests).length > 0
201
- this.modifiedTestsForThisSuite = hasImpactedTests
202
- ? this.getModifiedTestForThisSuite(modifiedTests)
203
- : this.getModifiedTestForThisSuite(this.testEnvironmentOptions._ddModifiedTests)
201
+ const hasImpactedTests = Object.keys(modifiedFiles).length > 0
202
+ this.modifiedFiles = hasImpactedTests ? modifiedFiles : this.testEnvironmentOptions._ddModifiedFiles
204
203
  } catch (e) {
205
204
  log.error('Error parsing impacted tests', e)
206
205
  this.isImpactedTestsEnabled = false
@@ -290,19 +289,6 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
290
289
  return result
291
290
  }
292
291
 
293
- getModifiedTestForThisSuite (modifiedTests) {
294
- if (this.modifiedTestsForThisSuite) {
295
- return this.modifiedTestsForThisSuite
296
- }
297
- let modifiedTestsForThisSuite = modifiedTests
298
- // If jest is using workers, modified tests are serialized to json.
299
- // If jest runs in band, they are not.
300
- if (typeof modifiedTestsForThisSuite === 'string') {
301
- modifiedTestsForThisSuite = JSON.parse(modifiedTestsForThisSuite)
302
- }
303
- return modifiedTestsForThisSuite
304
- }
305
-
306
292
  // Generic function to handle test retries
307
293
  retryTest ({
308
294
  jestEvent,
@@ -319,9 +305,13 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
319
305
  }
320
306
  }
321
307
 
308
+ getShouldStripSeedFromTestName () {
309
+ return testSuiteAbsolutePathsWithFastCheck.has(this.testSuiteAbsolutePath)
310
+ }
311
+
322
312
  // At the `add_test` event we don't have the test object yet, so we can't use it
323
313
  getTestNameFromAddTestEvent (event, state) {
324
- const describeSuffix = getJestTestName(state.currentDescribeBlock)
314
+ const describeSuffix = getJestTestName(state.currentDescribeBlock, this.getShouldStripSeedFromTestName())
325
315
  return describeSuffix ? `${describeSuffix} ${event.testName}` : event.testName
326
316
  }
327
317
 
@@ -344,7 +334,7 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
344
334
  })
345
335
  }
346
336
  if (event.name === 'test_start') {
347
- const testName = getJestTestName(event.test)
337
+ const testName = getJestTestName(event.test, this.getShouldStripSeedFromTestName())
348
338
  if (testsToBeRetried.has(testName)) {
349
339
  // This is needed because we're trying tests with the same name
350
340
  this.resetSnapshotState()
@@ -378,7 +368,7 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
378
368
  this.testSourceFile,
379
369
  testStartLine,
380
370
  testEndLine,
381
- this.modifiedTestsForThisSuite,
371
+ this.modifiedFiles,
382
372
  'jest'
383
373
  )
384
374
  }
@@ -465,7 +455,7 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
465
455
  this.testSourceFile,
466
456
  testStartLine,
467
457
  testEndLine,
468
- this.modifiedTestsForThisSuite,
458
+ this.modifiedFiles,
469
459
  'jest'
470
460
  )
471
461
  if (isModified && !retriedTestsToNumAttempts.has(testFullName) && this.isEarlyFlakeDetectionEnabled) {
@@ -506,7 +496,7 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
506
496
  let failedAllTests = false
507
497
  let isAttemptToFix = false
508
498
  if (this.isTestManagementTestsEnabled) {
509
- const testName = getJestTestName(event.test)
499
+ const testName = getJestTestName(event.test, this.getShouldStripSeedFromTestName())
510
500
  isAttemptToFix = this.testManagementTestsForThisSuite?.attemptToFix?.includes(testName)
511
501
  if (isAttemptToFix) {
512
502
  if (attemptToFixRetriedTestsStatuses.has(testName)) {
@@ -534,7 +524,7 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
534
524
  let isEfdRetry = false
535
525
  // We'll store the test statuses of the retries
536
526
  if (this.isKnownTestsEnabled) {
537
- const testName = getJestTestName(event.test)
527
+ const testName = getJestTestName(event.test, this.getShouldStripSeedFromTestName())
538
528
  const isNewTest = retriedTestsToNumAttempts.has(testName)
539
529
  if (isNewTest) {
540
530
  if (newTestsTestStatuses.has(testName)) {
@@ -594,16 +584,17 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
594
584
  }
595
585
  }
596
586
  if (event.name === 'test_skip' || event.name === 'test_todo') {
587
+ const testName = getJestTestName(event.test, this.getShouldStripSeedFromTestName())
597
588
  testSkippedCh.publish({
598
589
  test: {
599
- name: getJestTestName(event.test),
590
+ name: testName,
600
591
  suite: this.testSuite,
601
592
  testSourceFile: this.testSourceFile,
602
593
  displayName: this.displayName,
603
594
  frameworkVersion: jestVersion,
604
595
  testStartLine: getTestLineStart(event.test.asyncError, this.testSuite)
605
596
  },
606
- isDisabled: this.testManagementTestsForThisSuite?.disabled?.includes(getJestTestName(event.test))
597
+ isDisabled: this.testManagementTestsForThisSuite?.disabled?.includes(testName)
607
598
  })
608
599
  }
609
600
  }
@@ -831,12 +822,12 @@ function getCliWrapper (isNewJestVersion) {
831
822
  onDone = resolve
832
823
  })
833
824
 
834
- impactedTestsCh.publish({ onDone })
825
+ modifiedFilesCh.publish({ onDone })
835
826
 
836
827
  try {
837
- const { err, modifiedTests: receivedModifiedTests } = await impactedTestsPromise
828
+ const { err, modifiedFiles: receivedModifiedFiles } = await impactedTestsPromise
838
829
  if (!err) {
839
- modifiedTests = receivedModifiedTests
830
+ modifiedFiles = receivedModifiedFiles
840
831
  }
841
832
  } catch (err) {
842
833
  log.error('Jest impacted tests error', err)
@@ -1237,7 +1228,7 @@ addHook({
1237
1228
  _ddIsTestManagementTestsEnabled,
1238
1229
  _ddTestManagementTests,
1239
1230
  _ddTestManagementAttemptToFixRetries,
1240
- _ddModifiedTests,
1231
+ _ddModifiedFiles,
1241
1232
  ...restOfTestEnvironmentOptions
1242
1233
  } = testEnvironmentOptions
1243
1234
 
@@ -1315,6 +1306,10 @@ addHook({
1315
1306
  // To bypass jest's own require engine
1316
1307
  return this._requireCoreModule(moduleName)
1317
1308
  }
1309
+ // This means that `@fast-check/jest` is used in the test file.
1310
+ if (moduleName === '@fast-check/jest') {
1311
+ testSuiteAbsolutePathsWithFastCheck.add(this._testPath)
1312
+ }
1318
1313
  return requireModuleOrMock.apply(this, arguments)
1319
1314
  })
1320
1315
 
@@ -1365,17 +1360,15 @@ function sendWrapper (send) {
1365
1360
 
1366
1361
  const suiteTestManagementTests = testManagementTests?.jest?.suites?.[testSuite]?.tests || {}
1367
1362
 
1368
- const suiteModifiedTests = Object.keys(modifiedTests).length > 0
1369
- ? modifiedTests
1370
- : {}
1371
-
1372
1363
  args[0].config = {
1373
1364
  ...config,
1374
1365
  testEnvironmentOptions: {
1375
1366
  ...config.testEnvironmentOptions,
1376
1367
  _ddKnownTests: suiteKnownTests,
1377
1368
  _ddTestManagementTests: suiteTestManagementTests,
1378
- _ddModifiedTests: suiteModifiedTests
1369
+ // TODO: figure out if we can reduce the size of the modified files object
1370
+ // Can we use `testSuite` (it'd have to be relative to repository root though)
1371
+ _ddModifiedFiles: modifiedFiles
1379
1372
  }
1380
1373
  }
1381
1374
  }
@@ -68,7 +68,7 @@ const skippableSuitesCh = channel('ci:mocha:test-suite:skippable')
68
68
  const mochaGlobalRunCh = channel('ci:mocha:global:run')
69
69
 
70
70
  const testManagementTestsCh = channel('ci:mocha:test-management-tests')
71
- const impactedTestsCh = channel('ci:mocha:modified-tests')
71
+ const modifiedFilesCh = channel('ci:mocha:modified-files')
72
72
  const workerReportTraceCh = channel('ci:mocha:worker-report:trace')
73
73
  const testSessionStartCh = channel('ci:mocha:session:start')
74
74
  const testSessionFinishCh = channel('ci:mocha:session:finish')
@@ -233,12 +233,12 @@ function getExecutionConfiguration (runner, isParallel, frameworkVersion, onFini
233
233
  })
234
234
  }
235
235
 
236
- const onReceivedImpactedTests = ({ err, modifiedTests: receivedModifiedTests }) => {
236
+ const onReceivedImpactedTests = ({ err, modifiedFiles: receivedModifiedFiles }) => {
237
237
  if (err) {
238
- config.modifiedTests = []
238
+ config.modifiedFiles = []
239
239
  config.isImpactedTestsEnabled = false
240
240
  } else {
241
- config.modifiedTests = receivedModifiedTests
241
+ config.modifiedFiles = receivedModifiedFiles
242
242
  }
243
243
  if (config.isSuitesSkippingEnabled) {
244
244
  ctx.onDone = onReceivedSkippableSuites
@@ -260,7 +260,7 @@ function getExecutionConfiguration (runner, isParallel, frameworkVersion, onFini
260
260
  }
261
261
  if (config.isImpactedTestsEnabled) {
262
262
  ctx.onDone = onReceivedImpactedTests
263
- impactedTestsCh.runStores(ctx, () => {})
263
+ modifiedFilesCh.runStores(ctx, () => {})
264
264
  } else if (config.isSuitesSkippingEnabled) {
265
265
  ctx.onDone = onReceivedSkippableSuites
266
266
  skippableSuitesCh.runStores(ctx, () => {})
@@ -284,7 +284,7 @@ function getExecutionConfiguration (runner, isParallel, frameworkVersion, onFini
284
284
  testManagementTestsCh.runStores(ctx, () => {})
285
285
  } if (config.isImpactedTestsEnabled) {
286
286
  ctx.onDone = onReceivedImpactedTests
287
- impactedTestsCh.runStores(ctx, () => {})
287
+ modifiedFilesCh.runStores(ctx, () => {})
288
288
  } else if (config.isSuitesSkippingEnabled) {
289
289
  ctx.onDone = onReceivedSkippableSuites
290
290
  skippableSuitesCh.runStores(ctx, () => {})
@@ -321,7 +321,7 @@ function getExecutionConfiguration (runner, isParallel, frameworkVersion, onFini
321
321
  testManagementTestsCh.runStores(ctx, () => {})
322
322
  } else if (config.isImpactedTestsEnabled) {
323
323
  ctx.onDone = onReceivedImpactedTests
324
- impactedTestsCh.runStores(ctx, () => {})
324
+ modifiedFilesCh.runStores(ctx, () => {})
325
325
  } else if (config.isSuitesSkippingEnabled) {
326
326
  ctx.onDone = onReceivedSkippableSuites
327
327
  skippableSuitesCh.runStores(ctx, () => {})
@@ -696,9 +696,8 @@ addHook({
696
696
  }
697
697
 
698
698
  if (config.isImpactedTestsEnabled) {
699
- const testSuiteImpactedTests = config.modifiedTests || {}
700
699
  newWorkerArgs._ddIsImpactedTestsEnabled = true
701
- newWorkerArgs._ddModifiedTests = testSuiteImpactedTests
700
+ newWorkerArgs._ddModifiedFiles = config.modifiedFiles || {}
702
701
  }
703
702
 
704
703
  // We pass the known tests for the test file to the worker
@@ -446,7 +446,7 @@ function getRunTestsWrapper (runTests, config) {
446
446
  if (config.isImpactedTestsEnabled) {
447
447
  suite.tests.forEach((test) => {
448
448
  isModifiedCh.publish({
449
- modifiedTests: config.modifiedTests,
449
+ modifiedFiles: config.modifiedFiles,
450
450
  file: suite.file,
451
451
  onDone: (isModified) => {
452
452
  if (isModified) {
@@ -36,9 +36,9 @@ addHook({
36
36
  }
37
37
  if (this.options._ddIsImpactedTestsEnabled) {
38
38
  config.isImpactedTestsEnabled = true
39
- config.modifiedTests = this.options._ddModifiedTests
39
+ config.modifiedFiles = this.options._ddModifiedFiles
40
40
  delete this.options._ddIsImpactedTestsEnabled
41
- delete this.options._ddModifiedTests
41
+ delete this.options._ddModifiedFiles
42
42
  }
43
43
  if (this.options._ddIsTestManagementTestsEnabled) {
44
44
  config.isTestManagementTestsEnabled = true
@@ -20,7 +20,7 @@ addHook({ name: 'pg', versions: ['>=8.0.3'], file: 'lib/native/client.js' }, Cli
20
20
  return Client
21
21
  })
22
22
 
23
- addHook({ name: 'pg', versions: ['>=8.0.3 <8.15.0', '>=8.15.0 <9'], file: 'lib/client.js' }, Client => {
23
+ addHook({ name: 'pg', versions: ['>=8.0.3'], file: 'lib/client.js' }, Client => {
24
24
  shimmer.wrap(Client.prototype, 'query', query => wrapQuery(query))
25
25
  return Client
26
26
  })