From 0b99d83911173cbd20be39dc6e398f59a75f5bb1 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Sat, 22 Jan 2022 17:02:46 -0800 Subject: [PATCH] chore: include config dir in quick list report (#11563) --- packages/playwright-test/src/cli.ts | 9 +++++---- packages/playwright-test/src/runner.ts | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/playwright-test/src/cli.ts b/packages/playwright-test/src/cli.ts index 9818ebca82..b0ea525655 100644 --- a/packages/playwright-test/src/cli.ts +++ b/packages/playwright-test/src/cli.ts @@ -170,10 +170,11 @@ async function runTests(args: string[], opts: { [key: string]: any }) { async function listTests(opts: { [key: string]: any }) { const configFile = opts.config ? path.resolve(process.cwd(), opts.config) : process.cwd(); const runner = new Runner({}, { defaultConfig: {} }); - await runner.loadConfigFromFile(configFile); - const report = await runner.listAllTestFiles(opts.project); - process.stdout.write(JSON.stringify(report)); - process.exit(0); + const config = await runner.loadConfigFromFile(configFile); + const report = await runner.listAllTestFiles(config, opts.project); + process.stdout.write(JSON.stringify(report), () => { + process.exit(0); + }); } function forceRegExp(pattern: string): RegExp { diff --git a/packages/playwright-test/src/runner.ts b/packages/playwright-test/src/runner.ts index db6d63a84b..1ee15e3e57 100644 --- a/packages/playwright-test/src/runner.ts +++ b/packages/playwright-test/src/runner.ts @@ -163,9 +163,10 @@ export class Runner { } } - async listAllTestFiles(projectNames: string[] | undefined): Promise { + async listAllTestFiles(config: Config, projectNames: string[] | undefined): Promise { const filesByProject = await this._collectFiles([], projectNames); const report: any = { + testDir: config.testDir, projects: [] }; for (const [project, files] of filesByProject) {