deno/tests/specs/test/hooks/mixed_errors.out
Bartek Iwańczuk 9fac6ccb8b
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
feat(test): Add setup and teardown APIs to Deno.test API (#30504)
This commit adds `Deno.test.beforeAll`, `Deno.test.beforeEach`,
`Deno.test.afterAll` and `Deno.test.afterEach` APIs. 

These APIs can be used to perform setup and teardown for test cases. 

The API is similar to the Vitest API: https://vitest.dev/api/#setup-and-teardown, 
with the main difference being that that `before*` hooks don't return a cleanup
function.
2025-09-02 16:27:04 +02:00

55 lines
1.6 KiB
Text

Check [WILDCARD]mixed_errors.ts
running 5 tests from ./mixed_errors.ts
test 1 - should pass ... ok ([WILDCARD])
test 2 - should pass ... ok ([WILDCARD])
test 3 - beforeEach fails ... FAILED ([WILDCARD])
test 4 - afterEach fails ... FAILED ([WILDCARD])
test 5 - test itself fails ... FAILED ([WILDCARD])
------- post-test output -------
[
"beforeEach executed for test 1",
"test 1 executed",
"afterEach executed for test 1",
"beforeEach executed for test 2",
"test 2 executed",
"afterEach executed for test 2",
"beforeEach executed for test 3",
"afterEach executed for test 3",
"beforeEach executed for test 4",
"test 4 executed",
"afterEach executed for test 4",
"beforeEach executed for test 5",
"test 5 executed",
"afterEach executed for test 5"
]
----- post-test output end -----
ERRORS
test 3 - beforeEach fails => ./mixed_errors.ts:29:6
error: Error: beforeEach failed for test 3
throw new Error("beforeEach failed for test 3");
^
at [WILDCARD]mixed_errors.ts:9:11
test 4 - afterEach fails => ./mixed_errors.ts:33:6
error: Error: afterEach failed for test 4
throw new Error("afterEach failed for test 4");
^
at [WILDCARD]mixed_errors.ts:17:11
test 5 - test itself fails => ./mixed_errors.ts:37:6
error: Error: test 5 failed
throw new Error("test 5 failed");
^
at [WILDCARD]mixed_errors.ts:39:9
FAILURES
test 3 - beforeEach fails => ./mixed_errors.ts:29:6
test 4 - afterEach fails => ./mixed_errors.ts:33:6
test 5 - test itself fails => ./mixed_errors.ts:37:6
FAILED | 2 passed | 3 failed ([WILDCARD])
error: Test failed