mirror of
https://github.com/denoland/deno.git
synced 2025-09-30 22:21:15 +00:00
clean up code in cli/js (#6611)
This commit is contained in:
parent
ab4c574f52
commit
158ae0bfe9
89 changed files with 395 additions and 354 deletions
|
@ -1,4 +1,5 @@
|
|||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
import { gray, green, italic, red, yellow } from "./colors.ts";
|
||||
import { exit } from "./ops/os.ts";
|
||||
import { Console, stringifyArgs } from "./web/console.ts";
|
||||
|
@ -11,9 +12,9 @@ import { assert } from "./util.ts";
|
|||
|
||||
const disabledConsole = new Console((): void => {});
|
||||
|
||||
function delay(n: number): Promise<void> {
|
||||
return new Promise((resolve: () => void, _) => {
|
||||
setTimeout(resolve, n);
|
||||
function delay(ms: number): Promise<void> {
|
||||
return new Promise((resolve: () => void) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -241,7 +242,7 @@ class TestRunner {
|
|||
passed: 0,
|
||||
failed: 0,
|
||||
};
|
||||
private usedOnly: boolean;
|
||||
readonly #usedOnly: boolean;
|
||||
|
||||
constructor(
|
||||
tests: TestDefinition[],
|
||||
|
@ -249,8 +250,8 @@ class TestRunner {
|
|||
public failFast: boolean
|
||||
) {
|
||||
const onlyTests = tests.filter(({ only }) => only);
|
||||
this.usedOnly = onlyTests.length > 0;
|
||||
const unfilteredTests = this.usedOnly ? onlyTests : tests;
|
||||
this.#usedOnly = onlyTests.length > 0;
|
||||
const unfilteredTests = this.#usedOnly ? onlyTests : tests;
|
||||
this.testsToRun = unfilteredTests.filter(filterFn);
|
||||
this.stats.filtered = unfilteredTests.length - this.testsToRun.length;
|
||||
}
|
||||
|
@ -292,7 +293,7 @@ class TestRunner {
|
|||
const duration = +new Date() - suiteStart;
|
||||
|
||||
yield {
|
||||
end: { ...this.stats, usedOnly: this.usedOnly, duration, results },
|
||||
end: { ...this.stats, usedOnly: this.#usedOnly, duration, results },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue