Skip to content

Commit cee58cb

Browse files
committedMay 24, 2022
Allow to pass more arguments to tester.js
1 parent fca1007 commit cee58cb

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed
 

Diff for: ‎src/tools/rustdoc-gui/tester.js

+17-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ function showHelp() {
1919
console.log(" --help : show this message then quit");
2020
console.log(" --tests-folder [PATH] : location of the .GOML tests folder");
2121
console.log(" --jobs [NUMBER] : number of threads to run tests on");
22+
console.log(" --executable-path [PATH] : path of the browser's executable to be used");
2223
}
2324

2425
function isNumeric(s) {
@@ -34,20 +35,25 @@ function parseOptions(args) {
3435
"show_text": false,
3536
"no_headless": false,
3637
"jobs": -1,
38+
"executable_path": null,
39+
"no_sandbox": false,
3740
};
3841
var correspondances = {
3942
"--doc-folder": "doc_folder",
4043
"--tests-folder": "tests_folder",
4144
"--debug": "debug",
4245
"--show-text": "show_text",
4346
"--no-headless": "no_headless",
47+
"--executable-path": "executable_path",
48+
"--no-sandbox": "no_sandbox",
4449
};
4550

4651
for (var i = 0; i < args.length; ++i) {
4752
if (args[i] === "--doc-folder"
4853
|| args[i] === "--tests-folder"
4954
|| args[i] === "--file"
50-
|| args[i] === "--jobs") {
55+
|| args[i] === "--jobs"
56+
|| args[i] === "--executable-path") {
5157
i += 1;
5258
if (i >= args.length) {
5359
console.log("Missing argument after `" + args[i - 1] + "` option.");
@@ -68,6 +74,9 @@ function parseOptions(args) {
6874
} else if (args[i] === "--help") {
6975
showHelp();
7076
process.exit(0);
77+
} else if (args[i] === "--no-sandbox") {
78+
console.log("`--no-sandbox` is being used. Be very careful!");
79+
opts[correspondances[args[i]]] = true;
7180
} else if (correspondances[args[i]]) {
7281
opts[correspondances[args[i]]] = true;
7382
} else {
@@ -147,10 +156,17 @@ async function main(argv) {
147156
if (opts["show_text"]) {
148157
args.push("--show-text");
149158
}
159+
if (opts["no_sandbox"]) {
160+
args.push("--no-sandbox");
161+
}
150162
if (opts["no_headless"]) {
151163
args.push("--no-headless");
152164
headless = false;
153165
}
166+
if (opts["executable_path"] !== null) {
167+
args.push("--executable-path");
168+
args.push(opts["executable_path"]);
169+
}
154170
options.parseArguments(args);
155171
} catch (error) {
156172
console.error(`invalid argument: ${error}`);

0 commit comments

Comments
 (0)