Skip to content

Commit

Permalink
[DI] Simplify integration test by not using async/await (#4686)
Browse files Browse the repository at this point in the history
  • Loading branch information
watson authored and juan-fernandez committed Oct 1, 2024
1 parent 3028b57 commit dc38911
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions integration-tests/debugger/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,20 @@ describe('Dynamic Instrumentation', function () {
endIfDone()
})

agent.on('debugger-diagnostics', async ({ payload }) => {
try {
const expected = expectedPayloads.shift()
assertObjectContains(payload, expected)
assertUUID(payload.debugger.diagnostics.runtimeId)

if (payload.debugger.diagnostics.status === 'INSTALLED') {
const response = await axios.get('/foo')
assert.strictEqual(response.status, 200)
assert.deepStrictEqual(response.data, { hello: 'foo' })
}
agent.on('debugger-diagnostics', ({ payload }) => {
const expected = expectedPayloads.shift()
assertObjectContains(payload, expected)
assertUUID(payload.debugger.diagnostics.runtimeId)

if (payload.debugger.diagnostics.status === 'INSTALLED') {
axios.get('/foo')
.then((response) => {
assert.strictEqual(response.status, 200)
assert.deepStrictEqual(response.data, { hello: 'foo' })
})
.catch(done)
} else {
endIfDone()
} catch (err) {
// Nessecary hack: Any errors thrown inside of an async function is invisible to Mocha unless the outer `it`
// callback is also `async` (which we can't do in this case since we rely on the `done` callback).
done(err)
}
})

Expand Down

0 comments on commit dc38911

Please sign in to comment.