Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
juan-fernandez committed Jan 10, 2025
1 parent aebda9d commit 923fa0d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down

0 comments on commit 923fa0d

Please sign in to comment.