diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2024-06-12 22:32:54 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-12 22:32:54 +0530 |
commit | 1d290ccc2a39d355aa0e43e86f5f4ce09a0bd655 (patch) | |
tree | 3d7e22728380f690135d5c3921b2828c0862b59b /tests | |
parent | 85e9a790c9873a042d22eb4cea24d195fd27334f (diff) |
fix(ext/node): fix vm memory usage and context initialization (#23976)
Fixes https://github.com/denoland/deno/issues/22441
Fixes https://github.com/denoland/deno/issues/23913
Fixes https://github.com/denoland/deno/issues/23852
Fixes https://github.com/denoland/deno/issues/23917
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit_node/vm_test.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/unit_node/vm_test.ts b/tests/unit_node/vm_test.ts index 21e56ee94..46e231c6c 100644 --- a/tests/unit_node/vm_test.ts +++ b/tests/unit_node/vm_test.ts @@ -148,3 +148,34 @@ reject().catch(() => {}) script.runInNewContext(); }, }); + +// https://github.com/denoland/deno/issues/22441 +Deno.test({ + name: "vm runInNewContext module loader", + fn() { + const code = "import('node:process')"; + const script = new Script(code); + script.runInNewContext(); + }, +}); + +// https://github.com/denoland/deno/issues/23913 +Deno.test({ + name: "vm memory leak crash", + fn() { + const script = new Script("returnValue = 2+2"); + + for (let i = 0; i < 1000; i++) { + script.runInNewContext({}, { timeout: 10000 }); + } + }, +}); + +// https://github.com/denoland/deno/issues/23852 +Deno.test({ + name: "vm runInThisContext global.foo", + fn() { + const result = runInThisContext(`global.foo = 1`); + assertEquals(result, 1); + }, +}); |