summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/unit/command_test.ts6
-rw-r--r--cli/tests/unit/flash_test.ts6
2 files changed, 8 insertions, 4 deletions
diff --git a/cli/tests/unit/command_test.ts b/cli/tests/unit/command_test.ts
index b9fa8295b..0763a7ac6 100644
--- a/cli/tests/unit/command_test.ts
+++ b/cli/tests/unit/command_test.ts
@@ -851,10 +851,11 @@ Deno.test(
Deno.test(
{ permissions: { read: true, run: true } },
- async function commandWithPromisePrototypeThenOverride() {
+ async function commandWithPrototypePollution() {
const originalThen = Promise.prototype.then;
+ const originalSymbolIterator = Array.prototype[Symbol.iterator];
try {
- Promise.prototype.then = () => {
+ Promise.prototype.then = Array.prototype[Symbol.iterator] = () => {
throw new Error();
};
await new Deno.Command(Deno.execPath(), {
@@ -862,6 +863,7 @@ Deno.test(
}).output();
} finally {
Promise.prototype.then = originalThen;
+ Array.prototype[Symbol.iterator] = originalSymbolIterator;
}
},
);
diff --git a/cli/tests/unit/flash_test.ts b/cli/tests/unit/flash_test.ts
index ebee7a024..d32e0a54f 100644
--- a/cli/tests/unit/flash_test.ts
+++ b/cli/tests/unit/flash_test.ts
@@ -2272,10 +2272,11 @@ Deno.test(
Deno.test(
{ permissions: { net: true } },
- async function serveWithPromisePrototypeThenOverride() {
+ async function serveWithPrototypePollution() {
const originalThen = Promise.prototype.then;
+ const originalSymbolIterator = Array.prototype[Symbol.iterator];
try {
- Promise.prototype.then = () => {
+ Promise.prototype.then = Array.prototype[Symbol.iterator] = () => {
throw new Error();
};
const ac = new AbortController();
@@ -2292,6 +2293,7 @@ Deno.test(
await server;
} finally {
Promise.prototype.then = originalThen;
+ Array.prototype[Symbol.iterator] = originalSymbolIterator;
}
},
);