diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-03-15 17:58:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-15 17:58:59 +0100 |
commit | 70434b5bfba701f9de2221b64ee40262c5370ae0 (patch) | |
tree | 9aa3753abf6f2e0f98cd16055cf8819153921ac2 /cli/js/tests/test_util.ts | |
parent | 620dd9724d4f8568efebb1642b49c653de9424cd (diff) |
refactor: change test reporter output (#4371)
This commit changes output of default test reporter to resemble output from Rust test runner;
first the name of running test is printed with "...", then after test has run result is printed on the same line.
* Split "Deno.TestEvent.Result" into "TestStart" and "TestEnd";
* changes TestReporter interface to support both events;
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Diffstat (limited to 'cli/js/tests/test_util.ts')
-rw-r--r-- | cli/js/tests/test_util.ts | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/cli/js/tests/test_util.ts b/cli/js/tests/test_util.ts index a904b9412..78147f28c 100644 --- a/cli/js/tests/test_util.ts +++ b/cli/js/tests/test_util.ts @@ -92,10 +92,6 @@ export async function registerUnitTests(): Promise<void> { const processPerms = await getProcessPermissions(); for (const unitTestDefinition of REGISTERED_UNIT_TESTS) { - if (unitTestDefinition.skip) { - continue; - } - if (!permissionsMatch(processPerms, unitTestDefinition.perms)) { continue; } @@ -172,10 +168,8 @@ interface UnitTestOptions { perms?: UnitTestPermissions; } -interface UnitTestDefinition { - name: string; - fn: Deno.TestFunction; - skip?: boolean; +interface UnitTestDefinition extends Deno.TestDefinition { + skip: boolean; perms: Permissions; } @@ -210,10 +204,6 @@ export function unitTest( assert(name, "Missing test function name"); } - if (options.skip) { - return; - } - const normalizedPerms = normalizeTestPermissions(options.perms || {}); registerPermCombination(normalizedPerms); @@ -262,7 +252,11 @@ export class SocketReporter implements Deno.TestReporter { await this.write(msg); } - async result(msg: Deno.TestEventResult): Promise<void> { + async testStart(msg: Deno.TestEventTestStart): Promise<void> { + await this.write(msg); + } + + async testEnd(msg: Deno.TestEventTestEnd): Promise<void> { // eslint-disable-next-line @typescript-eslint/no-explicit-any const serializedMsg: any = { ...msg }; |