From 0bc6bf5d33b8198253954d7f04558270de45c925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 17 Mar 2023 13:53:57 -0400 Subject: chore: add tests for node:async_hooks (#18004) Closes https://github.com/denoland/deno/issues/17878 --------- Co-authored-by: crowlkats --- ext/node/polyfills/async_hooks.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ext/node') diff --git a/ext/node/polyfills/async_hooks.ts b/ext/node/polyfills/async_hooks.ts index 899e578cc..8111af73b 100644 --- a/ext/node/polyfills/async_hooks.ts +++ b/ext/node/polyfills/async_hooks.ts @@ -84,7 +84,7 @@ class AsyncContextFrame { const propagate = (parent: AsyncContextFrame) => { parent.storage = parent.storage.filter((entry) => !entry.key.isDead()); - parent.storage.forEach((entry) => this.storage.push(entry)); + parent.storage.forEach((entry) => this.storage.push(entry.clone())); if (maybeStorageEntry) { const existingEntry = this.storage.find((entry) => @@ -250,6 +250,10 @@ class StorageEntry { this.key = key; this.value = value; } + + clone() { + return new StorageEntry(this.key, this.value); + } } class StorageKey { -- cgit v1.2.3