Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: include config dir in quick list report (#11563)

Pavel Feldman0b99d8391117
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<any> {
+ async listAllTestFiles(config: Config, projectNames: string[] | undefined): Promise<any> {
const filesByProject = await this._collectFiles([], projectNames);
const report: any = {
+ testDir: config.testDir,
projects: []
};
for (const [project, files] of filesByProject) {