diff --git a/integration-tests/ci-visibility-intake.js b/integration-tests/ci-visibility-intake.js index ea44d198509..f1d7a332f24 100644 --- a/integration-tests/ci-visibility-intake.js +++ b/integration-tests/ci-visibility-intake.js @@ -90,23 +90,14 @@ class FakeCiVisIntake extends FakeAgent { // It can be slowed down with setWaitingTime app.post(['/api/v2/citestcycle', '/evp_proxy/:version/api/v2/citestcycle'], (req, res) => { - if (waitingTime) { - this.waitingTimeoutId = setTimeout(() => { - res.status(200).send('OK') - this.emit('message', { - headers: req.headers, - payload: msgpack.decode(req.body, { codec }), - url: req.url - }) - }, waitingTime) - } else { + this.waitingTimeoutId = setTimeout(() => { res.status(200).send('OK') this.emit('message', { headers: req.headers, payload: msgpack.decode(req.body, { codec }), url: req.url }) - } + }, waitingTime || 0) }) app.post([ diff --git a/packages/datadog-instrumentations/src/jest.js b/packages/datadog-instrumentations/src/jest.js index e9101247fb7..30787ff3398 100644 --- a/packages/datadog-instrumentations/src/jest.js +++ b/packages/datadog-instrumentations/src/jest.js @@ -420,6 +420,7 @@ function cliWrapper (cli, jestVersion) { } let timeoutId + // Pass the resolve callback to defer it to DC listener const flushPromise = new Promise((resolve) => { onDone = () => { clearTimeout(timeoutId)