From 653e96714b90e592f02fa29ffd6a9911333620a3 Mon Sep 17 00:00:00 2001 From: Anton Golub Date: Thu, 3 Oct 2024 09:06:21 +0300 Subject: [PATCH] test: kill nc process on end --- test/cli.test.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/cli.test.js b/test/cli.test.js index f1c710252f..53968d6d6b 100644 --- a/test/cli.test.js +++ b/test/cli.test.js @@ -121,16 +121,18 @@ describe('cli', () => { }) test('scripts from https', async () => { - $`cat ${path.resolve('test/fixtures/echo.http')} | nc -l 8080` + const server = $`cat ${path.resolve('test/fixtures/echo.http')} | nc -l 8080` let out = await $`node build/cli.js --verbose http://127.0.0.1:8080/echo.mjs` assert.match(out.stderr, /test/) + await server.kill() }) test('scripts from https not ok', async () => { - $`echo $'HTTP/1.1 500\n\n' | nc -l 8081` + const server = $`echo $'HTTP/1.1 500\n\n' | nc -l 8081` let out = await $`node build/cli.js http://127.0.0.1:8081`.nothrow() assert.match(out.stderr, /Error: Can't get/) + await server.kill() }) test('scripts with no extension', async () => {