Update tests for the EvalError and builtin module changes (#1529)

This commit is contained in:
Chris Tate
2026-10-20 11:35:19 -05:00
committed by GitHub
4 changed files with 12 additions and 12 deletions
@@ -102,19 +102,19 @@ test.each(["llvm"] as const)(
writeFileSync(
join(pkg, "index.js"),
`
const inspect = (value) => eval(value);
const inspect = (value) => process.on("__proto__", value);
function stopped(value) {
eval(value);
process.on("__proto__", value);
return { done() { return "wrong"; } };
}
try { console.log(stopped("0").done()); }
catch (error) { console.log(String(error).includes("SC2009")); }
try { console.log(stopped(() => {}).done()); }
catch (error) { console.log(String(error).includes("SC2020")); }
const first = { inspect };
const second = { inspect };
console.log(typeof first.inspect, first.inspect === second.inspect);
for (const callback of [first.inspect, second.inspect]) {
try { callback({}); }
catch (error) { console.log(String(error).includes("SC2009")); }
try { callback(() => {}); }
catch (error) { console.log(String(error).includes("SC2020")); }
}
`,
);
@@ -12,7 +12,7 @@
"end": 376
},
"milestone": "M4",
"hint": "relative imports (./file, ../dir/file), package.json-mediated project imports (#alias via the imports field, self-name references via exports), statically compiled npm packages, and the built-in fs, fs/promises, path, os, url, crypto, zlib, child_process, net, http, tls, https, http2, dgram, dns, util, util/types, string_decoder, querystring, readline, events, stream, stream/promises, stream/consumers, buffer, assert, assert/strict, worker_threads, cluster, tty, async_hooks, timers, timers/promises, diagnostics_channel, perf_hooks, module, and console modules (bare or node:-prefixed) and node:test (node:-prefixed only, like in Node) are supported"
"hint": "relative imports (./file, ../dir/file), package.json-mediated project imports (#alias via the imports field, self-name references via exports), statically compiled npm packages, and the built-in fs, fs/promises, path, os, url, crypto, zlib, child_process, net, http, tls, https, http2, dgram, dns, dns/promises, util, util/types, string_decoder, querystring, readline, events, stream, stream/promises, stream/consumers, stream/web, buffer, assert, assert/strict, worker_threads, cluster, tty, async_hooks, timers, timers/promises, diagnostics_channel, perf_hooks, module, v8, and console modules (bare or node:-prefixed) and node:test (node:-prefixed only, like in Node) are supported"
}
]
}
+4 -4
View File
@@ -1040,7 +1040,7 @@ describe("refused statements in speculatively lowered JavaScript functions", ()
`(function () {
var root = this;
console.log("before");
console.log(root === eval("this"));
process.on("__proto__", () => root);
console.log("after");
}).call(this);
`,
@@ -1051,7 +1051,7 @@ describe("refused statements in speculatively lowered JavaScript functions", ()
"speculative-apply",
`(function () {
console.log("before");
console.log(typeof eval("1"));
process.on("__proto__", () => {});
}).apply(null, []);
`,
"before\n",
@@ -1062,7 +1062,7 @@ describe("refused statements in speculatively lowered JavaScript functions", ()
`class Base {}
class Derived extends (function () {
console.log("before");
console.log(typeof eval("1"));
process.on("__proto__", () => {});
return Base;
})() {}
console.log(typeof Derived);
@@ -1076,7 +1076,7 @@ console.log(typeof Derived);
expect(r.stdout).toBe(stdout);
expect(r.stderr).toMatch(
new RegExp(
`^Uncaught Error: values of type '\\(x: string\\) => any' cannot be compiled: .* \\[SC2009 at .*${name}\\.cjs:${line}\\]\\n$`,
`^Uncaught Error: 'process\\.on\\("__proto__", \\.\\.\\.\\)' is part of the standard library types but has no scriptc lowering yet \\[SC2020 at .*${name}\\.cjs:${line}\\]\\n$`,
),
);
});
+1 -1
View File
@@ -60,7 +60,7 @@ const KNOWN: Record<string, Known> = {
},
"island-web-plumbing": { run: "SC2020" },
"lazy-traps": { build: "SC2013" },
"misc-shims": { build: "SC2013" },
"misc-shims": { run: "SC2020" },
"namespace": { build: "SC1013" },
"node24-async-events": { run: "SC2020" },
"node24-commonjs-metadata": { run: "SC2020" },