From 0dd74a93bfcd4c094de4f1305bab5fbace24fff0 Mon Sep 17 00:00:00 2001 From: Val Lorentz Date: Fri, 17 Mar 2023 17:10:19 +0100 Subject: [PATCH 1/2] tests/server: Tear down test fixtures in the order they were setup if for whatever reason before() fails to import the server, it causes after() to fail on the first line, so it doesn't restore stubs; causing other errors to be printed in other tests ("TypeError: Attempted to wrap warn which is already wrapped") --- test/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/server.ts b/test/server.ts index 571a6bcc..ad172b77 100644 --- a/test/server.ts +++ b/test/server.ts @@ -39,10 +39,10 @@ describe("Server", function () { }); after(function (done) { - server.close(done); logInfoStub.restore(); logWarnStub.restore(); checkForUpdatesStub.restore(); + server.close(done); }); // eslint-disable-next-line @typescript-eslint/restrict-template-expressions From edc6f77c647a9f8a03635ecbbf97c5d4fcae4d66 Mon Sep 17 00:00:00 2001 From: Val Lorentz Date: Sat, 18 Mar 2023 07:50:35 +0100 Subject: [PATCH 2/2] add setup --- test/server.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/server.ts b/test/server.ts index ad172b77..de7e921f 100644 --- a/test/server.ts +++ b/test/server.ts @@ -39,6 +39,8 @@ describe("Server", function () { }); after(function (done) { + // Tear down test fixtures in the order they were setup, + // in case setup crashed for any reason logInfoStub.restore(); logWarnStub.restore(); checkForUpdatesStub.restore();