dd-trace 5.0.0-pre-b37a12e → 5.0.0-pre-c56d758
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-3rdparty.csv
CHANGED
|
@@ -14,6 +14,7 @@ require,import-in-the-middle,Apache license 2.0,Copyright 2021 Datadog Inc.
|
|
|
14
14
|
require,int64-buffer,MIT,Copyright 2015-2016 Yusuke Kawasaki
|
|
15
15
|
require,ipaddr.js,MIT,Copyright 2011-2017 whitequark
|
|
16
16
|
require,istanbul-lib-coverage,BSD-3-Clause,Copyright 2012-2015 Yahoo! Inc.
|
|
17
|
+
require,jest-docblock,MIT,Copyright Meta Platforms, Inc. and affiliates.
|
|
17
18
|
require,koalas,MIT,Copyright 2013-2017 Brian Woodward
|
|
18
19
|
require,limiter,MIT,Copyright 2011 John Hurliman
|
|
19
20
|
require,lodash.kebabcase,MIT,Copyright JS Foundation and other contributors
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dd-trace",
|
|
3
|
-
"version": "5.0.0-pre-
|
|
3
|
+
"version": "5.0.0-pre-c56d758",
|
|
4
4
|
"description": "Datadog APM tracing client for JavaScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@datadog/native-iast-rewriter": "2.1.3",
|
|
73
73
|
"@datadog/native-iast-taint-tracking": "1.5.0",
|
|
74
74
|
"@datadog/native-metrics": "^2.0.0",
|
|
75
|
-
"@datadog/pprof": "
|
|
75
|
+
"@datadog/pprof": "4.0.0",
|
|
76
76
|
"@datadog/sketches-js": "^2.1.0",
|
|
77
77
|
"@opentelemetry/api": "^1.0.0",
|
|
78
78
|
"@opentelemetry/core": "^1.14.0",
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"int64-buffer": "^0.1.9",
|
|
84
84
|
"ipaddr.js": "^2.1.0",
|
|
85
85
|
"istanbul-lib-coverage": "3.2.0",
|
|
86
|
+
"jest-docblock": "^29.7.0",
|
|
86
87
|
"koalas": "^1.0.2",
|
|
87
88
|
"limiter": "^1.1.4",
|
|
88
89
|
"lodash.kebabcase": "^4.1.1",
|
|
@@ -10,7 +10,9 @@ const {
|
|
|
10
10
|
TEST_PARAMETERS,
|
|
11
11
|
TEST_COMMAND,
|
|
12
12
|
TEST_FRAMEWORK_VERSION,
|
|
13
|
-
TEST_SOURCE_START
|
|
13
|
+
TEST_SOURCE_START,
|
|
14
|
+
TEST_ITR_UNSKIPPABLE,
|
|
15
|
+
TEST_ITR_FORCED_RUN
|
|
14
16
|
} = require('../../dd-trace/src/plugins/util/test')
|
|
15
17
|
const { COMPONENT } = require('../../dd-trace/src/constants')
|
|
16
18
|
const id = require('../../dd-trace/src/id')
|
|
@@ -89,7 +91,9 @@ class JestPlugin extends CiPlugin {
|
|
|
89
91
|
const {
|
|
90
92
|
_ddTestSessionId: testSessionId,
|
|
91
93
|
_ddTestCommand: testCommand,
|
|
92
|
-
_ddTestModuleId: testModuleId
|
|
94
|
+
_ddTestModuleId: testModuleId,
|
|
95
|
+
_ddForcedToRun,
|
|
96
|
+
_ddUnskippable
|
|
93
97
|
} = testEnvironmentOptions
|
|
94
98
|
|
|
95
99
|
const testSessionSpanContext = this.tracer.extract('text_map', {
|
|
@@ -99,6 +103,13 @@ class JestPlugin extends CiPlugin {
|
|
|
99
103
|
|
|
100
104
|
const testSuiteMetadata = getTestSuiteCommonTags(testCommand, frameworkVersion, testSuite, 'jest')
|
|
101
105
|
|
|
106
|
+
if (_ddUnskippable) {
|
|
107
|
+
testSuiteMetadata[TEST_ITR_UNSKIPPABLE] = 'true'
|
|
108
|
+
if (_ddForcedToRun) {
|
|
109
|
+
testSuiteMetadata[TEST_ITR_FORCED_RUN] = 'true'
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
102
113
|
this.testSuiteSpan = this.tracer.startSpan('jest.test_suite', {
|
|
103
114
|
childOf: testSessionSpanContext,
|
|
104
115
|
tags: {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
const { readFileSync } = require('fs')
|
|
2
|
+
const { parse, extract } = require('jest-docblock')
|
|
3
|
+
|
|
1
4
|
const { getTestSuitePath } = require('../../dd-trace/src/plugins/util/test')
|
|
5
|
+
const log = require('../../dd-trace/src/log')
|
|
2
6
|
|
|
3
7
|
/**
|
|
4
8
|
* There are two ways to call `test.each` in `jest`:
|
|
@@ -47,10 +51,47 @@ function getJestTestName (test) {
|
|
|
47
51
|
return titles.join(' ')
|
|
48
52
|
}
|
|
49
53
|
|
|
54
|
+
function isMarkedAsUnskippable (test) {
|
|
55
|
+
let docblocks
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
const testSource = readFileSync(test.path, 'utf8')
|
|
59
|
+
docblocks = parse(extract(testSource))
|
|
60
|
+
} catch (e) {
|
|
61
|
+
// If we have issues parsing the file, we'll assume no unskippable was passed
|
|
62
|
+
return false
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// docblocks were correctly parsed but it does not include a @datadog block
|
|
66
|
+
if (!docblocks?.datadog) {
|
|
67
|
+
return false
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
return JSON.parse(docblocks.datadog).unskippable
|
|
72
|
+
} catch (e) {
|
|
73
|
+
// If the @datadog block comment is present but malformed, we'll run the suite
|
|
74
|
+
log.warn('@datadog block comment is malformed.')
|
|
75
|
+
return true
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
50
79
|
function getJestSuitesToRun (skippableSuites, originalTests, rootDir) {
|
|
51
80
|
return originalTests.reduce((acc, test) => {
|
|
52
81
|
const relativePath = getTestSuitePath(test.path, rootDir)
|
|
53
82
|
const shouldBeSkipped = skippableSuites.includes(relativePath)
|
|
83
|
+
|
|
84
|
+
if (isMarkedAsUnskippable(test)) {
|
|
85
|
+
acc.suitesToRun.push(test)
|
|
86
|
+
if (test?.context?.config?.testEnvironmentOptions) {
|
|
87
|
+
test.context.config.testEnvironmentOptions['_ddUnskippable'] = true
|
|
88
|
+
if (shouldBeSkipped) {
|
|
89
|
+
test.context.config.testEnvironmentOptions['_ddForcedToRun'] = true
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return acc
|
|
93
|
+
}
|
|
94
|
+
|
|
54
95
|
if (shouldBeSkipped) {
|
|
55
96
|
acc.skippedSuites.push(relativePath)
|
|
56
97
|
} else {
|
|
@@ -58,6 +58,8 @@ const TEST_ITR_SKIPPING_ENABLED = 'test.itr.tests_skipping.enabled'
|
|
|
58
58
|
const TEST_ITR_SKIPPING_TYPE = 'test.itr.tests_skipping.type'
|
|
59
59
|
const TEST_ITR_SKIPPING_COUNT = 'test.itr.tests_skipping.count'
|
|
60
60
|
const TEST_CODE_COVERAGE_ENABLED = 'test.code_coverage.enabled'
|
|
61
|
+
const TEST_ITR_UNSKIPPABLE = 'test.itr.unskippable'
|
|
62
|
+
const TEST_ITR_FORCED_RUN = 'test.itr.forced_run'
|
|
61
63
|
|
|
62
64
|
const TEST_CODE_COVERAGE_LINES_PCT = 'test.code_coverage.lines_pct'
|
|
63
65
|
|
|
@@ -107,6 +109,8 @@ module.exports = {
|
|
|
107
109
|
TEST_ITR_SKIPPING_COUNT,
|
|
108
110
|
TEST_CODE_COVERAGE_ENABLED,
|
|
109
111
|
TEST_CODE_COVERAGE_LINES_PCT,
|
|
112
|
+
TEST_ITR_UNSKIPPABLE,
|
|
113
|
+
TEST_ITR_FORCED_RUN,
|
|
110
114
|
addIntelligentTestRunnerSpanTags,
|
|
111
115
|
getCoveredFilenamesFromCoverage,
|
|
112
116
|
resetCoverage,
|
|
@@ -23,7 +23,7 @@ function getStartedSpans (context) {
|
|
|
23
23
|
return context._trace.started
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
function generateLabels ({ spanId, rootSpanId, webTags, endpoint }) {
|
|
26
|
+
function generateLabels ({ context: { spanId, rootSpanId, webTags, endpoint }, timestamp }) {
|
|
27
27
|
const labels = {}
|
|
28
28
|
if (spanId) {
|
|
29
29
|
labels['span id'] = spanId
|
|
@@ -37,6 +37,8 @@ function generateLabels ({ spanId, rootSpanId, webTags, endpoint }) {
|
|
|
37
37
|
// fallback to endpoint computed when sample was taken
|
|
38
38
|
labels['trace endpoint'] = endpoint
|
|
39
39
|
}
|
|
40
|
+
// Incoming timestamps are in microseconds, we emit nanos.
|
|
41
|
+
labels['end_timestamp_ns'] = timestamp * 1000n
|
|
40
42
|
|
|
41
43
|
return labels
|
|
42
44
|
}
|