dd-trace 3.15.0 → 3.16.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 (161) hide show
  1. package/LICENSE-3rdparty.csv +1 -2
  2. package/README.md +4 -0
  3. package/ci/init.js +9 -1
  4. package/ext/exporters.d.ts +2 -1
  5. package/ext/exporters.js +2 -1
  6. package/index.d.ts +6 -2
  7. package/package.json +18 -17
  8. package/packages/datadog-instrumentations/src/cucumber.js +80 -3
  9. package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +100 -27
  10. package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -0
  11. package/packages/datadog-instrumentations/src/jest.js +35 -3
  12. package/packages/datadog-instrumentations/src/mariadb.js +130 -11
  13. package/packages/datadog-instrumentations/src/mocha.js +30 -6
  14. package/packages/datadog-instrumentations/src/mongodb-core.js +8 -2
  15. package/packages/datadog-instrumentations/src/mongoose.js +1 -1
  16. package/packages/datadog-instrumentations/src/next.js +32 -4
  17. package/packages/datadog-instrumentations/src/playwright.js +2 -2
  18. package/packages/datadog-plugin-amqp10/src/consumer.js +1 -1
  19. package/packages/datadog-plugin-amqp10/src/index.js +1 -1
  20. package/packages/datadog-plugin-amqp10/src/producer.js +3 -2
  21. package/packages/datadog-plugin-amqplib/src/client.js +3 -2
  22. package/packages/datadog-plugin-amqplib/src/consumer.js +1 -1
  23. package/packages/datadog-plugin-amqplib/src/index.js +1 -1
  24. package/packages/datadog-plugin-amqplib/src/producer.js +3 -2
  25. package/packages/datadog-plugin-aws-sdk/src/base.js +7 -2
  26. package/packages/datadog-plugin-aws-sdk/src/index.js +1 -1
  27. package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +2 -0
  28. package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +2 -0
  29. package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +2 -0
  30. package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +2 -0
  31. package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +2 -0
  32. package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +2 -0
  33. package/packages/datadog-plugin-aws-sdk/src/services/s3.js +2 -0
  34. package/packages/datadog-plugin-aws-sdk/src/services/sns.js +2 -0
  35. package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +2 -0
  36. package/packages/datadog-plugin-bunyan/src/index.js +1 -1
  37. package/packages/datadog-plugin-cassandra-driver/src/index.js +3 -2
  38. package/packages/datadog-plugin-connect/src/index.js +1 -1
  39. package/packages/datadog-plugin-couchbase/src/index.js +1 -1
  40. package/packages/datadog-plugin-cucumber/src/index.js +33 -6
  41. package/packages/datadog-plugin-cypress/src/index.js +1 -1
  42. package/packages/datadog-plugin-cypress/src/plugin.js +40 -33
  43. package/packages/datadog-plugin-dns/src/index.js +1 -1
  44. package/packages/datadog-plugin-dns/src/lookup.js +1 -1
  45. package/packages/datadog-plugin-dns/src/lookup_service.js +1 -1
  46. package/packages/datadog-plugin-dns/src/resolve.js +1 -1
  47. package/packages/datadog-plugin-dns/src/reverse.js +1 -1
  48. package/packages/datadog-plugin-elasticsearch/src/index.js +1 -1
  49. package/packages/datadog-plugin-express/src/index.js +1 -1
  50. package/packages/datadog-plugin-fastify/src/index.js +1 -1
  51. package/packages/datadog-plugin-find-my-way/src/index.js +1 -1
  52. package/packages/datadog-plugin-fs/src/index.js +1 -1
  53. package/packages/datadog-plugin-google-cloud-pubsub/src/client.js +5 -5
  54. package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +1 -1
  55. package/packages/datadog-plugin-google-cloud-pubsub/src/index.js +1 -1
  56. package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +7 -6
  57. package/packages/datadog-plugin-graphql/src/execute.js +1 -1
  58. package/packages/datadog-plugin-graphql/src/index.js +1 -1
  59. package/packages/datadog-plugin-graphql/src/parse.js +1 -1
  60. package/packages/datadog-plugin-graphql/src/resolve.js +1 -1
  61. package/packages/datadog-plugin-graphql/src/validate.js +1 -1
  62. package/packages/datadog-plugin-grpc/src/client.js +1 -1
  63. package/packages/datadog-plugin-grpc/src/index.js +1 -1
  64. package/packages/datadog-plugin-grpc/src/server.js +1 -1
  65. package/packages/datadog-plugin-hapi/src/index.js +1 -1
  66. package/packages/datadog-plugin-http/src/client.js +2 -2
  67. package/packages/datadog-plugin-http/src/index.js +1 -1
  68. package/packages/datadog-plugin-http/src/server.js +2 -2
  69. package/packages/datadog-plugin-http2/src/client.js +4 -3
  70. package/packages/datadog-plugin-http2/src/index.js +1 -1
  71. package/packages/datadog-plugin-http2/src/server.js +2 -2
  72. package/packages/datadog-plugin-ioredis/src/index.js +1 -1
  73. package/packages/datadog-plugin-jest/src/index.js +53 -19
  74. package/packages/datadog-plugin-kafkajs/src/consumer.js +1 -1
  75. package/packages/datadog-plugin-kafkajs/src/index.js +1 -1
  76. package/packages/datadog-plugin-kafkajs/src/producer.js +1 -1
  77. package/packages/datadog-plugin-koa/src/index.js +1 -1
  78. package/packages/datadog-plugin-mariadb/src/index.js +18 -1
  79. package/packages/datadog-plugin-memcached/src/index.js +3 -2
  80. package/packages/datadog-plugin-microgateway-core/src/index.js +1 -1
  81. package/packages/datadog-plugin-mocha/src/index.js +13 -9
  82. package/packages/datadog-plugin-moleculer/src/client.js +1 -1
  83. package/packages/datadog-plugin-moleculer/src/index.js +1 -1
  84. package/packages/datadog-plugin-moleculer/src/server.js +1 -1
  85. package/packages/datadog-plugin-mongodb-core/src/index.js +1 -1
  86. package/packages/datadog-plugin-mysql/src/index.js +3 -2
  87. package/packages/datadog-plugin-mysql2/src/index.js +1 -1
  88. package/packages/datadog-plugin-net/src/index.js +9 -75
  89. package/packages/datadog-plugin-net/src/ipc.js +1 -1
  90. package/packages/datadog-plugin-net/src/tcp.js +3 -2
  91. package/packages/datadog-plugin-next/src/index.js +3 -3
  92. package/packages/datadog-plugin-opensearch/src/index.js +1 -1
  93. package/packages/datadog-plugin-oracledb/src/index.js +3 -2
  94. package/packages/datadog-plugin-paperplane/src/index.js +1 -1
  95. package/packages/datadog-plugin-paperplane/src/logger.js +1 -1
  96. package/packages/datadog-plugin-paperplane/src/server.js +1 -1
  97. package/packages/datadog-plugin-pg/src/index.js +3 -2
  98. package/packages/datadog-plugin-pino/src/index.js +1 -1
  99. package/packages/datadog-plugin-playwright/src/index.js +5 -4
  100. package/packages/datadog-plugin-redis/src/index.js +3 -2
  101. package/packages/datadog-plugin-restify/src/index.js +1 -1
  102. package/packages/datadog-plugin-rhea/src/consumer.js +1 -1
  103. package/packages/datadog-plugin-rhea/src/index.js +1 -1
  104. package/packages/datadog-plugin-rhea/src/producer.js +3 -2
  105. package/packages/datadog-plugin-router/src/index.js +8 -8
  106. package/packages/datadog-plugin-sharedb/src/index.js +1 -1
  107. package/packages/datadog-plugin-tedious/src/index.js +3 -2
  108. package/packages/datadog-plugin-web/src/index.js +1 -1
  109. package/packages/datadog-plugin-winston/src/index.js +1 -1
  110. package/packages/dd-trace/src/appsec/gateway/engine/runner.js +2 -1
  111. package/packages/dd-trace/src/appsec/iast/analyzers/analyzers.js +2 -0
  112. package/packages/dd-trace/src/appsec/iast/analyzers/vulnerability-analyzer.js +2 -2
  113. package/packages/dd-trace/src/appsec/iast/iast-log.js +111 -0
  114. package/packages/dd-trace/src/appsec/iast/index.js +7 -4
  115. package/packages/dd-trace/src/appsec/iast/path-line.js +3 -6
  116. package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +2 -0
  117. package/packages/dd-trace/src/appsec/iast/taint-tracking/operations.js +2 -0
  118. package/packages/dd-trace/src/appsec/iast/taint-tracking/origin-types.js +2 -0
  119. package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +2 -0
  120. package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +5 -3
  121. package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +5 -3
  122. package/packages/dd-trace/src/appsec/iast/telemetry/log_collector.js +96 -0
  123. package/packages/dd-trace/src/appsec/iast/telemetry/logs.js +87 -0
  124. package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +27 -2
  125. package/packages/dd-trace/src/ci-visibility/encode/json-encoder.js +27 -0
  126. package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +2 -9
  127. package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +7 -7
  128. package/packages/dd-trace/src/ci-visibility/exporters/jest-worker/index.js +33 -0
  129. package/packages/dd-trace/src/ci-visibility/exporters/jest-worker/writer.js +37 -0
  130. package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-itr-configuration.js +8 -2
  131. package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +8 -2
  132. package/packages/dd-trace/src/config.js +23 -4
  133. package/packages/dd-trace/src/constants.js +2 -1
  134. package/packages/dd-trace/src/datastreams/encoding.js +80 -0
  135. package/packages/dd-trace/src/exporter.js +7 -9
  136. package/packages/dd-trace/src/exporters/common/agents.js +42 -0
  137. package/packages/dd-trace/src/exporters/common/docker.js +4 -1
  138. package/packages/dd-trace/src/exporters/common/request.js +1 -4
  139. package/packages/dd-trace/src/lambda/handler.js +14 -6
  140. package/packages/dd-trace/src/opentracing/span.js +5 -0
  141. package/packages/dd-trace/src/plugin_manager.js +7 -7
  142. package/packages/dd-trace/src/plugins/ci_plugin.js +16 -16
  143. package/packages/dd-trace/src/plugins/index.js +1 -0
  144. package/packages/dd-trace/src/plugins/log_plugin.js +1 -1
  145. package/packages/dd-trace/src/plugins/outgoing.js +2 -1
  146. package/packages/dd-trace/src/plugins/tracing.js +1 -1
  147. package/packages/dd-trace/src/plugins/util/ci.js +12 -0
  148. package/packages/dd-trace/src/plugins/util/ip_extractor.js +23 -27
  149. package/packages/dd-trace/src/plugins/util/test.js +26 -7
  150. package/packages/dd-trace/src/profiling/config.js +87 -20
  151. package/packages/dd-trace/src/profiling/constants.js +16 -0
  152. package/packages/dd-trace/src/profiling/exporter_cli.js +62 -0
  153. package/packages/dd-trace/src/profiling/exporters/agent.js +2 -1
  154. package/packages/dd-trace/src/profiling/profiler.js +21 -8
  155. package/packages/dd-trace/src/profiling/profilers/space.js +21 -1
  156. package/packages/dd-trace/src/span_sampler.js +3 -2
  157. package/packages/dd-trace/src/telemetry/index.js +16 -2
  158. package/packages/dd-trace/src/util.js +10 -1
  159. package/scripts/install_plugin_modules.js +5 -1
  160. package/scripts/junit_report.js +0 -25
  161. package/scripts/tdd.js +0 -34
@@ -2,6 +2,7 @@
2
2
 
3
3
  const { EventEmitter } = require('events')
4
4
  const { Config } = require('./config')
5
+ const { snapshotKinds } = require('./constants')
5
6
 
6
7
  function maybeSourceMap (sourceMap) {
7
8
  if (!sourceMap) return
@@ -49,7 +50,10 @@ class Profiler extends EventEmitter {
49
50
  try {
50
51
  for (const profiler of config.profilers) {
51
52
  // TODO: move this out of Profiler when restoring sourcemap support
52
- profiler.start({ mapper })
53
+ profiler.start({
54
+ mapper,
55
+ nearOOMCallback: this._nearOOMExport.bind(this)
56
+ })
53
57
  this._logger.debug(`Started ${profiler.type} profiler`)
54
58
  }
55
59
 
@@ -60,6 +64,14 @@ class Profiler extends EventEmitter {
60
64
  }
61
65
  }
62
66
 
67
+ _nearOOMExport (profileType, encodedProfile) {
68
+ const start = this._lastStart
69
+ const end = new Date()
70
+ this._submit({
71
+ [profileType]: encodedProfile
72
+ }, start, end, snapshotKinds.ON_OUT_OF_MEMORY)
73
+ }
74
+
63
75
  _setInterval () {
64
76
  this._timeoutInterval = this._config.flushInterval
65
77
  }
@@ -69,7 +81,7 @@ class Profiler extends EventEmitter {
69
81
 
70
82
  // collect and export current profiles
71
83
  // once collect returns, profilers can be safely stopped
72
- this._collect()
84
+ this._collect(snapshotKinds.ON_SHUTDOWN)
73
85
  this._stop()
74
86
  }
75
87
 
@@ -93,14 +105,14 @@ class Profiler extends EventEmitter {
93
105
  if (!this._enabled) return
94
106
  this._lastStart = new Date()
95
107
  if (!this._timer || timeout !== this._timeoutInterval) {
96
- this._timer = setTimeout(() => this._collect(), timeout)
108
+ this._timer = setTimeout(() => this._collect(snapshotKinds.PERIODIC), timeout)
97
109
  this._timer.unref()
98
110
  } else {
99
111
  this._timer.refresh()
100
112
  }
101
113
  }
102
114
 
103
- async _collect () {
115
+ async _collect (snapshotKind) {
104
116
  if (!this._enabled) return
105
117
 
106
118
  const start = this._lastStart
@@ -128,7 +140,7 @@ class Profiler extends EventEmitter {
128
140
  }
129
141
 
130
142
  this._capture(this._timeoutInterval)
131
- await this._submit(encodedProfiles, start, end)
143
+ await this._submit(encodedProfiles, start, end, snapshotKind)
132
144
  this._logger.debug('Submitted profiles')
133
145
  } catch (err) {
134
146
  this._logger.error(err)
@@ -136,13 +148,14 @@ class Profiler extends EventEmitter {
136
148
  }
137
149
  }
138
150
 
139
- _submit (profiles, start, end) {
151
+ _submit (profiles, start, end, snapshotKind) {
140
152
  if (!Object.keys(profiles).length) {
141
153
  return Promise.reject(new Error('No profiles to submit'))
142
154
  }
143
155
  const { tags } = this._config
144
156
  const tasks = []
145
157
 
158
+ tags.snapshot = snapshotKind
146
159
  for (const exporter of this._config.exporters) {
147
160
  const task = exporter.export({ profiles, start, end, tags })
148
161
  .catch(err => this._logger.error(err))
@@ -167,10 +180,10 @@ class ServerlessProfiler extends Profiler {
167
180
  this._flushAfterIntervals = this._config.flushInterval / 1000
168
181
  }
169
182
 
170
- async _collect () {
183
+ async _collect (snapshotKind) {
171
184
  if (this._profiledIntervals >= this._flushAfterIntervals) {
172
185
  this._profiledIntervals = 0
173
- await super._collect()
186
+ await super._collect(snapshotKind)
174
187
  } else {
175
188
  this._profiledIntervals += 1
176
189
  this._capture(this._timeoutInterval)
@@ -1,17 +1,37 @@
1
1
  'use strict'
2
2
 
3
+ const { oomExportStrategies } = require('../constants')
4
+
5
+ function strategiesToCallbackMode (strategies, callbackMode) {
6
+ const hasInterrupt = strategies.includes(oomExportStrategies.INTERRUPT_CALLBACK) ? callbackMode.Interrupt : 0
7
+ const hasCallback = strategies.includes(oomExportStrategies.ASYNC_CALLBACK) ? callbackMode.Async : 0
8
+ return hasInterrupt | hasCallback
9
+ }
10
+
3
11
  class NativeSpaceProfiler {
4
12
  constructor (options = {}) {
5
13
  this.type = 'space'
6
14
  this._samplingInterval = options.samplingInterval || 512 * 1024
7
15
  this._stackDepth = options.stackDepth || 64
8
16
  this._pprof = undefined
17
+ this._oomMonitoring = options.oomMonitoring || {}
9
18
  }
10
19
 
11
- start ({ mapper } = {}) {
20
+ start ({ mapper, nearOOMCallback } = {}) {
12
21
  this._mapper = mapper
13
22
  this._pprof = require('@datadog/pprof')
14
23
  this._pprof.heap.start(this._samplingInterval, this._stackDepth)
24
+ if (this._oomMonitoring.enabled) {
25
+ const strategies = this._oomMonitoring.exportStrategies
26
+ this._pprof.heap.monitorOutOfMemory(
27
+ this._oomMonitoring.heapLimitExtensionSize,
28
+ this._oomMonitoring.maxHeapExtensionCount,
29
+ strategies.includes(oomExportStrategies.LOGS),
30
+ strategies.includes(oomExportStrategies.PROCESS) ? this._oomMonitoring.exportCommand : [],
31
+ (profile) => nearOOMCallback(this.type, this._pprof.encodeSync(profile)),
32
+ strategiesToCallbackMode(strategies, this._pprof.heap.CallbackMode)
33
+ )
34
+ }
15
35
  }
16
36
 
17
37
  profile () {
@@ -73,8 +73,9 @@ class SpanSampler {
73
73
 
74
74
  const { started } = spanContext._trace
75
75
  for (const span of started) {
76
- const tags = span.context()._tags || {}
77
- const name = span._name
76
+ const context = span.context()
77
+ const tags = context._tags || {}
78
+ const name = context._name
78
79
  const service = tags.service ||
79
80
  tags['service.name'] ||
80
81
  span.tracer()._service
@@ -1,6 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  const tracerVersion = require('../../../../package.json').version
4
+ const dc = require('diagnostics_channel')
4
5
  const os = require('os')
5
6
  const dependencies = require('./dependencies')
6
7
  const { sendData } = require('./send-data')
@@ -9,6 +10,9 @@ const HEARTBEAT_INTERVAL = process.env.DD_TELEMETRY_HEARTBEAT_INTERVAL
9
10
  ? Number(process.env.DD_TELEMETRY_HEARTBEAT_INTERVAL) * 1000
10
11
  : 60000
11
12
 
13
+ const telemetryStartChannel = dc.channel('datadog:telemetry:start')
14
+ const telemetryStopChannel = dc.channel('datadog:telemetry:stop')
15
+
12
16
  let config
13
17
  let pluginManager
14
18
 
@@ -103,8 +107,12 @@ function createHostObject () {
103
107
  }
104
108
  }
105
109
 
110
+ function getTelemetryData () {
111
+ return { config, application, host, heartbeatInterval: HEARTBEAT_INTERVAL }
112
+ }
113
+
106
114
  function start (aConfig, thePluginManager) {
107
- if (!aConfig.telemetryEnabled) {
115
+ if (!aConfig.telemetry.enabled) {
108
116
  return
109
117
  }
110
118
  config = aConfig
@@ -118,6 +126,8 @@ function start (aConfig, thePluginManager) {
118
126
  }, HEARTBEAT_INTERVAL)
119
127
  interval.unref()
120
128
  process.on('beforeExit', onBeforeExit)
129
+
130
+ telemetryStartChannel.publish(getTelemetryData())
121
131
  }
122
132
 
123
133
  function stop () {
@@ -126,10 +136,14 @@ function stop () {
126
136
  }
127
137
  clearInterval(interval)
128
138
  process.removeListener('beforeExit', onBeforeExit)
139
+
140
+ telemetryStopChannel.publish(getTelemetryData())
141
+
142
+ config = undefined
129
143
  }
130
144
 
131
145
  function updateIntegrations () {
132
- if (!config || !config.telemetryEnabled) {
146
+ if (!config || !config.telemetry.enabled) {
133
147
  return
134
148
  }
135
149
  const integrations = getIntegrations()
@@ -1,5 +1,7 @@
1
1
  'use strict'
2
2
 
3
+ const path = require('path')
4
+
3
5
  function isTrue (str) {
4
6
  str = String(str).toLowerCase()
5
7
  return str === 'true' || str === '1'
@@ -61,9 +63,16 @@ function globMatch (pattern, subject) {
61
63
  return true
62
64
  }
63
65
 
66
+ function calculateDDBasePath (dirname) {
67
+ const dirSteps = dirname.split(path.sep)
68
+ const packagesIndex = dirSteps.lastIndexOf('packages')
69
+ return dirSteps.slice(0, packagesIndex).join(path.sep) + path.sep
70
+ }
71
+
64
72
  module.exports = {
65
73
  isTrue,
66
74
  isFalse,
67
75
  isError,
68
- globMatch
76
+ globMatch,
77
+ calculateDDBasePath
69
78
  }
@@ -1,6 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  const fs = require('fs')
4
+ const os = require('os')
4
5
  const path = require('path')
5
6
  const crypto = require('crypto')
6
7
  const semver = require('semver')
@@ -11,6 +12,7 @@ const externals = require('../packages/dd-trace/test/plugins/externals')
11
12
 
12
13
  const requirePackageJsonPath = require.resolve('../packages/dd-trace/src/require-package-json')
13
14
 
15
+ const excludeList = os.arch() === 'arm64' ? ['couchbase', 'grpc', 'oracledb'] : []
14
16
  const workspaces = new Set()
15
17
  const versionLists = {}
16
18
  const deps = {}
@@ -42,6 +44,8 @@ async function run () {
42
44
  assertFolder()
43
45
  await assertVersions()
44
46
  assertWorkspace()
47
+ // Some native addon packages rely on libraries that are not supported on ARM64
48
+ excludeList.forEach(pkg => delete workspaces[pkg])
45
49
  install()
46
50
  }
47
51
 
@@ -197,7 +201,7 @@ function install () {
197
201
 
198
202
  function addFolder (name, version) {
199
203
  const basename = [name, version].filter(val => val).join('@')
200
- workspaces.add(basename)
204
+ if (!excludeList.includes(name)) workspaces.add(basename)
201
205
  }
202
206
 
203
207
  function folder (name, version) {
@@ -1,25 +0,0 @@
1
- /* eslint-disable no-console */
2
-
3
- const { execSync } = require('child_process')
4
-
5
- function uploadJUnitXMLReport () {
6
- if (process.env.CIRCLE_PR_NUMBER) {
7
- console.log('Running in a fork. Skipping step.')
8
- return
9
- }
10
- // we install @datadog/datadog-ci
11
- execSync('yarn global add @datadog/datadog-ci@0.13.2', { stdio: 'inherit' })
12
- const service = process.env.PLUGINS ? 'plugins' : 'core'
13
- // we execute the upload command
14
- execSync(
15
- `DD_ENV=ci datadog-ci junit upload \
16
- --tags runtime.version:${process.version} \
17
- --service dd-trace-js-${service}-tests \
18
- ./test-results/mocha/test-results.xml`,
19
- {
20
- stdio: 'inherit'
21
- }
22
- )
23
- }
24
-
25
- uploadJUnitXMLReport()
package/scripts/tdd.js DELETED
@@ -1,34 +0,0 @@
1
- 'use strict'
2
-
3
- const execSync = require('child_process').execSync
4
- const fs = require('fs')
5
- const path = require('path')
6
-
7
- const options = { stdio: [0, 1, 2] }
8
- const command = 'yarn services && NO_DEPRECATION=* mocha --watch --expose-gc'
9
-
10
- const base = path.join(__dirname, '..', 'packages')
11
- const globs = [
12
- 'packages/dd-trace/test/setup/node.js'
13
- ].map(glob => `'${glob}'`).join(' ')
14
-
15
- const pluginName = /\/?datadog-plugin-([\w -]+)\/?/
16
- const plugins = []
17
- const args = process.argv.slice(2).map((arg) => {
18
- if (fs.existsSync(path.join(base, `datadog-plugin-${arg}`))) {
19
- plugins.push(arg)
20
- return `'packages/datadog-plugin-${arg}/test/**/*.spec.js'`
21
- } else if (pluginName.test(arg)) {
22
- const plugin = arg.match(pluginName)[1]
23
- plugins.push(plugin)
24
- }
25
- return arg
26
- }).join(' ')
27
-
28
- const pluginEnvList = plugins.join('|')
29
-
30
- if (plugins) {
31
- execSync(`PLUGINS=${pluginEnvList} ${command} ${globs} ${args}`, options)
32
- } else {
33
- execSync(`${command} ${globs} ${args}`, options)
34
- }