forked from microsoft/typescript-error-deltas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getErrors.test.ts
56 lines (56 loc) · 3.08 KB
/
getErrors.test.ts
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import path = require('path')
import { buildAndGetErrors } from './getErrors'
describe("getErrors", () => {
jest.setTimeout(10 * 60 * 1000)
it("builds a simple project one time", async () => {
const errors = await buildAndGetErrors(
"./test/simpleProject",
// TODO: Depends on downloading and building 44585 in main.test.ts
path.resolve("./typescript-test-fake-error/built/local/tsc.js"),
/*skipLibCheck*/ true,
)
expect(errors.hasConfigFailure).toBeFalsy()
expect(errors.projectErrors).toHaveLength(1)
expect(errors.projectErrors[0].errors.length).toBe(1)
expect(errors.projectErrors[0].errors[0]).toMatchObject({
code: 2496,
text: "error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.",
})
expect(errors.projectErrors[0].errors[0].fileUrl?.endsWith("test/simpleProject/main.ts(1,35)")).toBeTruthy()
expect(errors.projectErrors[0].errors[0].projectUrl?.endsWith("test/simpleProject/tsconfig.json")).toBeTruthy()
})
it("builds a script project one time", async () => {
const errors = await buildAndGetErrors(
"./test/scriptProject",
// TODO: Depends on downloading and building 44585 in main.test.ts
path.resolve("./typescript-test-fake-error/built/local/tsc.js"),
/*skipLibCheck*/ true,
)
expect(errors.hasConfigFailure).toBeFalsy()
expect(errors.projectErrors).toHaveLength(1)
expect(errors.projectErrors[0].errors.length).toBe(1)
expect(errors.projectErrors[0].errors[0]).toMatchObject({
code: 2496,
text: "error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.",
})
expect(errors.projectErrors[0].errors[0].fileUrl?.endsWith("test/scriptProject/main.ts(1,35)")).toBeTruthy()
expect(errors.projectErrors[0].errors[0].projectUrl).toEqual("test/scriptProject/build.sh")
})
it("builds Real Live prettier, For Real", async () => {
const errors = await buildAndGetErrors(
"./test/scriptPrettier",
// TODO: Depends on downloading and building 44585 in main.test.ts
path.resolve("./typescript-test-fake-error/built/local/tsc.js"),
/*skipLibCheck*/ true,
)
expect(errors.hasConfigFailure).toBeFalsy()
expect(errors.projectErrors).toHaveLength(1)
expect(errors.projectErrors[0].errors.length).toBe(37)
expect(errors.projectErrors[0].errors[0]).toMatchObject({
code: 2496,
text: "error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.",
})
expect(errors.projectErrors[0].errors[0].fileUrl?.endsWith("src/cli/logger.js(31,23)")).toBeTruthy()
expect(errors.projectErrors[0].errors[0].projectUrl).toEqual("test/scriptPrettier/build.sh")
})
})