Skip to content

Commit

Permalink
chore: making test determanistic
Browse files Browse the repository at this point in the history
  • Loading branch information
HelmerBarcos committed Jan 20, 2024
1 parent 5dcb5f5 commit 2d0af87
Showing 1 changed file with 21 additions and 24 deletions.
45 changes: 21 additions & 24 deletions test/integration/cli/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -556,40 +556,37 @@ describe('CLI Usage', () => {
}
})

const testAllIPsAndPorts = async (someIp) => {
const testIps = [
test("NODE_OPTIONS='--inspect=<host>:<port>'", 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()
Expand Down

0 comments on commit 2d0af87

Please sign in to comment.