From 40c3ae6cfe6758ea35de731c56f1d685315d97b8 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sat, 12 Oct 2024 18:50:34 +0200 Subject: [PATCH] cli: no longer notify test cache hit when not included in since Signed-off-by: Patrik Oldsberg --- packages/cli/src/commands/repo/test.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/commands/repo/test.ts b/packages/cli/src/commands/repo/test.ts index c2a31c1129..87f8e004b0 100644 --- a/packages/cli/src/commands/repo/test.ts +++ b/packages/cli/src/commands/repo/test.ts @@ -221,6 +221,7 @@ export async function command(opts: OptionValues, cmd: Command): Promise { return packageGraph; } + let selectedProjects: string[] | undefined = undefined; if (opts.since && !hasFlags('--selectProjects')) { const graph = await getPackageGraph(); const changedPackages = await graph.listChangedPackages({ @@ -228,19 +229,20 @@ export async function command(opts: OptionValues, cmd: Command): Promise { analyzeLockfile: true, }); - const packageNames = Array.from( + selectedProjects = Array.from( graph.collectPackageNames( changedPackages.map(pkg => pkg.name), pkg => pkg.allLocalDependents.keys(), ), ); - if (packageNames.length === 0) { + if (selectedProjects.length === 0) { console.log(`No packages changed since ${opts.since}`); return; } - args.push('--selectProjects', ...packageNames); + selectedProjects = selectedProjects.filter(pkg => pkg.includes('app')); + args.push('--selectProjects', ...selectedProjects); } // This is the only thing that is not implemented by jest.run(), so we do it here instead @@ -350,7 +352,9 @@ export async function command(opts: OptionValues, cmd: Command): Promise { projectHashes.set(packageName, sha); if (cache?.includes(sha)) { - console.log(`Skipped ${packageName} due to cache hit`); + if (!selectedProjects || selectedProjects.includes(packageName)) { + console.log(`Skipped ${packageName} due to cache hit`); + } outputSuccessCache.push(sha); return undefined; }