dd-trace 4.0.0-pre-4e7da80 → 4.0.0-pre-c8f45ab

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dd-trace",
3
- "version": "4.0.0-pre-4e7da80",
3
+ "version": "4.0.0-pre-c8f45ab",
4
4
  "description": "Datadog APM tracing client for JavaScript",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -9,8 +9,15 @@ const {
9
9
  getCoveredFilenamesFromCoverage,
10
10
  JEST_WORKER_TRACE_PAYLOAD_CODE,
11
11
  JEST_WORKER_COVERAGE_PAYLOAD_CODE,
12
- getTestLineStart
12
+ getTestLineStart,
13
+ getTestSuitePath,
14
+ getTestParametersString
13
15
  } = require('../../dd-trace/src/plugins/util/test')
16
+ const {
17
+ getFormattedJestTestParameters,
18
+ getJestTestName,
19
+ getJestSuitesToRun
20
+ } = require('../../datadog-plugin-jest/src/util')
14
21
 
15
22
  const testSessionStartCh = channel('ci:jest:session:start')
16
23
  const testSessionFinishCh = channel('ci:jest:session:finish')
@@ -37,13 +44,6 @@ let skippableSuites = []
37
44
  let isCodeCoverageEnabled = false
38
45
  let isSuitesSkippingEnabled = false
39
46
 
40
- const {
41
- getTestSuitePath,
42
- getTestParametersString
43
- } = require('../../dd-trace/src/plugins/util/test')
44
-
45
- const { getFormattedJestTestParameters, getJestTestName } = require('../../datadog-plugin-jest/src/util')
46
-
47
47
  const sessionAsyncResource = new AsyncResource('bound-anonymous-fn')
48
48
 
49
49
  const specStatusToTestStatus = {
@@ -429,10 +429,7 @@ addHook({
429
429
  const testPaths = await getTestPaths.apply(this, arguments)
430
430
  const { tests } = testPaths
431
431
 
432
- const filteredTests = tests.filter(({ path: testPath }) => {
433
- const relativePath = testPath.replace(`${rootDir}/`, '')
434
- return !skippableSuites.includes(relativePath)
435
- })
432
+ const filteredTests = getJestSuitesToRun(skippableSuites, tests, rootDir)
436
433
 
437
434
  skippableSuites = []
438
435
 
@@ -1,3 +1,5 @@
1
+ const { getTestSuitePath } = require('../../dd-trace/src/plugins/util/test')
2
+
1
3
  /**
2
4
  * There are two ways to call `test.each` in `jest`:
3
5
  * 1. With an array of arrays: https://jestjs.io/docs/api#1-testeachtablename-fn-timeout
@@ -45,4 +47,11 @@ function getJestTestName (test) {
45
47
  return titles.join(' ')
46
48
  }
47
49
 
48
- module.exports = { getFormattedJestTestParameters, getJestTestName }
50
+ function getJestSuitesToRun (skippableSuites, originalTests, rootDir) {
51
+ return originalTests.filter(({ path: testPath }) => {
52
+ const relativePath = getTestSuitePath(testPath, rootDir)
53
+ return !skippableSuites.includes(relativePath)
54
+ })
55
+ }
56
+
57
+ module.exports = { getFormattedJestTestParameters, getJestTestName, getJestSuitesToRun }