From 923fa0d4b438cf91e182912b7c0d92503185abd5 Mon Sep 17 00:00:00 2001 From: Juan Fernandez Date: Fri, 10 Jan 2025 16:17:10 +0100 Subject: [PATCH] fix unit test --- .../dynamic-instrumentation.spec.js | 4 ++-- ...sibility-dynamic-instrumentation-script.js | 20 +++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/packages/dd-trace/test/ci-visibility/dynamic-instrumentation/dynamic-instrumentation.spec.js b/packages/dd-trace/test/ci-visibility/dynamic-instrumentation/dynamic-instrumentation.spec.js index b07ce40533f..6124ef2343d 100644 --- a/packages/dd-trace/test/ci-visibility/dynamic-instrumentation/dynamic-instrumentation.spec.js +++ b/packages/dd-trace/test/ci-visibility/dynamic-instrumentation/dynamic-instrumentation.spec.js @@ -23,8 +23,8 @@ describe('test visibility with dynamic instrumentation', () => { it('can grab local variables', (done) => { childProcess = fork(path.join(__dirname, 'target-app', 'test-visibility-dynamic-instrumentation-script.js')) - childProcess.on('message', ({ snapshot: { language, stack, probe, captures }, snapshotId }) => { - assert.exists(snapshotId) + childProcess.on('message', ({ snapshot: { language, stack, probe, captures }, probeId }) => { + assert.exists(probeId) assert.exists(probe) assert.exists(stack) assert.equal(language, 'javascript') diff --git a/packages/dd-trace/test/ci-visibility/dynamic-instrumentation/target-app/test-visibility-dynamic-instrumentation-script.js b/packages/dd-trace/test/ci-visibility/dynamic-instrumentation/target-app/test-visibility-dynamic-instrumentation-script.js index 39382ea0089..88dbf230c1b 100644 --- a/packages/dd-trace/test/ci-visibility/dynamic-instrumentation/target-app/test-visibility-dynamic-instrumentation-script.js +++ b/packages/dd-trace/test/ci-visibility/dynamic-instrumentation/target-app/test-visibility-dynamic-instrumentation-script.js @@ -11,17 +11,15 @@ const intervalId = setInterval(() => {}, 5000) tvDynamicInstrumentation.start(new Config()) tvDynamicInstrumentation.isReady().then(() => { - const [ - snapshotId, - breakpointSetPromise, - breakpointHitPromise - ] = tvDynamicInstrumentation.addLineProbe({ file: path.join(__dirname, 'di-dependency.js'), line: 9 }) - - breakpointHitPromise.then(({ snapshot }) => { - // once the breakpoint is hit, we can grab the snapshot and send it to the parent process - process.send({ snapshot, snapshotId }) - clearInterval(intervalId) - }) + const file = path.join(__dirname, 'di-dependency.js') + const [probeId, breakpointSetPromise] = tvDynamicInstrumentation.addLineProbe( + { file, line: 9 }, + ({ snapshot }) => { + // once the breakpoint is hit, we can grab the snapshot and send it to the parent process + process.send({ snapshot, probeId }) + clearInterval(intervalId) + } + ) // We run the code once the breakpoint is set breakpointSetPromise.then(() => {