Skip to content

Commit

Permalink
speed up -g option CLI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Oaphi committed Jul 2, 2022
1 parent e0d9834 commit fe4daf4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions test/cli.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ describe("CLI Options", function () {
const cliRuns: { stdout: string; stderr: string; }[] = [];

before(async () => {
const gOpts = grantOptionsTM.map((g) => `-g "${g}"`).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`),
aexec(`${cliPfx} tampermonkey -i "page" -p ${pkg} -o ${output} -d ${gOpts}`),
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 @@ -101,11 +103,7 @@ describe("CLI Options", function () {
});

it("-g options should correctly add @grant", async () => {
const gOpts = grantOptionsTM.map((g) => `-g "${g}"`).join(" ");

const { stdout } = await aexec(
`${cliPfx} tampermonkey ${gOpts} -p ${pkg} -o ${output} -d`
);
const { stdout } = cliRuns[2];

const matched = stdout.match(/@grant\s+(.+)/g) || [];
expect(matched).length(grantOptionsTM.length);
Expand Down

0 comments on commit fe4daf4

Please # to comment.