From e58a35e5aa2a74eb8b926d0bdcccc6f57a9841fd Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 18 Mar 2020 16:35:23 -0700 Subject: [PATCH] chore: fix net specs when rerunning locally (#22745) --- spec-main/api-net-spec.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec-main/api-net-spec.ts b/spec-main/api-net-spec.ts index 3946befbde6f..ad799b3e9ff6 100644 --- a/spec-main/api-net-spec.ts +++ b/spec-main/api-net-spec.ts @@ -60,8 +60,10 @@ function respondNTimes (fn: http.RequestListener, n: number): Promise { const server = http.createServer((request, response) => { fn(request, response) // don't close if a redirect was returned - n-- - if ((response.statusCode < 300 || response.statusCode >= 399) && n <= 0) { server.close() } + if ((response.statusCode < 300 || response.statusCode >= 399) && n <= 0) { + n-- + server.close() + } }) server.listen(0, '127.0.0.1', () => { resolve(`http://127.0.0.1:${(server.address() as AddressInfo).port}`)