diff --git a/packages/playwright/src/program.ts b/packages/playwright/src/program.ts index 975a2f894a..4b5bea19d3 100644 --- a/packages/playwright/src/program.ts +++ b/packages/playwright/src/program.ts @@ -197,6 +197,8 @@ async function runTests(args: string[], opts: { [key: string]: any }) { } ); await stopProfiling('runner'); + if (status === 'restarted') + return; const exitCode = status === 'interrupted' ? 130 : (status === 'passed' ? 0 : 1); gracefullyProcessExitDoNotHang(exitCode); return; diff --git a/packages/playwright/src/runner/watchMode.ts b/packages/playwright/src/runner/watchMode.ts index eecfbe5fc2..23edfd8d02 100644 --- a/packages/playwright/src/runner/watchMode.ts +++ b/packages/playwright/src/runner/watchMode.ts @@ -27,6 +27,7 @@ import { TestServerDispatcher } from './testServer'; import { EventEmitter } from 'stream'; import { type TestServerTransport, TestServerConnection } from '../isomorphic/testServerConnection'; import { TeleSuiteUpdater } from '../isomorphic/teleSuiteUpdater'; +import { restartWithExperimentalTsEsm } from '../common/configLoader'; class InMemoryTransport extends EventEmitter implements TestServerTransport { public readonly _send: (data: string) => void; @@ -67,7 +68,10 @@ interface WatchModeOptions { grep?: string; } -export async function runWatchModeLoop(configLocation: ConfigLocation, initialOptions: WatchModeOptions): Promise { +export async function runWatchModeLoop(configLocation: ConfigLocation, initialOptions: WatchModeOptions): Promise { + if (restartWithExperimentalTsEsm(undefined, true)) + return 'restarted'; + const options: WatchModeOptions = { ...initialOptions }; const testServerDispatcher = new TestServerDispatcher(configLocation);