1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00
denoland-deno/tests/specs/test/exit_code3/main.out
Luke Edwards 13723f267e
feat: Add Deno.exitCode API (#23609)
This commits adds the ability to set a would-be exit code 
for the Deno process without forcing an immediate exit, 
through the new `Deno.exitCode` API.

- **Implements `Deno.exitCode` getter and setter**: Adds support for
setting
and retrieving a would-be exit code via `Deno.exitCode`.
This allows for asynchronous cleanup before process termination 
without immediately exiting.
- **Ensures type safety**: The setter for `Deno.exitCode` validates that
the provided value is a number, throwing a TypeError if not, to ensure
that
only valid exit codes are set.

Closes to #23605

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-29 23:16:27 +00:00

18 lines
408 B
Text

running 2 tests from ./main.js
Deno.exitCode ... FAILED ([WILDCARD])
success ... ok ([WILDCARD])
ERRORS
Deno.exitCode => ./main.js:1:6
error: Error: Test case finished with exit code set to 42.
at exitSanitizer (ext:cli/40_test.js:113:15)
at async outerWrapped (ext:cli/40_test.js:134:14)
FAILURES
Deno.exitCode => ./main.js:1:6
FAILED | 1 passed | 1 failed ([WILDCARD])
error: Test failed