Skip to content

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

fix(esm): silence warning when running with experimental loader (#17493)

Dmitry Gozmanda7feb9cc6fe
diff --git a/packages/playwright-test/src/cli.ts b/packages/playwright-test/src/cli.ts
index b42f3b074f..dd59b687d1 100644
--- a/packages/playwright-test/src/cli.ts
+++ b/packages/playwright-test/src/cli.ts
@@ -315,7 +315,7 @@ function restartWithExperimentalTsEsm(configFile: string | null): boolean {
}
export function experimentalLoaderOption() {
- return ` --experimental-loader=${url.pathToFileURL(require.resolve('@playwright/test/lib/experimentalLoader')).toString()}`;
+ return ` --no-warnings --experimental-loader=${url.pathToFileURL(require.resolve('@playwright/test/lib/experimentalLoader')).toString()}`;
}
export function envWithoutExperimentalLoaderOptions(): NodeJS.ProcessEnv {
diff --git a/tests/playwright-test/loader.spec.ts b/tests/playwright-test/loader.spec.ts
index 35a61ec228..60934df71a 100644
--- a/tests/playwright-test/loader.spec.ts
+++ b/tests/playwright-test/loader.spec.ts
@@ -245,6 +245,7 @@ test('should load ts from esm when package.json has type module', async ({ runIn
expect(result.exitCode).toBe(0);
expect(result.passed).toBe(1);
+ expect(result.output).not.toContain(`is an experimental feature`);
});
test('should filter stack trace for simple expect', async ({ runInlineTest }) => {