Skip to content

Commit 86fa21c

Browse files
committed
Implement a finish method for the status_bar and some cleanup
1 parent c17628b commit 86fa21c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/tools/rustdoc-gui/tester.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// ```
66
const fs = require("fs");
77
const path = require("path");
8+
const os = require('os');
89
const {Options, runTest} = require('browser-ui-test');
910

1011
function showHelp() {
@@ -78,19 +79,23 @@ function char_printer(n_tests) {
7879
successful: function() {
7980
current += 1;
8081
if (current % max_per_line === 0) {
81-
process.stdout.write(`. (${current}/${n_tests})\n`);
82+
process.stdout.write(`. (${current}/${n_tests})${os.EOL}`);
8283
} else {
8384
process.stdout.write(".");
8485
}
8586
},
8687
erroneous: function() {
8788
current += 1;
8889
if (current % max_per_line === 0) {
89-
process.stderr.write(`F (${current}/${n_tests})\n`);
90+
process.stderr.write(`F (${current}/${n_tests})${os.EOL}`);
9091
} else {
9192
process.stderr.write("F");
9293
}
9394
},
95+
finish: function() {
96+
const spaces = " ".repeat(max_per_line - (current % max_per_line));
97+
process.stdout.write(`${spaces} (${current}/${n_tests})${os.EOL}${os.EOL}`);
98+
},
9499
};
95100
}
96101

@@ -187,9 +192,10 @@ async function main(argv) {
187192
await tests[i];
188193
}
189194
}
190-
await Promise.all(tests);
191-
// final \n after the tests
192-
console.log("\n");
195+
if (!no_headless) {
196+
await Promise.all(tests);
197+
}
198+
status_bar.finish();
193199

194200
if (debug === false) {
195201
results.successful.sort(by_filename);

0 commit comments

Comments
 (0)