diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-04-15 14:24:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-15 14:24:41 +0200 |
commit | 244926e83c7d3cae3c3ae3fc14e996e3066da43e (patch) | |
tree | 9390a5d059aa08ff003439665579bef3af626fb3 /runtime/js | |
parent | 0e4574b2e3acb6594142021f2b3e30ad532f15ef (diff) |
feat(test): format user code output (#14271)
This commit changes "deno test" to better denote user output coming
from test cases.
This is done by printing "---- output ----" and "---- output end ----"
markers if an output is produced. The output from "console" and
"Deno.core.print" is captured, as well as direct writes to "Deno.stdout"
and "Deno.stderr".
To achieve that new APIs were added to "deno_core" crate, that allow
to replace an existing resource with a different one (while keeping resource
ids intact). Resources for stdout and stderr are replaced by pipes.
Co-authored-by: David Sherret <dsherret@gmail.com>
Diffstat (limited to 'runtime/js')
-rw-r--r-- | runtime/js/40_testing.js | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/runtime/js/40_testing.js b/runtime/js/40_testing.js index c4321c748..fdd044503 100644 --- a/runtime/js/40_testing.js +++ b/runtime/js/40_testing.js @@ -871,12 +871,6 @@ }); } - function reportTestConsoleOutput(console) { - core.opSync("op_dispatch_test_event", { - output: { console }, - }); - } - function reportTestWait(test) { core.opSync("op_dispatch_test_event", { wait: test, @@ -955,9 +949,6 @@ core.setMacrotaskCallback(handleOpSanitizerDelayMacrotask); const origin = getTestOrigin(); - const originalConsole = globalThis.console; - - globalThis.console = new Console(reportTestConsoleOutput); const only = ArrayPrototypeFilter(tests, (test) => test.only); const filtered = ArrayPrototypeFilter( @@ -1004,8 +995,6 @@ reportTestResult(description, result, elapsed); } - - globalThis.console = originalConsole; } async function runBenchmarks({ |