diff --git a/test/server/lib/ProxyAgent.ts b/test/server/lib/ProxyAgent.ts index e168ab47..04603824 100644 --- a/test/server/lib/ProxyAgent.ts +++ b/test/server/lib/ProxyAgent.ts @@ -84,15 +84,17 @@ describe("ProxyAgent", function () { it("should report error when proxy fails", async function() { // if the proxy isn't listening, fetches produces error messages. await testProxyServer.dispose(); + // Error message depends a little on node version. const logMessages2 = await captureLog('warn', async () => { - await assert.isRejected(testFetch('/200'), /ECONNREFUSED/); - await assert.isRejected(testFetch('/404'), /ECONNREFUSED/); + await assert.isRejected(testFetch('/200'), /(request.*failed)|(ECONNREFUSED)/); + await assert.isRejected(testFetch('/404'), /(request.*failed)|(ECONNREFUSED)/); }); // We rely on "ProxyAgent error" message to detect issues with the proxy server. + // Error message depends a little on node version. assertMatchArray(logMessages2, [ - /warn: ProxyAgent error.*ECONNREFUSED/, - /warn: ProxyAgent error.*ECONNREFUSED/, + /warn: ProxyAgent error.*((request.*failed)|(ECONNREFUSED))/, + /warn: ProxyAgent error.*((request.*failed)|(ECONNREFUSED))/, ]); }); }); diff --git a/test/server/lib/UnhandledErrors.ts b/test/server/lib/UnhandledErrors.ts index 8aad3fcc..77f700cf 100644 --- a/test/server/lib/UnhandledErrors.ts +++ b/test/server/lib/UnhandledErrors.ts @@ -51,7 +51,8 @@ describe('UnhandledErrors', function() { }, 1000, 100); // We expect the server to be dead now. - await assert.isRejected(fetch(`${server.serverUrl}/status`), /failed.*ECONNREFUSED/); + // Error message depends a little on node version. + await assert.isRejected(fetch(`${server.serverUrl}/status`), /(request.*failed)|(ECONNREFUSED)/); } finally { await server.stop();