From b3b4825162aca2056a0c6c9a7c96467a8d9557a9 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 7 Oct 2024 17:23:15 +0200 Subject: [PATCH] cli: fix for repo test arg trimming removing too many args Signed-off-by: Patrik Oldsberg --- packages/cli/src/commands/repo/test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/commands/repo/test.ts b/packages/cli/src/commands/repo/test.ts index 72c9f3aada..64ea23a99e 100644 --- a/packages/cli/src/commands/repo/test.ts +++ b/packages/cli/src/commands/repo/test.ts @@ -112,7 +112,7 @@ export function createFlagFinder(args: string[]) { }; } -function removeOptionArg(args: string[], option: string) { +function removeOptionArg(args: string[], option: string, size: number = 2) { let changed = false; do { changed = false; @@ -120,7 +120,7 @@ function removeOptionArg(args: string[], option: string) { const index = args.indexOf(option); if (index >= 0) { changed = true; - args.splice(index, 2); + args.splice(index, size); } const indexEq = args.findIndex(arg => arg.startsWith(`${option}=`)); if (indexEq >= 0) { @@ -243,7 +243,7 @@ export async function command(opts: OptionValues, cmd: Command): Promise { // This code path is enabled by the --successCache flag, which is specific to // the `repo test` command in the Backstage CLI. if (opts.successCache) { - removeOptionArg(args, '--successCache'); + removeOptionArg(args, '--successCache', 1); removeOptionArg(args, '--successCacheDir'); const cacheDir = resolvePath(