Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: don't throw on no testDir (#11950)
Pavel Feldman8dff2e35c867
diff --git a/packages/playwright-test/src/runner.ts b/packages/playwright-test/src/runner.tsindex 8d7a6ef99a..f1bab7a8d2 100644--- a/packages/playwright-test/src/runner.ts+++ b/packages/playwright-test/src/runner.ts@@ -218,11 +218,6 @@ export class Runner {const files = new Map<ProjectImpl, string[]>();for (const project of projects) {- const testDir = project.config.testDir;- if (!fs.existsSync(testDir))- throw new Error(`${testDir} does not exist`);- if (!fs.statSync(testDir).isDirectory())- throw new Error(`${testDir} is not a directory`);const allFiles = await collectFiles(project.config.testDir);const testMatch = createFileMatcher(project.config.testMatch);const testIgnore = createFileMatcher(project.config.testIgnore);@@ -500,6 +495,11 @@ function filterSuite(suite: Suite, suiteFilter: (suites: Suite) => boolean, test}async function collectFiles(testDir: string): Promise<string[]> {+ if (!fs.existsSync(testDir))+ return [];+ if (!fs.statSync(testDir).isDirectory())+ return [];+type Rule = {dir: string;negate: boolean;diff --git a/tests/playwright-test/exit-code.spec.ts b/tests/playwright-test/exit-code.spec.tsindex 7c7577e26e..eac2c8a963 100644--- a/tests/playwright-test/exit-code.spec.ts+++ b/tests/playwright-test/exit-code.spec.ts@@ -141,7 +141,7 @@ test('should exit with code 1 if the specified folder does not exist', async ({`,});expect(result.exitCode).toBe(1);- expect(result.output).toContain(`111111111111.js does not exist`);+ expect(result.output).toContain(`no tests found.`);});test('should exit with code 1 if passed a file name', async ({ runInlineTest }) => {@@ -153,7 +153,7 @@ test('should exit with code 1 if passed a file name', async ({ runInlineTest })`,});expect(result.exitCode).toBe(1);- expect(result.output).toContain(`test.spec.js is not a directory`);+ expect(result.output).toContain(`no tests found.`);});test('should exit with code 1 when config is not found', async ({ runInlineTest }) => {