From 2d0af87bbe7572dbb34bcdcb57d9ca53327fac68 Mon Sep 17 00:00:00 2001 From: Helmer Barcos Date: Mon, 23 Oct 2023 18:25:56 +0200 Subject: [PATCH] chore: making test determanistic --- test/integration/cli/test/index.test.js | 45 ++++++++++++------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/test/integration/cli/test/index.test.js b/test/integration/cli/test/index.test.js index a691240c1fb52..e51c6b7a25bd9 100644 --- a/test/integration/cli/test/index.test.js +++ b/test/integration/cli/test/index.test.js @@ -556,40 +556,37 @@ describe('CLI Usage', () => { } }) - const testAllIPsAndPorts = async (someIp) => { - const testIps = [ + test("NODE_OPTIONS='--inspect=:'", async () => { + const hosts = [ '0.0.0.0', '127.0.0.1', 'localhost', '192.168.18.90', 'barcos.co', 'app.barcos.co', + null, ] - for (const someIp of testIps) { + for (const someHost of hosts) { const port = await findPort() - test(`NODE_OPTIONS='--inspect=${someIp}:${port}'`, async () => { - let output = '' - const app = await runNextCommandDev( - [dirBasic, '--port', port], - undefined, - { - onStdout(msg) { - output += stripAnsi(msg) - }, - env: { NODE_OPTIONS: `--inspect=${someIp}:${port}` }, - } - ) - try { - await check(() => output, new RegExp(`on ${someIp}:${port}`)) - await check(() => output, new RegExp(`http://${someIp}:${port}`)) - } finally { - await killApp(app) + let output = '' + const app = await runNextCommandDev( + [dirBasic, '--port', port], + undefined, + { + onStdout(msg) { + output += stripAnsi(msg) + }, + env: { NODE_OPTIONS: `--inspect=${someHost}:${port}` }, } - }) + ) + try { + await check(() => output, new RegExp(`on ${someHost}:${port}`)) + await check(() => output, new RegExp(`http://${someHost}:${port}`)) + } finally { + await killApp(app) + } } - } - - testAllIPsAndPorts() + }) test('-p', async () => { const port = await findPort()