diff --git a/test/parallel/test-perf-hooks-histogram.js b/test/parallel/test-perf-hooks-histogram.js index 2137c1b2a3bb11..1bcc59653bb692 100644 --- a/test/parallel/test-perf-hooks-histogram.js +++ b/test/parallel/test-perf-hooks-histogram.js @@ -89,7 +89,12 @@ const { inspect } = require('util'); strictEqual(data.enable, undefined); mc.port1.close(); }); - setTimeout(() => mc.port2.postMessage(e), 100); + const interval = setInterval(() => { + if (e.count > 0) { + clearInterval(interval); + mc.port2.postMessage(e); + } + }, 50); } {