dd-trace 5.8.0 → 5.10.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 (109) hide show
  1. package/LICENSE-3rdparty.csv +0 -1
  2. package/ci/init.js +3 -3
  3. package/package.json +5 -6
  4. package/packages/datadog-esbuild/index.js +2 -2
  5. package/packages/datadog-instrumentations/src/apollo-server.js +1 -1
  6. package/packages/datadog-instrumentations/src/apollo.js +5 -3
  7. package/packages/datadog-instrumentations/src/aws-sdk.js +4 -1
  8. package/packages/datadog-instrumentations/src/cassandra-driver.js +1 -1
  9. package/packages/datadog-instrumentations/src/cucumber.js +6 -2
  10. package/packages/datadog-instrumentations/src/fs.js +0 -1
  11. package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +1 -1
  12. package/packages/datadog-instrumentations/src/helpers/hooks.js +56 -56
  13. package/packages/datadog-instrumentations/src/helpers/instrument.js +2 -2
  14. package/packages/datadog-instrumentations/src/http/client.js +1 -0
  15. package/packages/datadog-instrumentations/src/jest.js +94 -15
  16. package/packages/datadog-instrumentations/src/kafkajs.js +6 -8
  17. package/packages/datadog-instrumentations/src/ldapjs.js +2 -1
  18. package/packages/datadog-instrumentations/src/mocha.js +1 -1
  19. package/packages/datadog-instrumentations/src/mongodb-core.js +3 -3
  20. package/packages/datadog-instrumentations/src/net.js +1 -1
  21. package/packages/datadog-instrumentations/src/oracledb.js +1 -1
  22. package/packages/datadog-instrumentations/src/passport-utils.js +1 -0
  23. package/packages/datadog-instrumentations/src/playwright.js +8 -2
  24. package/packages/datadog-instrumentations/src/rhea.js +5 -2
  25. package/packages/datadog-instrumentations/src/tedious.js +1 -1
  26. package/packages/datadog-plugin-apollo/src/gateway/fetch.js +1 -1
  27. package/packages/datadog-plugin-apollo/src/gateway/plan.js +0 -1
  28. package/packages/datadog-plugin-apollo/src/gateway/request.js +2 -17
  29. package/packages/datadog-plugin-apollo/src/gateway/validate.js +6 -2
  30. package/packages/datadog-plugin-aws-sdk/src/base.js +3 -3
  31. package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +1 -1
  32. package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +2 -2
  33. package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +1 -1
  34. package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +1 -1
  35. package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +1 -1
  36. package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +1 -1
  37. package/packages/datadog-plugin-aws-sdk/src/services/s3.js +1 -1
  38. package/packages/datadog-plugin-aws-sdk/src/services/sns.js +1 -1
  39. package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +2 -2
  40. package/packages/datadog-plugin-child_process/src/index.js +1 -1
  41. package/packages/datadog-plugin-couchbase/src/index.js +2 -1
  42. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +1 -0
  43. package/packages/datadog-plugin-fetch/src/index.js +1 -1
  44. package/packages/datadog-plugin-graphql/src/resolve.js +1 -1
  45. package/packages/datadog-plugin-grpc/src/client.js +2 -2
  46. package/packages/datadog-plugin-grpc/src/server.js +2 -2
  47. package/packages/datadog-plugin-http/src/client.js +2 -2
  48. package/packages/datadog-plugin-http2/src/client.js +4 -3
  49. package/packages/datadog-plugin-jest/src/index.js +1 -0
  50. package/packages/datadog-plugin-kafkajs/src/consumer.js +1 -1
  51. package/packages/datadog-plugin-kafkajs/src/producer.js +1 -1
  52. package/packages/datadog-plugin-next/src/index.js +1 -1
  53. package/packages/datadog-plugin-openai/src/index.js +4 -4
  54. package/packages/datadog-plugin-playwright/src/index.js +7 -2
  55. package/packages/datadog-plugin-rhea/src/consumer.js +1 -1
  56. package/packages/datadog-plugin-rhea/src/producer.js +1 -1
  57. package/packages/datadog-plugin-router/src/index.js +1 -1
  58. package/packages/datadog-plugin-tedious/src/index.js +1 -1
  59. package/packages/dd-trace/src/appsec/blocking.js +1 -1
  60. package/packages/dd-trace/src/appsec/iast/analyzers/analyzers.js +17 -17
  61. package/packages/dd-trace/src/appsec/iast/analyzers/cookie-analyzer.js +1 -0
  62. package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secrets-rules.js +132 -132
  63. package/packages/dd-trace/src/appsec/iast/analyzers/hsts-header-missing-analyzer.js +1 -0
  64. package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +1 -1
  65. package/packages/dd-trace/src/appsec/iast/analyzers/weak-hash-analyzer.js +6 -2
  66. package/packages/dd-trace/src/appsec/iast/overhead-controller.js +2 -1
  67. package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +3 -3
  68. package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +4 -4
  69. package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +1 -1
  70. package/packages/dd-trace/src/appsec/iast/telemetry/namespaces.js +27 -18
  71. package/packages/dd-trace/src/appsec/iast/telemetry/span-tags.js +1 -1
  72. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +1 -1
  73. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +7 -4
  74. package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +2 -2
  75. package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +9 -3
  76. package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +2 -1
  77. package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +1 -0
  78. package/packages/dd-trace/src/config.js +16 -14
  79. package/packages/dd-trace/src/datastreams/pathway.js +1 -1
  80. package/packages/dd-trace/src/datastreams/processor.js +15 -15
  81. package/packages/dd-trace/src/encode/agentless-ci-visibility.js +2 -2
  82. package/packages/dd-trace/src/encode/coverage-ci-visibility.js +1 -1
  83. package/packages/dd-trace/src/exporters/common/request.js +1 -0
  84. package/packages/dd-trace/src/exporters/span-stats/writer.js +0 -1
  85. package/packages/dd-trace/src/external-logger/src/index.js +5 -5
  86. package/packages/dd-trace/src/opentelemetry/span.js +2 -0
  87. package/packages/dd-trace/src/opentracing/propagation/text_map.js +1 -1
  88. package/packages/dd-trace/src/opentracing/span.js +1 -1
  89. package/packages/dd-trace/src/plugins/apollo.js +3 -1
  90. package/packages/dd-trace/src/plugins/ci_plugin.js +2 -1
  91. package/packages/dd-trace/src/plugins/composite.js +3 -4
  92. package/packages/dd-trace/src/plugins/database.js +1 -0
  93. package/packages/dd-trace/src/plugins/index.js +43 -43
  94. package/packages/dd-trace/src/plugins/plugin.js +1 -1
  95. package/packages/dd-trace/src/plugins/tracing.js +1 -1
  96. package/packages/dd-trace/src/plugins/util/git.js +33 -11
  97. package/packages/dd-trace/src/plugins/util/test.js +2 -1
  98. package/packages/dd-trace/src/plugins/util/web.js +4 -4
  99. package/packages/dd-trace/src/profiling/config.js +1 -1
  100. package/packages/dd-trace/src/profiling/loggers/console.js +1 -1
  101. package/packages/dd-trace/src/runtime_metrics.js +8 -5
  102. package/packages/dd-trace/src/serverless.js +3 -2
  103. package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +0 -1
  104. package/packages/dd-trace/src/span_processor.js +2 -2
  105. package/packages/dd-trace/src/span_stats.js +1 -1
  106. package/packages/dd-trace/src/telemetry/dependencies.js +4 -5
  107. package/packages/dd-trace/src/telemetry/index.js +12 -13
  108. package/packages/dd-trace/src/telemetry/send-data.js +0 -1
  109. package/packages/dd-trace/src/util.js +7 -7
@@ -28,7 +28,7 @@ const {
28
28
  const { filterSensitiveInfoFromRepository } = require('./url')
29
29
  const { storage } = require('../../../../datadog-core')
30
30
 
31
- const GIT_REV_LIST_MAX_BUFFER = 8 * 1024 * 1024 // 8MB
31
+ const GIT_REV_LIST_MAX_BUFFER = 12 * 1024 * 1024 // 12MB
32
32
 
33
33
  function sanitizedExec (
34
34
  cmd,
@@ -53,11 +53,15 @@ function sanitizedExec (
53
53
  distributionMetric(durationMetric.name, durationMetric.tags, Date.now() - startTime)
54
54
  }
55
55
  return result
56
- } catch (e) {
56
+ } catch (err) {
57
57
  if (errorMetric) {
58
- incrementCountMetric(errorMetric.name, { ...errorMetric.tags, exitCode: e.status })
58
+ incrementCountMetric(errorMetric.name, {
59
+ ...errorMetric.tags,
60
+ errorType: err.code,
61
+ exitCode: err.status || err.errno
62
+ })
59
63
  }
60
- log.error(e)
64
+ log.error(err)
61
65
  return ''
62
66
  } finally {
63
67
  storage.enterWith(store)
@@ -129,7 +133,10 @@ function unshallowRepository () {
129
133
  } catch (err) {
130
134
  // If the local HEAD is a commit that has not been pushed to the remote, the above command will fail.
131
135
  log.error(err)
132
- incrementCountMetric(TELEMETRY_GIT_COMMAND_ERRORS, { command: 'unshallow', exitCode: err.status })
136
+ incrementCountMetric(
137
+ TELEMETRY_GIT_COMMAND_ERRORS,
138
+ { command: 'unshallow', errorType: err.code, exitCode: err.status || err.errno }
139
+ )
133
140
  const upstreamRemote = sanitizedExec('git', ['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{upstream}'])
134
141
  try {
135
142
  cp.execFileSync('git', [
@@ -139,7 +146,10 @@ function unshallowRepository () {
139
146
  } catch (err) {
140
147
  // If the CI is working on a detached HEAD or branch tracking hasn’t been set up, the above command will fail.
141
148
  log.error(err)
142
- incrementCountMetric(TELEMETRY_GIT_COMMAND_ERRORS, { command: 'unshallow', exitCode: err.status })
149
+ incrementCountMetric(
150
+ TELEMETRY_GIT_COMMAND_ERRORS,
151
+ { command: 'unshallow', errorType: err.code, exitCode: err.status || err.errno }
152
+ )
143
153
  // We use sanitizedExec here because if this last option fails, we'll give up.
144
154
  sanitizedExec(
145
155
  'git',
@@ -175,13 +185,16 @@ function getLatestCommits () {
175
185
  return result
176
186
  } catch (err) {
177
187
  log.error(`Get latest commits failed: ${err.message}`)
178
- incrementCountMetric(TELEMETRY_GIT_COMMAND_ERRORS, { command: 'get_local_commits', errorType: err.status })
188
+ incrementCountMetric(
189
+ TELEMETRY_GIT_COMMAND_ERRORS,
190
+ { command: 'get_local_commits', errorType: err.status }
191
+ )
179
192
  return []
180
193
  }
181
194
  }
182
195
 
183
196
  function getCommitsRevList (commitsToExclude, commitsToInclude) {
184
- let result = []
197
+ let result = null
185
198
 
186
199
  const commitsToExcludeString = commitsToExclude.map(commit => `^${commit}`)
187
200
 
@@ -205,7 +218,10 @@ function getCommitsRevList (commitsToExclude, commitsToInclude) {
205
218
  .filter(commit => commit)
206
219
  } catch (err) {
207
220
  log.error(`Get commits to upload failed: ${err.message}`)
208
- incrementCountMetric(TELEMETRY_GIT_COMMAND_ERRORS, { command: 'get_objects', errorType: err.status })
221
+ incrementCountMetric(
222
+ TELEMETRY_GIT_COMMAND_ERRORS,
223
+ { command: 'get_objects', errorType: err.code, exitCode: err.status || err.errno } // err.status might be null
224
+ )
209
225
  }
210
226
  distributionMetric(TELEMETRY_GIT_COMMAND_MS, { command: 'get_objects' }, Date.now() - startTime)
211
227
  return result
@@ -245,7 +261,10 @@ function generatePackFilesForCommits (commitsToUpload) {
245
261
  result = execGitPackObjects(temporaryPath)
246
262
  } catch (err) {
247
263
  log.error(err)
248
- incrementCountMetric(TELEMETRY_GIT_COMMAND_ERRORS, { command: 'pack_objects', errorType: err.status })
264
+ incrementCountMetric(
265
+ TELEMETRY_GIT_COMMAND_ERRORS,
266
+ { command: 'pack_objects', exitCode: err.status || err.errno, errorType: err.code }
267
+ )
249
268
  /**
250
269
  * The generation of pack files in the temporary folder (from `os.tmpdir()`)
251
270
  * sometimes fails in certain CI setups with the error message
@@ -262,7 +281,10 @@ function generatePackFilesForCommits (commitsToUpload) {
262
281
  result = execGitPackObjects(cwdPath)
263
282
  } catch (err) {
264
283
  log.error(err)
265
- incrementCountMetric(TELEMETRY_GIT_COMMAND_ERRORS, { command: 'pack_objects', errorType: err.status })
284
+ incrementCountMetric(
285
+ TELEMETRY_GIT_COMMAND_ERRORS,
286
+ { command: 'pack_objects', exitCode: err.status || err.errno, errorType: err.code }
287
+ )
266
288
  }
267
289
  }
268
290
  distributionMetric(TELEMETRY_GIT_COMMAND_MS, { command: 'pack_objects' }, Date.now() - startTime)
@@ -288,7 +288,8 @@ function getTestSuitePath (testSuiteAbsolutePath, sourceRoot) {
288
288
  return sourceRoot
289
289
  }
290
290
  const testSuitePath = testSuiteAbsolutePath === sourceRoot
291
- ? testSuiteAbsolutePath : path.relative(sourceRoot, testSuiteAbsolutePath)
291
+ ? testSuiteAbsolutePath
292
+ : path.relative(sourceRoot, testSuiteAbsolutePath)
292
293
 
293
294
  return testSuitePath.replace(path.sep, '/')
294
295
  }
@@ -63,7 +63,7 @@ const web = {
63
63
  if (!span) return
64
64
 
65
65
  span.context()._name = `${name}.request`
66
- span.context()._tags['component'] = name
66
+ span.context()._tags.component = name
67
67
 
68
68
  web.setConfig(req, config)
69
69
  },
@@ -263,7 +263,7 @@ const web = {
263
263
  const context = contexts.get(req)
264
264
  const span = context.span
265
265
  const error = context.error
266
- const hasExistingError = span.context()._tags['error'] || span.context()._tags[ERROR_MESSAGE]
266
+ const hasExistingError = span.context()._tags.error || span.context()._tags[ERROR_MESSAGE]
267
267
 
268
268
  if (!hasExistingError && !context.config.validateStatus(statusCode)) {
269
269
  span.setTag(ERROR, error || true)
@@ -405,7 +405,7 @@ function addAllowHeaders (req, res, headers) {
405
405
  }
406
406
 
407
407
  function isOriginAllowed (req, headers) {
408
- const origin = req.headers['origin']
408
+ const origin = req.headers.origin
409
409
  const allowOrigin = headers['access-control-allow-origin']
410
410
 
411
411
  return origin && (allowOrigin === '*' || allowOrigin === origin)
@@ -498,7 +498,7 @@ function extractURL (req) {
498
498
  return `${headers[HTTP2_HEADER_SCHEME]}://${headers[HTTP2_HEADER_AUTHORITY]}${headers[HTTP2_HEADER_PATH]}`
499
499
  } else {
500
500
  const protocol = getProtocol(req)
501
- return `${protocol}://${req.headers['host']}${req.originalUrl || req.url}`
501
+ return `${protocol}://${req.headers.host}${req.originalUrl || req.url}`
502
502
  }
503
503
  }
504
504
 
@@ -237,7 +237,7 @@ function ensureOOMExportStrategies (strategies, options) {
237
237
  }
238
238
  }
239
239
 
240
- return [ ...new Set(strategies) ]
240
+ return [...new Set(strategies)]
241
241
  }
242
242
 
243
243
  function getExporter (name, options) {
@@ -12,7 +12,7 @@ const mapping = {
12
12
 
13
13
  class ConsoleLogger {
14
14
  constructor (options = {}) {
15
- this._level = mapping[options.level] || mapping['error']
15
+ this._level = mapping[options.level] || mapping.error
16
16
  }
17
17
 
18
18
  debug (message) {
@@ -238,12 +238,15 @@ function captureHistograms () {
238
238
  *
239
239
  * performance.eventLoopUtilization available in Node.js >= v14.10, >= v12.19, >= v16
240
240
  */
241
- const captureELU = ('eventLoopUtilization' in performance) ? () => {
242
- // if elu is undefined (first run) the measurement is from start of process
243
- elu = performance.eventLoopUtilization(elu)
241
+ let captureELU = () => {}
242
+ if ('eventLoopUtilization' in performance) {
243
+ captureELU = () => {
244
+ // if elu is undefined (first run) the measurement is from start of process
245
+ elu = performance.eventLoopUtilization(elu)
244
246
 
245
- client.gauge('runtime.node.event_loop.utilization', elu.utilization)
246
- } : () => {}
247
+ client.gauge('runtime.node.event_loop.utilization', elu.utilization)
248
+ }
249
+ }
247
250
 
248
251
  function captureCommonMetrics () {
249
252
  captureMemoryUsage()
@@ -4,7 +4,7 @@ const log = require('./log')
4
4
 
5
5
  function maybeStartServerlessMiniAgent (config) {
6
6
  if (process.platform !== 'win32' && process.platform !== 'linux') {
7
- log.error(`Serverless Mini Agent is only supported on Windows and Linux.`)
7
+ log.error('Serverless Mini Agent is only supported on Windows and Linux.')
8
8
  return
9
9
  }
10
10
 
@@ -34,7 +34,8 @@ function getRustBinaryPath (config) {
34
34
 
35
35
  const rustBinaryPathRoot = config.isGCPFunction ? '/workspace' : '/home/site/wwwroot'
36
36
  const rustBinaryPathOsFolder = process.platform === 'win32'
37
- ? 'datadog-serverless-agent-windows-amd64' : 'datadog-serverless-agent-linux-amd64'
37
+ ? 'datadog-serverless-agent-windows-amd64'
38
+ : 'datadog-serverless-agent-linux-amd64'
38
39
 
39
40
  const rustBinaryExtension = process.platform === 'win32' ? '.exe' : ''
40
41
 
@@ -1,4 +1,3 @@
1
-
2
1
  function configWithFallback ({ tracerService, pluginConfig }) {
3
2
  return pluginConfig.service || tracerService
4
3
  }
@@ -58,11 +58,11 @@ class SpanProcessor {
58
58
  }
59
59
 
60
60
  if (this._killAll) {
61
- started.map(startedSpan => {
61
+ for (const startedSpan of started) {
62
62
  if (!startedSpan._finished) {
63
63
  startedSpan.finish()
64
64
  }
65
- })
65
+ }
66
66
  }
67
67
  }
68
68
 
@@ -181,7 +181,7 @@ class SpanStatsProcessor {
181
181
  const { bucketSizeNs } = this
182
182
  const serializedBuckets = []
183
183
 
184
- for (const [ timeNs, bucket ] of this.buckets.entries()) {
184
+ for (const [timeNs, bucket] of this.buckets.entries()) {
185
185
  const bucketAggStats = []
186
186
 
187
187
  for (const stats of bucket.values()) {
@@ -12,7 +12,7 @@ const savedDependenciesToSend = new Set()
12
12
  const detectedDependencyKeys = new Set()
13
13
  const detectedDependencyVersions = new Set()
14
14
 
15
- const FILE_URI_START = `file://`
15
+ const FILE_URI_START = 'file://'
16
16
  const moduleLoadStartChannel = dc.channel('dd-trace:moduleLoadStart')
17
17
 
18
18
  let immediate, config, application, host, initialLoad
@@ -21,12 +21,11 @@ let getRetryData
21
21
  let updateRetryData
22
22
 
23
23
  function createBatchPayload (payload) {
24
- const batchPayload = []
25
- payload.map(item => {
26
- batchPayload.push({
24
+ const batchPayload = payload.map(item => {
25
+ return {
27
26
  request_type: item.reqType,
28
27
  payload: item.payload
29
- })
28
+ }
30
29
  })
31
30
 
32
31
  return batchPayload
@@ -35,7 +35,7 @@ function updateRetryData (error, retryObj) {
35
35
  if (retryObj.reqType === 'message-batch') {
36
36
  const payload = retryObj.payload[0].payload
37
37
  const reqType = retryObj.payload[0].request_type
38
- retryData = { payload: payload, reqType: reqType }
38
+ retryData = { payload, reqType }
39
39
 
40
40
  // Since this payload failed twice it now gets save in to the extended heartbeat
41
41
  const failedPayload = retryObj.payload[1].payload
@@ -43,17 +43,17 @@ function updateRetryData (error, retryObj) {
43
43
 
44
44
  // save away the dependencies and integration request for extended heartbeat.
45
45
  if (failedReqType === 'app-integrations-change') {
46
- if (extendedHeartbeatPayload['integrations']) {
47
- extendedHeartbeatPayload['integrations'].push(failedPayload)
46
+ if (extendedHeartbeatPayload.integrations) {
47
+ extendedHeartbeatPayload.integrations.push(failedPayload)
48
48
  } else {
49
- extendedHeartbeatPayload['integrations'] = [failedPayload]
49
+ extendedHeartbeatPayload.integrations = [failedPayload]
50
50
  }
51
51
  }
52
52
  if (failedReqType === 'app-dependencies-loaded') {
53
- if (extendedHeartbeatPayload['dependencies']) {
54
- extendedHeartbeatPayload['dependencies'].push(failedPayload)
53
+ if (extendedHeartbeatPayload.dependencies) {
54
+ extendedHeartbeatPayload.dependencies.push(failedPayload)
55
55
  } else {
56
- extendedHeartbeatPayload['dependencies'] = [failedPayload]
56
+ extendedHeartbeatPayload.dependencies = [failedPayload]
57
57
  }
58
58
  }
59
59
  } else {
@@ -187,12 +187,11 @@ function getTelemetryData () {
187
187
  }
188
188
 
189
189
  function createBatchPayload (payload) {
190
- const batchPayload = []
191
- payload.map(item => {
192
- batchPayload.push({
190
+ const batchPayload = payload.map(item => {
191
+ return {
193
192
  request_type: item.reqType,
194
193
  payload: item.payload
195
- })
194
+ }
196
195
  })
197
196
 
198
197
  return batchPayload
@@ -202,10 +201,10 @@ function createPayload (currReqType, currPayload = {}) {
202
201
  if (getRetryData()) {
203
202
  const payload = { reqType: currReqType, payload: currPayload }
204
203
  const batchPayload = createBatchPayload([payload, retryData])
205
- return { 'reqType': 'message-batch', 'payload': batchPayload }
204
+ return { reqType: 'message-batch', payload: batchPayload }
206
205
  }
207
206
 
208
- return { 'reqType': currReqType, 'payload': currPayload }
207
+ return { reqType: currReqType, payload: currPayload }
209
208
  }
210
209
 
211
210
  function heartbeat (config, application, host) {
@@ -1,4 +1,3 @@
1
-
2
1
  const request = require('../exporters/common/request')
3
2
  const log = require('../log')
4
3
  const { isTrue } = require('../util')
@@ -32,13 +32,6 @@ function globMatch (pattern, subject) {
32
32
  if (px < pattern.length) {
33
33
  const c = pattern[px]
34
34
  switch (c) {
35
- default: // ordinary character
36
- if (sx < subject.length && subject[sx] === c) {
37
- px++
38
- sx++
39
- continue
40
- }
41
- break
42
35
  case '?':
43
36
  if (sx < subject.length) {
44
37
  px++
@@ -51,6 +44,13 @@ function globMatch (pattern, subject) {
51
44
  nextSx = sx + 1
52
45
  px++
53
46
  continue
47
+ default: // ordinary character
48
+ if (sx < subject.length && subject[sx] === c) {
49
+ px++
50
+ sx++
51
+ continue
52
+ }
53
+ break
54
54
  }
55
55
  }
56
56
  if (nextSx > 0 && nextSx <= subject.length) {