From ea7621fb1191c85951ed0ad39453541de11bb394 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Fri, 13 Sep 2024 14:24:24 +0200 Subject: [PATCH] [DI] Simplify integration test by not using async/await --- integration-tests/debugger/index.spec.js | 27 +++++++++++------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/integration-tests/debugger/index.spec.js b/integration-tests/debugger/index.spec.js index 4c3f84d8112..241f57f722f 100644 --- a/integration-tests/debugger/index.spec.js +++ b/integration-tests/debugger/index.spec.js @@ -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) } })