1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
denoland-deno/cli/tests/testdata/test/steps/output_within.ts
Bartek Iwańczuk 244926e83c
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>
2022-04-15 14:24:41 +02:00

15 lines
360 B
TypeScript

Deno.test("description", async (t) => {
// the output is not great, but this is an extreme scenario
console.log(1);
await t.step("step 1", async (t) => {
console.log(2);
await t.step("inner 1", () => {
console.log(3);
});
await t.step("inner 2", () => {
console.log(4);
});
console.log(5);
});
console.log(6);
});