From 70434b5bfba701f9de2221b64ee40262c5370ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 15 Mar 2020 17:58:59 +0100 Subject: 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 --- cli/js/tests/test_util.ts | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'cli/js/tests/test_util.ts') 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 { 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 { + async testStart(msg: Deno.TestEventTestStart): Promise { + await this.write(msg); + } + + async testEnd(msg: Deno.TestEventTestEnd): Promise { // eslint-disable-next-line @typescript-eslint/no-explicit-any const serializedMsg: any = { ...msg }; -- cgit v1.2.3