From da7feb9cc6fed81184e68d400d9f44dc07015e14 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Wed, 21 Sep 2022 10:56:17 -0700 Subject: [PATCH] fix(esm): silence warning when running with experimental loader (#17493) Unfortunately, this silences all warnings, not just the experimental loader warning. --- packages/playwright-test/src/cli.ts | 2 +- tests/playwright-test/loader.spec.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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 }) => {