deno
21fb99ec - fix(ext/node): handle unhandled rejections in node:test without crashing runner (#33749)

Commit
60 days ago
fix(ext/node): handle unhandled rejections in node:test without crashing runner (#33749) Fixes several issues in the `node:test` module that caused the test runner to crash or tests to hang: - Install global `unhandledrejection` and `error` event handlers that prevent unhandled rejections and uncaught exceptions from being fatal during `node:test` execution, matching Node.js behavior where these cause test warnings rather than runner crashes - Fix async+callback test hangs: when a callback-style test function (`fn.length >= 2`) also returns a thenable, listen for its rejection via `PromisePrototypeThen` to prevent indefinite hanging - Fix `this` binding in test functions via `ReflectApply` so `this === t` inside test callbacks - Sanitize thrown non-Error objects with custom inspect symbols that throw, preventing Deno's error formatting from crashing - Fix truthy `skip`/`todo` options (e.g. `{ skip: "reason" }`) to properly mark tests as ignored via `!!` coercion Test results improve from **17 passed / 49 failed / 4 ignored** → **42 passed / 18 failed / 7 ignored** in the `node_test_module` spec test, with no more cancellation cascade from the first unhandled rejection.
Author
Parents
Loading