Skip to content

Commit 3644a2d

Browse files
committed
Fix some types
1 parent 3414eec commit 3644a2d

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

integration-tests/debugger/snapshot-time-budget.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ describe('Dynamic Instrumentation', function () {
6666
}))
6767

6868
// Trigger once; this run is expected to be slow and mark fields with "timeout"
69-
const result1 = await breakpoint.triggerBreakpoint()
69+
const result1 = /** @type {import('axios').AxiosResponse<{ paused: number }>} */
70+
(await breakpoint.triggerBreakpoint())
7071
assert.ok(
7172
result1.data.paused >= 1_000,
7273
`expected thread to be paused for at least 1 second, but was paused for ~${result1.data.paused}ms`

integration-tests/debugger/target-app/snapshot-time-budget.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
'use strict'
22

3+
// @ts-expect-error This code is running in a sandbox where dd-trace is available
34
require('dd-trace/init')
45

56
// @ts-expect-error This code is running in a sandbox where fastify is available
67
const Fastify = require('fastify')
78
const {
89
LARGE_OBJECT_SKIP_THRESHOLD
10+
// @ts-expect-error This code is running in a sandbox where dd-trace is available
911
} = require('dd-trace/packages/dd-trace/src/debugger/devtools_client/snapshot/constants')
1012

1113
const fastify = Fastify({ logger: { level: 'error' } })

integration-tests/debugger/utils.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const pollInterval = 0.1
4141
*
4242
* @typedef {BreakpointInfo & {
4343
* rcConfig: object|null,
44-
* triggerBreakpoint: (url: string) => Promise<import('axios').AxiosResponse<unknown>>,
44+
* triggerBreakpoint: () => Promise<import('axios').AxiosResponse<unknown>>,
4545
* generateRemoteConfig: (overrides?: object) => object,
4646
* generateProbeConfig: BoundGenerateProbeConfigFn
4747
* }} EnrichedBreakpoint
@@ -66,6 +66,7 @@ const pollInterval = 0.1
6666
* once installed.
6767
* @property {(overrides?: object) => object} generateRemoteConfig - Generates RC for the primary breakpoint.
6868
* @property {BoundGenerateProbeConfigFn} generateProbeConfig - Generates probe config for the primary breakpoint.
69+
* @property {() => Promise<object>} snapshotReceived - Waits for a snapshot to be received from the test app.
6970
*/
7071

7172
module.exports = {
@@ -132,7 +133,7 @@ function setup ({ env, testApp, testAppSource, dependencies, silent, stdioHandle
132133
generateProbeConfig: generateProbeConfig.bind(null, breakpoints[0]),
133134

134135
snapshotReceived () {
135-
return new Promise((/** @type {(value?: object) => void} */ resolve) => {
136+
return new Promise((/** @type {(value: object) => void} */ resolve) => {
136137
t.agent.on('debugger-input', ({ payload: [{ debugger: { snapshot } }] }) => {
137138
resolve(snapshot)
138139
})

packages/dd-trace/test/debugger/devtools_client/utils.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ module.exports = {
77
getRequestOptions
88
}
99

10+
/**
11+
* @typedef {object} RequestOptions
12+
* @property {string} method
13+
* @property {string} path
14+
*/
15+
1016
/**
1117
* @typedef {object} ProbeConfig
1218
* @property {string} id
@@ -63,7 +69,7 @@ function generateProbeConfig (breakpoint, overrides = {}) {
6369
* Get the request options from a request spy call
6470
*
6571
* @param {sinon.SinonSpy} request - The request spy to get the options from.
66-
* @returns {unknown} - The 2nd argument to the `request` function (i.e. the request options).
72+
* @returns {RequestOptions} - The 2nd argument to the `request` function (i.e. the request options).
6773
*/
6874
function getRequestOptions (request) {
6975
return request.lastCall.args[1]

0 commit comments

Comments
 (0)