From 2f5b3434746ecca684ac89310b01c114a4a6921a Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sat, 2 Jul 2022 03:29:11 +0300 Subject: [PATCH] speed up -m option CLI tests --- test/cli.spec.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/test/cli.spec.ts b/test/cli.spec.ts index 89562cf..d4642db 100644 --- a/test/cli.spec.ts +++ b/test/cli.spec.ts @@ -36,11 +36,12 @@ describe("CLI Options", function () { before(async () => { const gOpts = grantOptionsTM.map((g) => `-g "${g}"`).join(" "); + const mOpts = allMatches.map((m) => `-m "${m}"`).join(" "); const runs = await Promise.all([ aexec(`${cliPfx} tampermonkey -p ${pkg} -d --du ${requires[1]} -u ${requires[1]} -n testing -h ${requires[1]} --nf --ch "name1 value1" --ch name2`), aexec(`${cliPfx} violentmonkey -i "content" -p ${pkg} -o ${output} -d`), - aexec(`${cliPfx} tampermonkey -i "page" -p ${pkg} -o ${output} -d ${gOpts}`), + aexec(`${cliPfx} tampermonkey -i "page" -p ${pkg} -o ${output} -d ${gOpts} ${mOpts}`), aexec(`${cliPfx} tampermonkey -p ${pkg} -o ${output} -d`), aexec(`${cliPfx} violentmonkey -p ${pkg} -o ${output} -d -g all`), aexec(`${cliPfx} tampermonkey -m all -c -d`), @@ -135,12 +136,7 @@ describe("CLI Options", function () { }); it("-m options should correctly add @matches", async () => { - const mOpts = allMatches.map((m) => `-m "${m}"`).join(" "); - - const { stdout } = await aexec( - `${cliPfx} tampermonkey ${mOpts} -p ${pkg} -o ${output} -d` - ); - + const { stdout } = cliRuns[2]; const matched = stdout.match(/@match\s+(.+)/g) || []; expect(matched).length(allMatches.length); });