error message has changed

This commit is contained in:
Paul Fitzpatrick 2024-10-09 23:59:26 -04:00
parent 0c5efbf756
commit ded37729d5
No known key found for this signature in database
GPG Key ID: 07F16BF3214888F6
2 changed files with 8 additions and 5 deletions

View File

@ -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))/,
]);
});
});

View File

@ -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();