mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:57:46 +00:00
LibJS: Handle empty named export
This is an export which looks like `export {} from "module"`, and although it doesn't have any real export entries it should still add "module" to the required modules to load.
This commit is contained in:
parent
f75c51b097
commit
3b1c3e574f
10 changed files with 60 additions and 2 deletions
|
@ -193,3 +193,25 @@ describe("loops", () => {
|
|||
expectModulePassed("./loop-entry.mjs");
|
||||
});
|
||||
});
|
||||
|
||||
describe("failing modules cascade", () => {
|
||||
let failingModuleError = "Left-hand side of postfix";
|
||||
test("importing a file with a SyntaxError results in a SyntaxError", () => {
|
||||
expectedModuleToThrowSyntaxError("./failing.mjs", failingModuleError);
|
||||
});
|
||||
|
||||
test("importing a file without a syntax error which imports a file with a syntax error fails", () => {
|
||||
expectedModuleToThrowSyntaxError("./importing-failing-module.mjs", failingModuleError);
|
||||
});
|
||||
|
||||
test("importing a file which re exports a file with a syntax error fails", () => {
|
||||
expectedModuleToThrowSyntaxError("./exporting-from-failing.mjs", failingModuleError);
|
||||
});
|
||||
|
||||
test("importing a file re exports nothing from a file with a syntax error fails", () => {
|
||||
expectedModuleToThrowSyntaxError(
|
||||
"./exporting-nothing-from-failing.mjs",
|
||||
failingModuleError
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
export * as shouldFail from "./failing.mjs";
|
|
@ -0,0 +1,4 @@
|
|||
export {} from "./failing.mjs";
|
||||
export {};
|
||||
// This should not be a duplicate!
|
||||
export {} from "./failing.mjs";
|
2
Userland/Libraries/LibJS/Tests/modules/failing.mjs
Normal file
2
Userland/Libraries/LibJS/Tests/modules/failing.mjs
Normal file
|
@ -0,0 +1,2 @@
|
|||
// Should produce a SyntaxError!
|
||||
0++;
|
|
@ -0,0 +1 @@
|
|||
import "./failing.mjs";
|
Loading…
Add table
Add a link
Reference in a new issue