forked from aleclarson/spec.ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
30 lines (28 loc) · 2.87 KB
/
test.js
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
const exec = require("execa");
test("expected errors", () => {
expect.assertions(1);
return exec.shell("tsc -p . --noEmit").catch(err => {
expect(err.message).toMatchInlineSnapshot(`
"Command failed: /bin/sh -c tsc -p . --noEmit
test.ts(10,8): error TS2345: Argument of type 'true' is not assignable to parameter of type '\\"❌ Left type is not assignable to right type\\"'.
test.ts(11,8): error TS2345: Argument of type 'false' is not assignable to parameter of type '\\"❌ Left type is not assignable to right type\\"'.
test.ts(14,8): error TS2345: Argument of type '1' is not assignable to parameter of type '\\"❌ Left type is not assignable to right type\\"'.
test.ts(15,8): error TS2345: Argument of type '1' is not assignable to parameter of type '\\"❌ Right type is not assignable to left type\\"'.
test.ts(16,8): error TS2345: Argument of type '1' is not assignable to parameter of type '\\"❌ Right type is 'any' but left type is not\\"'.
test.ts(19,8): error TS2345: Argument of type '{ a: number; }' is not assignable to parameter of type '\\"❌ Unexpected or missing 'readonly' property\\"'.
test.ts(20,8): error TS2345: Argument of type '{ readonly a: number; }' is not assignable to parameter of type '\\"❌ Unexpected or missing 'readonly' property\\"'.
test.ts(23,8): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'.
test.ts(24,8): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'.
test.ts(27,20): error TS2345: Argument of type 'unknown' is not assignable to parameter of type '\\"❌ Right type is not assignable to left type\\"'.
test.ts(28,20): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'.
test.ts(29,20): error TS2345: Argument of type '2' is not assignable to parameter of type '\\"❌ Right type is not assignable to left type\\"'.
test.ts(31,8): error TS2345: Argument of type 'unknown' is not assignable to parameter of type '\\"❌ Right type is 'any' but left type is not\\"'.
test.ts(32,8): error TS2345: Argument of type 'unknown' is not assignable to parameter of type '\\"❌ Left type is not assignable to right type\\"'.
test.ts(34,8): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '\\"❌ Right type is not assignable to left type\\"'.
test.ts(35,8): error TS2345: Argument of type 'readonly any[]' is not assignable to parameter of type '\\"❌ Left type is not assignable to right type\\"'.
test.ts(38,8): error TS2345: Argument of type 'never[]' is not assignable to parameter of type '\\"❌ Left type is not assignable to right type\\"'.
test.ts(39,8): error TS2345: Argument of type '[never]' is not assignable to parameter of type '\\"❌ Right type is not assignable to left type\\"'.
"
`);
});
});