summaryrefslogtreecommitdiff
path: root/cli/js/tests/unit_test_runner.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-03-15 17:58:59 +0100
committerGitHub <noreply@github.com>2020-03-15 17:58:59 +0100
commit70434b5bfba701f9de2221b64ee40262c5370ae0 (patch)
tree9aa3753abf6f2e0f98cd16055cf8819153921ac2 /cli/js/tests/unit_test_runner.ts
parent620dd9724d4f8568efebb1642b49c653de9424cd (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/unit_test_runner.ts')
-rwxr-xr-xcli/js/tests/unit_test_runner.ts28
1 files changed, 16 insertions, 12 deletions
diff --git a/cli/js/tests/unit_test_runner.ts b/cli/js/tests/unit_test_runner.ts
index 3fe66408b..fea6aa8da 100755
--- a/cli/js/tests/unit_test_runner.ts
+++ b/cli/js/tests/unit_test_runner.ts
@@ -17,6 +17,7 @@ interface PermissionSetTestResult {
stats: Deno.TestStats;
permsStr: string;
duration: number;
+ results: Deno.TestResult[];
}
const PERMISSIONS: Deno.PermissionName[] = [
@@ -144,16 +145,17 @@ async function runTestsForPermissionSet(
expectedPassedTests = msg.tests;
await reporter.start(msg);
continue;
- }
-
- if (msg.kind === Deno.TestEvent.Result) {
- await reporter.result(msg);
+ } else if (msg.kind === Deno.TestEvent.TestStart) {
+ await reporter.testStart(msg);
continue;
+ } else if (msg.kind === Deno.TestEvent.TestEnd) {
+ await reporter.testEnd(msg);
+ continue;
+ } else {
+ endEvent = msg;
+ await reporter.end(msg);
+ break;
}
-
- endEvent = msg;
- await reporter.end(msg);
- break;
}
} catch (e) {
hasThrown = true;
@@ -183,14 +185,16 @@ async function runTestsForPermissionSet(
workerProcess.close();
- const passed = expectedPassedTests === endEvent.stats.passed;
+ const passed =
+ expectedPassedTests === endEvent.stats.passed + endEvent.stats.ignored;
return {
perms,
passed,
permsStr: permsFmt,
duration: endEvent.duration,
- stats: endEvent.stats
+ stats: endEvent.stats,
+ results: endEvent.results
};
}
@@ -225,13 +229,13 @@ async function masterRunnerMain(
let testsPassed = true;
for (const testResult of testResults) {
- const { permsStr, stats, duration } = testResult;
+ const { permsStr, stats, duration, results } = testResult;
console.log(`Summary for ${permsStr}`);
await consoleReporter.end({
kind: Deno.TestEvent.End,
stats,
duration,
- results: []
+ results
});
testsPassed = testsPassed && testResult.passed;
}