Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 93b5d40

Browse files
authored
chore: add basic tsconfig to check for type errors (#6447)
Add lots of JSDoc and fix other type errors and add a basic tsconfig.json file that is used for basic type checks. The checks will be improved over time.
1 parent bae4e64 commit 93b5d40

File tree

75 files changed

+1422
-432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1422
-432
lines changed

.github/workflows/project.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ jobs:
8686
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
8787
- uses: ./.github/actions/node/latest
8888
- uses: ./.github/actions/install
89-
- run: yarn type:test
90-
- run: yarn type:doc
89+
- run: npm run type:test
90+
- run: npm run type:doc
9191

9292
# TODO: Remove need for `npm show` before re-enabling to avoid rate limit errors.
9393
# verify-yaml:

LICENSE-3rdparty.csv

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ require,shell-quote,mit,Copyright (c) 2013 James Halliday
3333
require,source-map,BSD-3-Clause,Copyright (c) 2009-2011, Mozilla Foundation and contributors
3434
require,ttl-set,MIT,Copyright (c) 2024 Thomas Watson
3535
dev,@babel/helpers,MIT,Copyright (c) 2014-present Sebastian McKenzie and other contributors
36-
dev,@types/node,MIT,Copyright Authors
36+
dev,@types/chai,MIT,Copyright (c) Microsoft Corp.
37+
dev,@types/mocha,MIT,Copyright (c) Microsoft Corp.
38+
dev,@types/node,MIT,Copyright (c) Microsoft Corp.
39+
dev,@types/sinon,MIT,Copyright (c) Microsoft Corp.
40+
dev,@types/tap,MIT,Copyright (c) Microsoft Corp.
3741
dev,@eslint/eslintrc,MIT,Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
3842
dev,@eslint/js,MIT,Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
3943
dev,@msgpack/msgpack,ISC,Copyright 2019 The MessagePack Community
@@ -65,6 +69,7 @@ dev,sinon,BSD-3-Clause,Copyright 2010-2017 Christian Johansen
6569
dev,sinon-chai,WTFPL and BSD-2-Clause,Copyright 2004 Sam Hocevar 2012–2017 Domenic Denicola
6670
dev,tap,ISC,Copyright 2011-2022 Isaac Z. Schlueter and Contributors
6771
dev,tiktoken,MIT,Copyright (c) 2022 OpenAI, Shantanu Jain
72+
dev,typescript,Apache license 2.0,Copyright Microsoft Corp.
6873
dev,workerpool,Apache license 2.0,Copyright (C) 2014-2024 Jos de Jong [email protected]
6974
dev,yaml,ISC,Copyright Eemeli Aro <[email protected]>
7075
dev,yarn-deduplicate,Apache license 2.0,Copyright [yyyy] [name of copyright owner]

benchmark/sirun/run-util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const childProcess = require('child_process')
44
const readline = require('readline')
55

66
function exec (...args) {
7-
return new Promise((resolve, reject) => {
7+
return /** @type {Promise<void>} */ (new Promise((resolve, reject) => {
88
const proc = childProcess.spawn(...args)
99
streamAddVersion(proc.stdout)
1010
proc.on('error', reject)
@@ -15,7 +15,7 @@ function exec (...args) {
1515
reject(new Error('Process exited with non-zero code.'))
1616
}
1717
})
18-
})
18+
}))
1919
}
2020

2121
function streamAddVersion (input) {

benchmark/sirun/startup/startup-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if (Number(process.env.USE_TRACER)) {
66

77
if (Number(process.env.EVERYTHING)) {
88
// TODO: Add a preparation step that installs these dependencies. That way we
9-
// are independent from what is currently installed in case adependency is
9+
// are independent from what is currently installed in case a dependency is
1010
// removed.
1111
const packages = [
1212
'@babel/helpers',

docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"license": "BSD-3-Clause",
1111
"private": true,
1212
"devDependencies": {
13-
"typedoc": "^0.25.13",
14-
"typescript": "^4.9.4"
13+
"typedoc": "^0.28.12",
14+
"typescript": "^5.9.2"
1515
}
1616
}

docs/yarn.lock

Lines changed: 118 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,68 @@
22
# yarn lockfile v1
33

44

5-
ansi-sequence-parser@^1.1.0:
6-
version "1.1.1"
7-
resolved "https://registry.yarnpkg.com/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz#e0aa1cdcbc8f8bb0b5bca625aac41f5f056973cf"
8-
integrity sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==
5+
"@gerrit0/mini-shiki@^3.12.0":
6+
version "3.12.1"
7+
resolved "https://registry.yarnpkg.com/@gerrit0/mini-shiki/-/mini-shiki-3.12.1.tgz#d6b40216d05f86fee07d27a30957dc7ff994b39a"
8+
integrity sha512-qA9/VGm7No0kxb7k0oKFT0DSJ6BtuMMtC7JQdZn9ElMALE9hjbyoaS13Y8OWr0qHwzh07KHt3Wbw34az/FLsrg==
9+
dependencies:
10+
"@shikijs/engine-oniguruma" "^3.12.1"
11+
"@shikijs/langs" "^3.12.1"
12+
"@shikijs/themes" "^3.12.1"
13+
"@shikijs/types" "^3.12.1"
14+
"@shikijs/vscode-textmate" "^10.0.2"
15+
16+
"@shikijs/engine-oniguruma@^3.12.1":
17+
version "3.12.1"
18+
resolved "https://registry.yarnpkg.com/@shikijs/engine-oniguruma/-/engine-oniguruma-3.12.1.tgz#b93c07abfc83158350888a407fd6044bc48b19b9"
19+
integrity sha512-hbYq+XOc55CU7Irkhsgwh8WgQbx2W5IVzHV4l+wZ874olMLSNg5o3F73vo9m4SAhimFyqq/86xnx9h+T30HhhQ==
20+
dependencies:
21+
"@shikijs/types" "3.12.1"
22+
"@shikijs/vscode-textmate" "^10.0.2"
23+
24+
"@shikijs/langs@^3.12.1":
25+
version "3.12.1"
26+
resolved "https://registry.yarnpkg.com/@shikijs/langs/-/langs-3.12.1.tgz#8083318b1c7dad41b990f5644d7a27b93514e11f"
27+
integrity sha512-Y1MbMfVO5baRz7Boo7EoD36TmzfUx/I5n8e+wZumx6SlUA81Zj1ZwNJL871iIuSHrdsheV4AxJtHQ9mlooklmg==
28+
dependencies:
29+
"@shikijs/types" "3.12.1"
30+
31+
"@shikijs/themes@^3.12.1":
32+
version "3.12.1"
33+
resolved "https://registry.yarnpkg.com/@shikijs/themes/-/themes-3.12.1.tgz#df329febeaa80a931d2dfc8528342ad4bd55140f"
34+
integrity sha512-9JrAm9cA5hqM/YXymA3oAAZdnCgQf1zyrNDtsnM105nNEoEpux4dyzdoOjc2KawEKj1iUs/WH2ota6Atp7GYkQ==
35+
dependencies:
36+
"@shikijs/types" "3.12.1"
37+
38+
"@shikijs/[email protected]", "@shikijs/types@^3.12.1":
39+
version "3.12.1"
40+
resolved "https://registry.yarnpkg.com/@shikijs/types/-/types-3.12.1.tgz#d9eef9ed3bbcf78d1a40a0e5527a1022e0067547"
41+
integrity sha512-Is/p+1vTss22LIsGCJTmGrxu7ZC1iBL9doJFYLaZ4aI8d0VDXb7Mn0kBzhkc7pdsRpmUbQLQ5HXwNpa3H6F8og==
42+
dependencies:
43+
"@shikijs/vscode-textmate" "^10.0.2"
44+
"@types/hast" "^3.0.4"
45+
46+
"@shikijs/vscode-textmate@^10.0.2":
47+
version "10.0.2"
48+
resolved "https://registry.yarnpkg.com/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz#a90ab31d0cc1dfb54c66a69e515bf624fa7b2224"
49+
integrity sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==
50+
51+
"@types/hast@^3.0.4":
52+
version "3.0.4"
53+
resolved "https://registry.yarnpkg.com/@types/hast/-/hast-3.0.4.tgz#1d6b39993b82cea6ad783945b0508c25903e15aa"
54+
integrity sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==
55+
dependencies:
56+
"@types/unist" "*"
57+
58+
"@types/unist@*":
59+
version "3.0.3"
60+
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-3.0.3.tgz#acaab0f919ce69cce629c2d4ed2eb4adc1b6c20c"
61+
integrity sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==
62+
63+
argparse@^2.0.1:
64+
version "2.0.1"
65+
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
66+
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
967

1068
balanced-match@^1.0.0:
1169
version "1.0.2"
@@ -19,59 +77,74 @@ brace-expansion@^2.0.1:
1977
dependencies:
2078
balanced-match "^1.0.0"
2179

22-
jsonc-parser@^3.2.0:
23-
version "3.3.1"
24-
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.3.1.tgz#f2a524b4f7fd11e3d791e559977ad60b98b798b4"
25-
integrity sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==
80+
entities@^4.4.0:
81+
version "4.5.0"
82+
resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48"
83+
integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==
84+
85+
linkify-it@^5.0.0:
86+
version "5.0.0"
87+
resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-5.0.0.tgz#9ef238bfa6dc70bd8e7f9572b52d369af569b421"
88+
integrity sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==
89+
dependencies:
90+
uc.micro "^2.0.0"
2691

2792
lunr@^2.3.9:
2893
version "2.3.9"
2994
resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1"
3095
integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==
3196

32-
marked@^4.3.0:
33-
version "4.3.0"
34-
resolved "https://registry.yarnpkg.com/marked/-/marked-4.3.0.tgz#796362821b019f734054582038b116481b456cf3"
35-
integrity sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==
97+
markdown-it@^14.1.0:
98+
version "14.1.0"
99+
resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-14.1.0.tgz#3c3c5992883c633db4714ccb4d7b5935d98b7d45"
100+
integrity sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==
101+
dependencies:
102+
argparse "^2.0.1"
103+
entities "^4.4.0"
104+
linkify-it "^5.0.0"
105+
mdurl "^2.0.0"
106+
punycode.js "^2.3.1"
107+
uc.micro "^2.1.0"
108+
109+
mdurl@^2.0.0:
110+
version "2.0.0"
111+
resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-2.0.0.tgz#80676ec0433025dd3e17ee983d0fe8de5a2237e0"
112+
integrity sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==
36113

37-
minimatch@^9.0.3:
114+
minimatch@^9.0.5:
38115
version "9.0.5"
39116
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5"
40117
integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==
41118
dependencies:
42119
brace-expansion "^2.0.1"
43120

44-
shiki@^0.14.7:
45-
version "0.14.7"
46-
resolved "https://registry.yarnpkg.com/shiki/-/shiki-0.14.7.tgz#c3c9e1853e9737845f1d2ef81b31bcfb07056d4e"
47-
integrity sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==
48-
dependencies:
49-
ansi-sequence-parser "^1.1.0"
50-
jsonc-parser "^3.2.0"
51-
vscode-oniguruma "^1.7.0"
52-
vscode-textmate "^8.0.0"
53-
54-
typedoc@^0.25.13:
55-
version "0.25.13"
56-
resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.25.13.tgz#9a98819e3b2d155a6d78589b46fa4c03768f0922"
57-
integrity sha512-pQqiwiJ+Z4pigfOnnysObszLiU3mVLWAExSPf+Mu06G/qsc3wzbuM56SZQvONhHLncLUhYzOVkjFFpFfL5AzhQ==
121+
punycode.js@^2.3.1:
122+
version "2.3.1"
123+
resolved "https://registry.yarnpkg.com/punycode.js/-/punycode.js-2.3.1.tgz#6b53e56ad75588234e79f4affa90972c7dd8cdb7"
124+
integrity sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==
125+
126+
typedoc@^0.28.12:
127+
version "0.28.12"
128+
resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.28.12.tgz#1baa55ab242e237fc896bc01b57cf5f8bd995d32"
129+
integrity sha512-H5ODu4f7N+myG4MfuSp2Vh6wV+WLoZaEYxKPt2y8hmmqNEMVrH69DAjjdmYivF4tP/C2jrIZCZhPalZlTU/ipA==
58130
dependencies:
131+
"@gerrit0/mini-shiki" "^3.12.0"
59132
lunr "^2.3.9"
60-
marked "^4.3.0"
61-
minimatch "^9.0.3"
62-
shiki "^0.14.7"
63-
64-
typescript@^4.9.4:
65-
version "4.9.5"
66-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
67-
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
68-
69-
vscode-oniguruma@^1.7.0:
70-
version "1.7.0"
71-
resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz#439bfad8fe71abd7798338d1cd3dc53a8beea94b"
72-
integrity sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==
73-
74-
vscode-textmate@^8.0.0:
75-
version "8.0.0"
76-
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-8.0.0.tgz#2c7a3b1163ef0441097e0b5d6389cd5504b59e5d"
77-
integrity sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==
133+
markdown-it "^14.1.0"
134+
minimatch "^9.0.5"
135+
yaml "^2.8.1"
136+
137+
typescript@^5.9.2:
138+
version "5.9.2"
139+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.2.tgz#d93450cddec5154a2d5cabe3b8102b83316fb2a6"
140+
integrity sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==
141+
142+
uc.micro@^2.0.0, uc.micro@^2.1.0:
143+
version "2.1.0"
144+
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-2.1.0.tgz#f8d3f7d0ec4c3dea35a7e3c8efa4cb8b45c9e7ee"
145+
integrity sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==
146+
147+
yaml@^2.8.1:
148+
version "2.8.1"
149+
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.8.1.tgz#1870aa02b631f7e8328b93f8bc574fac5d6c4d79"
150+
integrity sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==

integration-tests/appsec/index.spec.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ describe('RASP', () => {
3535
execArgv,
3636
env: {
3737
DD_TRACE_AGENT_PORT: agent.port,
38-
DD_APPSEC_ENABLED: true,
39-
DD_APPSEC_RASP_ENABLED: true,
38+
DD_APPSEC_ENABLED: 'true',
39+
DD_APPSEC_RASP_ENABLED: 'true',
4040
DD_APPSEC_RULES: path.join(cwd, 'appsec/rasp/rasp_rules.json'),
41-
DD_APPSEC_RASP_COLLECT_REQUEST_BODY: collectRequestBody
41+
DD_APPSEC_RASP_COLLECT_REQUEST_BODY: String(collectRequestBody)
4242
}
4343
}, stdOutputHandler, stdOutputHandler)
4444
axios = Axios.create({ baseURL: proc.url })
@@ -90,15 +90,15 @@ describe('RASP', () => {
9090
await assertExploitDetected()
9191
}
9292

93-
return new Promise((resolve, reject) => {
93+
return /** @type {Promise<void>} */ (new Promise((resolve, reject) => {
9494
setTimeout(() => {
9595
if (hasOutput) {
9696
reject(new Error('Unexpected output in stdout/stderr after blocking request'))
9797
} else {
9898
resolve()
9999
}
100100
}, 50)
101-
})
101+
}))
102102
}
103103

104104
async function testCustomErrorHandlerIsNotExecuted (path) {
@@ -119,15 +119,15 @@ describe('RASP', () => {
119119
assert.strictEqual(e.response.status, 403)
120120
await assertExploitDetected()
121121

122-
return new Promise((resolve, reject) => {
122+
return /** @type {Promise<void>} */ (new Promise((resolve, reject) => {
123123
setTimeout(() => {
124124
if (hasOutput) {
125125
reject(new Error('uncaughtExceptionCaptureCallback executed'))
126126
} else {
127127
resolve()
128128
}
129129
}, 10)
130-
})
130+
}))
131131
}
132132
}
133133

@@ -140,15 +140,15 @@ describe('RASP', () => {
140140
try {
141141
await axios.get('/crash')
142142
} catch (e) {
143-
return new Promise((resolve, reject) => {
143+
return /** @type {Promise<void>} */ (new Promise((resolve, reject) => {
144144
setTimeout(() => {
145145
if (hasOutput) {
146146
resolve()
147147
} else {
148148
reject(new Error('Output expected after crash'))
149149
}
150150
}, 50)
151-
})
151+
}))
152152
}
153153

154154
assert.fail('Request should have failed')
@@ -168,15 +168,15 @@ describe('RASP', () => {
168168
try {
169169
await axios.get('/crash-and-recovery-A')
170170
} catch (e) {
171-
return new Promise((resolve, reject) => {
171+
return /** @type {Promise<void>} */ (new Promise((resolve, reject) => {
172172
setTimeout(() => {
173173
if (hasOutput) {
174174
reject(new Error('Unexpected output in stdout/stderr after blocking request'))
175175
} else {
176176
resolve()
177177
}
178178
}, 50)
179-
})
179+
}))
180180
}
181181

182182
assert.fail('Request should have failed')
@@ -191,15 +191,15 @@ describe('RASP', () => {
191191
try {
192192
await axios.get('/crash-and-recovery-B')
193193
} catch (e) {
194-
return new Promise((resolve, reject) => {
194+
return /** @type {Promise<void>} */ (new Promise((resolve, reject) => {
195195
setTimeout(() => {
196196
if (hasOutput) {
197197
reject(new Error('Unexpected output in stdout/stderr after blocking request'))
198198
} else {
199199
resolve()
200200
}
201201
}, 50)
202-
})
202+
}))
203203
}
204204

205205
assert.fail('Request should have failed')

integration-tests/ci-visibility/test-api-manual/test.fake.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
const { channel } = require('dc-polyfill')
33
const tracer = require('dd-trace')
44

5+
const assert = require('assert/strict')
6+
57
const testStartCh = channel('dd-trace:ci:manual:test:start')
68
const testFinishCh = channel('dd-trace:ci:manual:test:finish')
79
const testAddTagsCh = channel('dd-trace:ci:manual:test:addTags')
@@ -22,12 +24,12 @@ describe('can run tests', () => {
2224
assert.equal(1, 2)
2325
})
2426
test('async test will pass', () => {
25-
return new Promise((resolve) => {
27+
return /** @type {Promise<void>} */ (new Promise((resolve) => {
2628
setTimeout(() => {
2729
assert.equal(1, 1)
2830
resolve()
2931
}, 10)
30-
})
32+
}))
3133
})
3234
test('integration test', () => {
3335
// Just for testing purposes, so we don't create a custom span
@@ -38,11 +40,11 @@ describe('can run tests', () => {
3840
const childSpan = tracer.startSpan('custom.span', {
3941
childOf: testSpan
4042
})
41-
return new Promise((resolve) => {
43+
return /** @type {Promise<void>} */ (new Promise((resolve) => {
4244
setTimeout(() => {
4345
childSpan.finish()
4446
resolve()
4547
}, 10)
46-
})
48+
}))
4749
})
4850
})

0 commit comments

Comments
 (0)