aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/shadow.test.js
blob: 3fffcac9024c88cfcdbc9f0b869d11ab957a18b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
import { describe, it, expect } from "bun:test";

it("shadow realm works", () => {
  const red = new ShadowRealm();
  globalThis.someValue = 1;
  // Affects only the ShadowRealm's global
  const result = red.evaluate("globalThis.someValue = 2;");
  expect(globalThis.someValue).toBe(1);
  expect(result).toBe(2);
});