From 0b6a32269f3e54a3fbce08a351b6577e384ae3b8 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Fri, 19 May 2023 19:36:27 -0700 Subject: ensure unused variable is not eliminated --- test/js/node/vm/vm.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/js/node/vm/vm.test.ts b/test/js/node/vm/vm.test.ts index 6cf187112..1aba597c7 100644 --- a/test/js/node/vm/vm.test.ts +++ b/test/js/node/vm/vm.test.ts @@ -1,6 +1,7 @@ import { describe, test, expect } from "bun:test"; import { createContext, runInContext, runInNewContext, runInThisContext, Script } from "node:vm"; +function capture(_: any, _1?: any) {} describe("runInContext()", () => { testRunInContext(runInContext, { isIsolated: true }); }); @@ -133,6 +134,7 @@ function testRunInContext( }); test("cannot access local scope", () => { var foo = "bar"; // intentionally unused + capture(foo, foo); const context = createContext({}); const result = fn("typeof foo;", context); expect(result).toBe("undefined"); -- cgit v1.2.3