From de7a5ce89e4513456889beebb772b92d930de753 Mon Sep 17 00:00:00 2001 From: rochdev Date: Mon, 24 Jun 2024 11:08:54 -0400 Subject: [PATCH] fix new test --- .../datadog-plugin-express/test/index.spec.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/datadog-plugin-express/test/index.spec.js b/packages/datadog-plugin-express/test/index.spec.js index e7f8b0d4b45..55a608f4adf 100644 --- a/packages/datadog-plugin-express/test/index.spec.js +++ b/packages/datadog-plugin-express/test/index.spec.js @@ -1279,7 +1279,9 @@ describe('Plugin', () => { res.status(200).send('hi') }) - getPort().then(port => { + appListener = app.listen(0, 'localhost', () => { + const port = appListener.address().port + agent.use(traces => { const spans = sort(traces[0]) @@ -1292,13 +1294,11 @@ describe('Plugin', () => { done() }) - appListener = app.listen(port, 'localhost', () => { - axios - .get(`http://localhost:${port}/does-not-exist`, { - validateStatus: status => status === 404 - }) - .catch(done) - }) + axios + .get(`http://localhost:${port}/does-not-exist`, { + validateStatus: status => status === 404 + }) + .catch(done) }) })