feat(watch): hide show-report prompt (#32666)

Closes https://github.com/microsoft/playwright/issues/32665
This commit is contained in:
Simon Knott 2024-09-18 08:17:13 +02:00 committed by GitHub
parent 355c88f48f
commit 443f72dcbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 1 deletions

View file

@ -143,7 +143,7 @@ class HtmlReporter implements ReporterV2 {
const shouldOpen = !this._options._isTestServer && (this._open === 'always' || (!ok && this._open === 'on-failure'));
if (shouldOpen) {
await showHTMLReport(this._outputFolder, this._host, this._port, singleTestId);
} else if (this._options._mode === 'test') {
} else if (this._options._mode === 'test' && !this._options._isTestServer) {
const packageManagerCommand = getPackageManagerExecCommand();
const relativeReportPath = this._outputFolder === standaloneDefaultFolder() ? '' : ' ' + path.relative(process.cwd(), this._outputFolder);
const hostArg = this._host ? ` --host ${this._host}` : '';

View file

@ -215,6 +215,24 @@ test('should run tests on Enter', async ({ runWatchTest }) => {
await testProcess.waitForOutput('Waiting for file changes.');
});
test('should not print show-report command of HTML reporter', async ({ runWatchTest }) => {
const testProcess = await runWatchTest({
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('passes', () => {});
`,
'playwright.config.ts': `
import { defineConfig } from '@playwright/test';
export default defineConfig({ reporter: 'html' });
`,
});
await testProcess.waitForOutput('Waiting for file changes.');
testProcess.clearOutput();
testProcess.write('\r\n');
await testProcess.waitForOutput('Waiting for file changes.');
expect(testProcess.output).not.toContain('To open last HTML report run:');
});
test('should run tests on R', async ({ runWatchTest }) => {
const testProcess = await runWatchTest({
'a.test.ts': `