mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00:00

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
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.
35 lines
923 B
Text
35 lines
923 B
Text
Check [WILDCARD]beforeeach_error.ts
|
|
running 3 tests from ./beforeeach_error.ts
|
|
first test ... ok ([WILDCARD])
|
|
second test ... FAILED ([WILDCARD])
|
|
third test ... ok ([WILDCARD])
|
|
------- post-test output -------
|
|
[
|
|
"beforeEach executed for test 1",
|
|
"beforeEach2 executed for test 1",
|
|
"first test executed",
|
|
"afterEach executed for test 1",
|
|
"beforeEach executed for test 2",
|
|
"afterEach executed for test 2",
|
|
"beforeEach executed for test 3",
|
|
"beforeEach2 executed for test 3",
|
|
"third test executed",
|
|
"afterEach executed for test 3"
|
|
]
|
|
----- post-test output end -----
|
|
|
|
ERRORS
|
|
|
|
second test => ./beforeeach_error.ts:27:6
|
|
error: Error: beforeEach hook failed on second test
|
|
throw new Error("beforeEach hook failed on second test");
|
|
^
|
|
at [WILDCARD]beforeeach_error.ts:10:11
|
|
|
|
FAILURES
|
|
|
|
second test => ./beforeeach_error.ts:27:6
|
|
|
|
FAILED | 2 passed | 1 failed ([WILDCARD])
|
|
|
|
error: Test failed
|