Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: fix test expecations after Node.js 22.9.0 (#32695)

Max Schmitt48030a4effc5
diff --git a/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts b/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts
index 08aaa4f25a..b041ffb829 100644
--- a/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts
+++ b/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts
@@ -346,7 +346,7 @@ function rewriteToLocalhostIfNeeded(host: string): string {
}
export function rewriteOpenSSLErrorIfNeeded(error: Error): Error {
- if (error.message !== 'unsupported')
+ if (error.message !== 'unsupported' && (error as NodeJS.ErrnoException).code !== 'ERR_CRYPTO_UNSUPPORTED_OPERATION')
return error;
return rewriteErrorMessage(error, [
'Unsupported TLS certificate.',
diff --git a/tests/playwright-test/babel.spec.ts b/tests/playwright-test/babel.spec.ts
index 3fb0a1a725..724a2a98ad 100644
--- a/tests/playwright-test/babel.spec.ts
+++ b/tests/playwright-test/babel.spec.ts
@@ -148,5 +148,5 @@ test('should not transform external', async ({ runInlineTest }) => {
`
});
expect(result.exitCode).toBe(1);
- expect(result.output).toContain('Cannot use import statement outside a module');
+ expect(result.output).toMatch(/(Cannot use import statement outside a module|require\(\) of ES Module .* not supported.)/);
});