move only changed check up

This commit is contained in:
Simon Knott 2024-08-26 09:56:27 +02:00
parent 4fb58c85d3
commit 74f095904b
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -157,6 +157,9 @@ async function runTests(args: string[], opts: { [key: string]: any }) {
await startProfiling(); await startProfiling();
const cliOverrides = overridesFromOptions(opts); const cliOverrides = overridesFromOptions(opts);
if (process.env.PWTEST_WATCH && opts.onlyChanged)
throw new Error(`--only-changed is not supported in watch mode. If you'd like that to change, file an issue and let us know about your usecase for it.`);
if (opts.ui || opts.uiHost || opts.uiPort) { if (opts.ui || opts.uiHost || opts.uiPort) {
if (opts.onlyChanged) if (opts.onlyChanged)
throw new Error(`--only-changed is not supported in UI mode. If you'd like that to change, see https://github.com/microsoft/playwright/issues/15075 for more details.`); throw new Error(`--only-changed is not supported in UI mode. If you'd like that to change, see https://github.com/microsoft/playwright/issues/15075 for more details.`);
@ -203,13 +206,10 @@ async function runTests(args: string[], opts: { [key: string]: any }) {
const runner = new Runner(config); const runner = new Runner(config);
let status: FullResult['status']; let status: FullResult['status'];
if (process.env.PWTEST_WATCH) { if (process.env.PWTEST_WATCH)
if (opts.onlyChanged)
throw new Error(`--only-changed is not supported in watch mode. If you'd like that to change, file an issue and let us know about your usecase for it.`);
status = await runner.watchAllTests(); status = await runner.watchAllTests();
} else { else
status = await runner.runAllTests(); status = await runner.runAllTests();
}
await stopProfiling('runner'); await stopProfiling('runner');
const exitCode = status === 'interrupted' ? 130 : (status === 'passed' ? 0 : 1); const exitCode = status === 'interrupted' ? 130 : (status === 'passed' ? 0 : 1);
gracefullyProcessExitDoNotHang(exitCode); gracefullyProcessExitDoNotHang(exitCode);