Skip to content

Commit

Permalink
speed up -m option CLI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Oaphi committed Jul 2, 2022
1 parent fe4daf4 commit 2f5b343
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions test/cli.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`),
Expand Down Expand Up @@ -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);
});
Expand Down

0 comments on commit 2f5b343

Please # to comment.