diff options
author | Marvin Hagemeister <marvin@deno.com> | 2024-05-15 00:42:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-15 00:42:43 +0200 |
commit | e389917535e8e7ef13920a96f9c9c1e1ec2b2c55 (patch) | |
tree | 98b7f7ea7400d7995b4947d6e5bd1bc719f6223b | |
parent | 3b51ea7ba8b7e8a1786e44538bea038f6d146847 (diff) |
fix(node): stub `AsyncResource.emitDestroy()` (#23802)
<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/contributing
1. Give the PR a descriptive title.
Examples of good title:
- fix(std/http): Fix race condition in server
- docs(console): Update docstrings
- feat(doc): Handle nested reexports
Examples of bad title:
- fix #7123
- update docs
- fix bugs
2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->
Fixes https://github.com/denoland/deno/issues/23397
-rw-r--r-- | ext/node/polyfills/async_hooks.ts | 2 | ||||
-rw-r--r-- | tests/unit_node/async_hooks_test.ts | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/ext/node/polyfills/async_hooks.ts b/ext/node/polyfills/async_hooks.ts index e8960c4dc..f94b8d2c6 100644 --- a/ext/node/polyfills/async_hooks.ts +++ b/ext/node/polyfills/async_hooks.ts @@ -207,6 +207,8 @@ export class AsyncResource { } } + emitDestroy() {} + bind(fn: (...args: unknown[]) => unknown, thisArg = this) { validateFunction(fn, "fn"); const frame = AsyncContextFrame.current(); diff --git a/tests/unit_node/async_hooks_test.ts b/tests/unit_node/async_hooks_test.ts index 8d94180cf..46d7dd785 100644 --- a/tests/unit_node/async_hooks_test.ts +++ b/tests/unit_node/async_hooks_test.ts @@ -130,3 +130,8 @@ Deno.test(function asyncResourceStub() { const resource = new AsyncResource("dbquery"); assert(typeof resource.asyncId() === "number"); }); + +Deno.test(function emitDestroyStub() { + const resource = new AsyncResource("foo"); + assert(typeof resource.emitDestroy === "function"); +}); |