Skip to content

Commit

Permalink
Rollup merge of #91584 - GuillaumeGomez:improve-rustdoc-gui-tester-co…
Browse files Browse the repository at this point in the history
…de, r=jsha

Improve code for rustdoc-gui tester

Following advice given in #91391.

It nicely improves the code readability. :)

r? `@jsha`
  • Loading branch information
matthiaskrgr authored Dec 15, 2021
2 parents efc49c1 + 4c1e24b commit 6f34c0d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/tools/rustdoc-gui/tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ async function main(argv) {
// Print successful tests too
let debug = false;
// Run tests in sequentially
let no_headless = false;
let headless = true;
const options = new Options();
try {
// This is more convenient that setting fields one by one.
Expand All @@ -150,7 +150,7 @@ async function main(argv) {
}
if (opts["no_headless"]) {
args.push("--no-headless");
no_headless = true;
headless = false;
}
options.parseArguments(args);
} catch (error) {
Expand All @@ -172,7 +172,7 @@ async function main(argv) {
}
files.sort();

if (no_headless) {
if (!headless) {
opts["jobs"] = 1;
console.log("`--no-headless` option is active, disabling concurrency for running tests.");
}
Expand All @@ -181,7 +181,7 @@ async function main(argv) {

if (opts["jobs"] < 1) {
process.setMaxListeners(files.length + 1);
} else if (!no_headless) {
} else if (headless) {
process.setMaxListeners(opts["jobs"] + 1);
}

Expand Down Expand Up @@ -226,7 +226,7 @@ async function main(argv) {
await Promise.race(tests_queue);
}
}
if (!no_headless && tests_queue.length > 0) {
if (tests_queue.length > 0) {
await Promise.all(tests_queue);
}
status_bar.finish();
Expand Down

0 comments on commit 6f34c0d

Please sign in to comment.