fix(javascript): prove native URL constructor paths

This commit is contained in:
morluto committed 2026-10-24 04:25:13 +08:00
1 parent f97747c2fb
commit 55437c1431
4 files changed
+28 -6

No files matched your search

@@ -21,6 +21,21 @@ it.each([
},
);
it.each([
["", "./native.js"],
["url.URL = class {};", null],
] as const)(
"requires the native URL constructor identity after %s",
(write, expected) => {
const analysis = analyzeJavaScriptStaticSource(`${windowPrefix}
import url from 'node:url';${write}
new BrowserWindow({webPreferences:{preload:fileURLToPath(new (url.URL as typeof URL)("./native.js", import.meta.url))}});`);
expect(analysis.electron.browser_windows).toMatchObject([
{ preload_path: expected },
]);
},
);
it.each([
'["a", "b"].join("/")',
'settings.join("/app", "preload.js")',