Skip to content

Commit c6447c4

Browse files
committed
Improve formatting of luaModuleSystem test
1 parent e983764 commit c6447c4

1 file changed

Lines changed: 9 additions & 29 deletions

File tree

test/unit/luaModuleSystem.spec.ts

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,15 @@ import * as util from "../util";
22
import * as ts from "typescript";
33
import { LuaModuleSystemKind } from "../../src";
44

5-
test.each<[string, Record<string, string>]>([
6-
[
7-
"Import module without package or require",
8-
{
9-
"main.ts": `
10-
import { value } from "./module";
11-
if (value !== true) {
12-
throw "Failed to import value";
13-
}
14-
`,
15-
"module.ts": `
16-
export const value = true;
17-
`,
18-
},
19-
],
20-
])("luaModuleSystem with outFile (%s)", (_, files) => {
21-
const testBuilder = util.testBundle`
22-
${files["main.ts"]}
5+
test("luaModuleSystem with outFile prevents re-creates require and package", () => {
6+
util.testBundle`
7+
import { value } from "./module";
8+
if (value !== true) {
9+
throw "Failed to import value";
10+
}
2311
`
2412
.setOptions({ outFile: "main.lua", module: ts.ModuleKind.AMD, luaModuleSystem: LuaModuleSystemKind.None })
25-
.setModuleSystem("none");
26-
27-
const extraFiles = Object.keys(files)
28-
.map(file => ({ fileName: file, code: files[file] }))
29-
.filter(file => file.fileName !== "main.ts");
30-
31-
extraFiles.forEach(extraFile => {
32-
testBuilder.addExtraFile(extraFile.fileName, extraFile.code);
33-
});
34-
35-
testBuilder.expectNoExecutionError();
13+
.setModuleSystem("none")
14+
.addExtraFile("module.ts", "export const value = true;")
15+
.expectNoExecutionError();
3616
});

0 commit comments

Comments
 (0)