summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/unit/timers_test.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/cli/tests/unit/timers_test.ts b/cli/tests/unit/timers_test.ts
index e6901a42c..735e53e0f 100644
--- a/cli/tests/unit/timers_test.ts
+++ b/cli/tests/unit/timers_test.ts
@@ -84,6 +84,27 @@ Deno.test(async function timeoutEvalNoScopeLeak() {
Reflect.deleteProperty(global, "globalPromise");
});
+Deno.test(async function evalPrimordial() {
+ const global = globalThis as unknown as {
+ globalPromise: ReturnType<typeof deferred>;
+ };
+ global.globalPromise = deferred();
+ const originalEval = globalThis.eval;
+ let wasCalled = false;
+ globalThis.eval = (argument) => {
+ wasCalled = true;
+ return originalEval(argument);
+ };
+ setTimeout(
+ "globalThis.globalPromise.resolve();" as unknown as () => void,
+ 0,
+ );
+ await global.globalPromise;
+ assert(!wasCalled);
+ Reflect.deleteProperty(global, "globalPromise");
+ globalThis.eval = originalEval;
+});
+
Deno.test(async function timeoutArgs() {
const promise = deferred();
const arg = 1;