Skip to content

Commit

Permalink
test: kill nc process on end
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Oct 3, 2024
1 parent 00c1023 commit 653e967
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit 653e967

Please sign in to comment.