Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to gulp makeref/browsertest to only run tests with specific ids #18833

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,13 @@ function runTests(testsName, { bot = false, xfaOnly = false } = {}) {
args.push("--xfaOnly");
}
args.push("--manifestFile=" + PDF_TEST);
collectArgs(
{
names: ["-t", "--testfilter"],
hasValue: true,
},
args
);
break;
case "unit":
args.push("--unitTest");
Expand Down Expand Up @@ -724,6 +731,28 @@ function runTests(testsName, { bot = false, xfaOnly = false } = {}) {
});
}

function collectArgs(options, args) {
if (!Array.isArray(options)) {
options = [options];
}
for (let i = 0, ii = process.argv.length; i < ii; i++) {
const arg = process.argv[i];
const option = options.find(opt => opt.names.includes(arg));
if (!option) {
continue;
}
if (!option.hasValue) {
args.push(arg);
continue;
}
const next = process.argv[i + 1];
if (next && !next.startsWith("-")) {
args.push(arg, next);
i += 1;
}
}
}

function makeRef(done, bot) {
console.log();
console.log("### Creating reference images");
Expand All @@ -748,6 +777,13 @@ function makeRef(done, bot) {
if (process.argv.includes("--headless")) {
args.push("--headless");
}
collectArgs(
{
names: ["-t", "--testfilter"],
hasValue: true,
},
args
);

const testProcess = startNode(args, { cwd: TEST_DIR, stdio: "inherit" });
testProcess.on("close", function (code) {
Expand Down