Skip to content

Commit 6622025

Browse files
committed
Improve test session names when running tests for a specific project
Fixes #3713.
1 parent 9f01b18 commit 6622025

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎src/extension/commands/test.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,18 @@ export class TestCommands implements vs.Disposable {
6969
}
7070

7171
const projectsWithTests = (await getAllProjectFolders(this.logger, getExcludedFolders, { requirePubspec: true }))
72-
.map(getItemsToRunInProject)
73-
.filter((tests) => tests.length);
72+
.map((projectFolder) => ({ projectFolder, tests: getItemsToRunInProject(projectFolder) }))
73+
.filter((project) => project.tests.length);
7474
if (projectsWithTests.length === 0) {
7575
vs.window.showErrorMessage("Unable to find any test folders");
7676
return;
7777
}
7878

7979
await Promise.all(projectsWithTests.map((projectWithTests) => {
80-
const template = projectWithTests.length > 1
81-
? { args: projectWithTests.slice(1) }
80+
const template = projectWithTests.tests.length > 1
81+
? { name: path.basename(projectWithTests.projectFolder), args: projectWithTests.tests.slice(1) }
8282
: undefined;
83-
return this.runTests(projectWithTests[0], false, undefined, false, true, template, testRun, undefined);
83+
return this.runTests(projectWithTests.tests[0], false, undefined, false, true, template, testRun, undefined);
8484
}));
8585
}
8686

@@ -108,7 +108,7 @@ export class TestCommands implements vs.Disposable {
108108
shouldRunSkippedTests,
109109
launchTemplate,
110110
),
111-
name: `${path.basename(programPath)} tests`,
111+
name: launchTemplate?.name ?? `${path.basename(programPath)} tests`,
112112
};
113113

114114
// Ensure we have a unique ID for this session so we can track when it completes.

0 commit comments

Comments
 (0)