cli: more resilient project filtering for repo test

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-10-27 09:09:46 +01:00
parent 6819f8cef2
commit 2a1e9c869e
+4 -4
View File
@@ -198,20 +198,20 @@ export async function command(opts: OptionValues, cmd: Command): Promise<void> {
testGlobal.__backstageCli_watchProjectFilter = {
async filter(projectConfigs) {
const selectedProjects = [];
const usedArgs = new Set(parsedArgs);
const usedArgs = new Set();
for (const project of projectConfigs) {
for (const arg of usedArgs) {
for (const arg of parsedArgs) {
if (isChildPath(project.rootDir, String(arg))) {
selectedProjects.push(project);
usedArgs.delete(arg);
usedArgs.add(arg);
}
}
}
// If we didn't end up using all args in the filtering we need to bail
// and let Jest do the full filtering instead.
if (usedArgs.size > 0) {
if (usedArgs.size !== parsedArgs.length) {
return projectConfigs;
}