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

This commit is contained in:
Pavel Feldman 2022-01-22 17:02:46 -08:00 committed by GitHub
parent f29a673b4c
commit 0b99d83911
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -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 {

View File

@ -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) {