-
-
Notifications
You must be signed in to change notification settings - Fork 185
Expand file tree
/
Copy pathproject.spec.ts
More file actions
35 lines (29 loc) · 1.19 KB
/
project.spec.ts
File metadata and controls
35 lines (29 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import * as path from "path";
import { normalizeSlashes } from "../../src/utils";
import * as util from "../util";
test("should transpile", () => {
const projectDir = path.join(__dirname, "project");
const { transpiledFiles } = util
.testProject(path.join(projectDir, "tsconfig.json"))
.setMainFileName(path.join(projectDir, "index.ts"))
.expectToHaveNoDiagnostics()
.getLuaResult();
expect(
transpiledFiles.map(f => ({ filePath: path.relative(projectDir, f.outPath), lua: f.lua }))
).toMatchSnapshot();
});
test("should give verbose output", () => {
// Capture console logs
const consoleLogs: string[] = [];
const originalLog = console.log;
console.log = (...args: any[]) => {
consoleLogs.push(args.map(a => a.toString().replace(normalizeSlashes(process.cwd()), "<cwd>")).join(","));
};
const projectDir = path.join(__dirname, "project");
util.testProject(path.join(projectDir, "tsconfig.json"))
.setMainFileName(path.join(projectDir, "index.ts"))
.setOptions({ tstlVerbose: true })
.expectToHaveNoDiagnostics();
console.log = originalLog;
expect(consoleLogs).toMatchSnapshot();
});