Skip to content

Commit 96cd9b3

Browse files
authored
chore(config): improve diagnostics message (#1444)
BREAKING CHANGE: This will affect to any snapshots or assertion against diagnostics messages
1 parent 57c8f3e commit 96cd9b3

17 files changed

+57
-126
lines changed

e2e/__tests__/__snapshots__/compiler-host.test.ts.snap

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ exports[`With compilerHost enabled and incremental disabled should pass using te
4949
===[ STDOUT ]===================================================================
5050
5151
===[ STDERR ]===================================================================
52-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
53-
main.spec.ts:4:9 - error TS2322: Type 'number' is not assignable to type 'string'.
52+
ts-jest[ts-compiler] (WARN) main.spec.ts:4:9 - error TS2322: Type 'number' is not assignable to type 'string'.
5453
5554
4 const x: string = g(5)
5655
~
@@ -71,8 +70,7 @@ exports[`With compilerHost enabled and incremental disabled should pass using te
7170
===[ STDOUT ]===================================================================
7271
7372
===[ STDERR ]===================================================================
74-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
75-
main.spec.ts:4:9 - error TS2322: Type 'number' is not assignable to type 'string'.
73+
ts-jest[ts-compiler] (WARN) main.spec.ts:4:9 - error TS2322: Type 'number' is not assignable to type 'string'.
7674
7775
4 const x: string = g(5)
7876
~
@@ -93,8 +91,7 @@ exports[`With compilerHost enabled and incremental disabled should pass using te
9391
===[ STDOUT ]===================================================================
9492
9593
===[ STDERR ]===================================================================
96-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
97-
main.spec.ts:4:9 - error TS2322: Type 'number' is not assignable to type 'string'.
94+
ts-jest[ts-compiler] (WARN) main.spec.ts:4:9 - error TS2322: Type 'number' is not assignable to type 'string'.
9895
9996
4 const x: string = g(5)
10097
~
@@ -158,8 +155,7 @@ exports[`With compilerHost enabled and incremental enabled should pass using tem
158155
===[ STDOUT ]===================================================================
159156
160157
===[ STDERR ]===================================================================
161-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
162-
main.spec.ts:4:9 - error TS2322: Type 'number' is not assignable to type 'string'.
158+
ts-jest[ts-compiler] (WARN) main.spec.ts:4:9 - error TS2322: Type 'number' is not assignable to type 'string'.
163159
164160
4 const x: string = g(5)
165161
~
@@ -180,8 +176,7 @@ exports[`With compilerHost enabled and incremental enabled should pass using tem
180176
===[ STDOUT ]===================================================================
181177
182178
===[ STDERR ]===================================================================
183-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
184-
main.spec.ts:4:9 - error TS2322: Type 'number' is not assignable to type 'string'.
179+
ts-jest[ts-compiler] (WARN) main.spec.ts:4:9 - error TS2322: Type 'number' is not assignable to type 'string'.
185180
186181
4 const x: string = g(5)
187182
~
@@ -202,8 +197,7 @@ exports[`With compilerHost enabled and incremental enabled should pass using tem
202197
===[ STDOUT ]===================================================================
203198
204199
===[ STDERR ]===================================================================
205-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
206-
main.spec.ts:4:9 - error TS2322: Type 'number' is not assignable to type 'string'.
200+
ts-jest[ts-compiler] (WARN) main.spec.ts:4:9 - error TS2322: Type 'number' is not assignable to type 'string'.
207201
208202
4 const x: string = g(5)
209203
~

e2e/__tests__/__snapshots__/diagnostics.test.ts.snap

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ exports[`With diagnostics, first throws should fail using template "default" 1`]
99
FAIL ./main.spec.ts
1010
● Test suite failed to run
1111
12-
TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
1312
main.ts:2:3 - error TS2322: Type 'string' is not assignable to type 'number'.
1413
1514
2 return input
@@ -32,7 +31,6 @@ exports[`With diagnostics, first throws should fail using template "with-babel-7
3231
FAIL ./main.spec.ts
3332
● Test suite failed to run
3433
35-
TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
3634
main.ts:2:3 - error TS2322: Type 'string' is not assignable to type 'number'.
3735
3836
2 return input
@@ -55,7 +53,6 @@ exports[`With diagnostics, first throws should fail using template "with-babel-7
5553
FAIL ./main.spec.ts
5654
● Test suite failed to run
5755
58-
TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
5956
main.ts:2:3 - error TS2322: Type 'string' is not assignable to type 'number'.
6057
6158
2 return input
@@ -78,7 +75,6 @@ exports[`With diagnostics, first throws should fail using template "with-typescr
7875
FAIL ./main.spec.ts
7976
● Test suite failed to run
8077
81-
TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
8278
main.ts:2:3 - error TS2322: Type 'string' is not assignable to type 'number'.
8379
8480
2 return input
@@ -98,8 +94,7 @@ exports[`With diagnostics, warn only should pass using template "default" 1`] =
9894
===[ STDOUT ]===================================================================
9995
10096
===[ STDERR ]===================================================================
101-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
102-
main.ts:2:3 - error TS2322: Type 'string' is not assignable to type 'number'.
97+
ts-jest[ts-compiler] (WARN) main.ts:2:3 - error TS2322: Type 'string' is not assignable to type 'number'.
10398
10499
2 return input
105100
~~~~~~~~~~~~
@@ -120,8 +115,7 @@ exports[`With diagnostics, warn only should pass using template "with-babel-7" 1
120115
===[ STDOUT ]===================================================================
121116
122117
===[ STDERR ]===================================================================
123-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
124-
main.ts:2:3 - error TS2322: Type 'string' is not assignable to type 'number'.
118+
ts-jest[ts-compiler] (WARN) main.ts:2:3 - error TS2322: Type 'string' is not assignable to type 'number'.
125119
126120
2 return input
127121
~~~~~~~~~~~~
@@ -142,8 +136,7 @@ exports[`With diagnostics, warn only should pass using template "with-babel-7-st
142136
===[ STDOUT ]===================================================================
143137
144138
===[ STDERR ]===================================================================
145-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
146-
main.ts:2:3 - error TS2322: Type 'string' is not assignable to type 'number'.
139+
ts-jest[ts-compiler] (WARN) main.ts:2:3 - error TS2322: Type 'string' is not assignable to type 'number'.
147140
148141
2 return input
149142
~~~~~~~~~~~~
@@ -164,8 +157,7 @@ exports[`With diagnostics, warn only should pass using template "with-typescript
164157
===[ STDOUT ]===================================================================
165158
166159
===[ STDERR ]===================================================================
167-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
168-
main.ts:2:3 - error TS2322: Type 'string' is not assignable to type 'number'.
160+
ts-jest[ts-compiler] (WARN) main.ts:2:3 - error TS2322: Type 'string' is not assignable to type 'number'.
169161
170162
2 return input
171163
~~~~~~~~~~~~

e2e/__tests__/__snapshots__/test-helpers.test.ts.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ exports[`test-helpers 1`] = `
1010
FAIL ./fail.spec.ts
1111
● Test suite failed to run
1212
13-
TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
1413
fail.spec.ts:7:22 - error TS2554: Expected 0 arguments, but got 1.
1514
1615
7 expect(mocked(foo)('hello')).toBeUndefined()
@@ -41,7 +40,6 @@ exports[`with esModuleInterop set to false 1`] = `
4140
FAIL ./fail.spec.ts
4241
● Test suite failed to run
4342
44-
TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
4543
fail.spec.ts:7:22 - error TS2554: Expected 0 arguments, but got 1.
4644
4745
7 expect(mocked(foo)('hello')).toBeUndefined()

e2e/__tests__/module-kinds/__snapshots__/amd.test.ts.snap

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ exports[`run with options: {"module":"amd","allowSyntheticDefaultImports":false}
66
===[ STDOUT ]===================================================================
77
88
===[ STDERR ]===================================================================
9-
ts-jest[config] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
10-
message TS151001: If you have issues related to imports, you should consider setting \`esModuleInterop\` to \`true\` in your TypeScript configuration file (usually \`tsconfig.json\`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.
9+
ts-jest[config] (WARN) message TS151001: If you have issues related to imports, you should consider setting \`esModuleInterop\` to \`true\` in your TypeScript configuration file (usually \`tsconfig.json\`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.
1110
PASS ./ts-jest-tools.spec.ts
1211
PASS ./import-legacy.spec.ts
1312
PASS ./import-star.spec.ts
14-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
15-
import-default.spec.ts:1:8 - error TS1259: Module '"<cwd>/lib"' can only be default-imported using the 'esModuleInterop' flag
13+
ts-jest[ts-compiler] (WARN) import-default.spec.ts:1:8 - error TS1259: Module '"<cwd>/lib"' can only be default-imported using the 'esModuleInterop' flag
1614
1715
1 import lib from './lib'
1816
~~~
@@ -88,8 +86,7 @@ exports[`run with options: {"module":"amd","esModuleInterop":false} 1`] = `
8886
===[ STDOUT ]===================================================================
8987
9088
===[ STDERR ]===================================================================
91-
ts-jest[config] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
92-
message TS151001: If you have issues related to imports, you should consider setting \`esModuleInterop\` to \`true\` in your TypeScript configuration file (usually \`tsconfig.json\`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.
89+
ts-jest[config] (WARN) message TS151001: If you have issues related to imports, you should consider setting \`esModuleInterop\` to \`true\` in your TypeScript configuration file (usually \`tsconfig.json\`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.
9390
PASS ./ts-jest-tools.spec.ts
9491
PASS ./import-legacy.spec.ts
9592
PASS ./import-star.spec.ts
@@ -127,8 +124,7 @@ exports[`run with options: {"module":"amd","esModuleInterop":true} 1`] = `
127124
===[ STDERR ]===================================================================
128125
PASS ./ts-jest-tools.spec.ts
129126
PASS ./import-legacy.spec.ts
130-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
131-
import-star.spec.ts:5:10 - error TS2349: This expression is not callable.
127+
ts-jest[ts-compiler] (WARN) import-star.spec.ts:5:10 - error TS2349: This expression is not callable.
132128
Type 'typeof lib' has no call signatures.
133129
134130
5 expect(lib()).toBe('foo')
@@ -172,8 +168,7 @@ exports[`run with options: {"module":"amd"} 1`] = `
172168
===[ STDOUT ]===================================================================
173169
174170
===[ STDERR ]===================================================================
175-
ts-jest[config] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
176-
message TS151001: If you have issues related to imports, you should consider setting \`esModuleInterop\` to \`true\` in your TypeScript configuration file (usually \`tsconfig.json\`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.
171+
ts-jest[config] (WARN) message TS151001: If you have issues related to imports, you should consider setting \`esModuleInterop\` to \`true\` in your TypeScript configuration file (usually \`tsconfig.json\`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.
177172
PASS ./ts-jest-tools.spec.ts
178173
PASS ./import-legacy.spec.ts
179174
PASS ./import-star.spec.ts

e2e/__tests__/module-kinds/__snapshots__/commonjs.test.ts.snap

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ exports[`run with options: {"module":"commonjs","allowSyntheticDefaultImports":f
99
PASS ./ts-jest-tools.spec.ts
1010
PASS ./import-legacy.spec.ts
1111
PASS ./import-star.spec.ts
12-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
13-
import-default.spec.ts:1:8 - error TS1259: Module '"<cwd>/lib"' can only be default-imported using the 'esModuleInterop' flag
12+
ts-jest[ts-compiler] (WARN) import-default.spec.ts:1:8 - error TS1259: Module '"<cwd>/lib"' can only be default-imported using the 'esModuleInterop' flag
1413
1514
1 import lib from './lib'
1615
~~~
@@ -89,8 +88,7 @@ exports[`run with options: {"module":"commonjs","esModuleInterop":false} 1`] = `
8988
PASS ./ts-jest-tools.spec.ts
9089
PASS ./import-legacy.spec.ts
9190
PASS ./import-star.spec.ts
92-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
93-
import-default.spec.ts:1:8 - error TS1259: Module '"<cwd>/lib"' can only be default-imported using the 'esModuleInterop' flag
91+
ts-jest[ts-compiler] (WARN) import-default.spec.ts:1:8 - error TS1259: Module '"<cwd>/lib"' can only be default-imported using the 'esModuleInterop' flag
9492
9593
1 import lib from './lib'
9694
~~~
@@ -133,8 +131,7 @@ exports[`run with options: {"module":"commonjs","esModuleInterop":true} 1`] = `
133131
===[ STDERR ]===================================================================
134132
PASS ./ts-jest-tools.spec.ts
135133
PASS ./import-legacy.spec.ts
136-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
137-
import-star.spec.ts:5:10 - error TS2349: This expression is not callable.
134+
ts-jest[ts-compiler] (WARN) import-star.spec.ts:5:10 - error TS2349: This expression is not callable.
138135
Type 'typeof lib' has no call signatures.
139136
140137
5 expect(lib()).toBe('foo')
@@ -181,8 +178,7 @@ exports[`run with options: {"module":"commonjs"} 1`] = `
181178
PASS ./ts-jest-tools.spec.ts
182179
PASS ./import-legacy.spec.ts
183180
PASS ./import-star.spec.ts
184-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
185-
import-default.spec.ts:1:8 - error TS1259: Module '"<cwd>/lib"' can only be default-imported using the 'esModuleInterop' flag
181+
ts-jest[ts-compiler] (WARN) import-default.spec.ts:1:8 - error TS1259: Module '"<cwd>/lib"' can only be default-imported using the 'esModuleInterop' flag
186182
187183
1 import lib from './lib'
188184
~~~

e2e/__tests__/module-kinds/__snapshots__/es2015.test.ts.snap

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ exports[`run with options: {"module":"es2015","allowSyntheticDefaultImports":fal
66
===[ STDOUT ]===================================================================
77
88
===[ STDERR ]===================================================================
9-
ts-jest[config] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
10-
message TS151001: If you have issues related to imports, you should consider setting \`esModuleInterop\` to \`true\` in your TypeScript configuration file (usually \`tsconfig.json\`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.
9+
ts-jest[config] (WARN) message TS151001: If you have issues related to imports, you should consider setting \`esModuleInterop\` to \`true\` in your TypeScript configuration file (usually \`tsconfig.json\`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.
1110
PASS ./ts-jest-tools.spec.ts
1211
PASS ./import-legacy.spec.ts
1312
PASS ./import-star.spec.ts
14-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
15-
import-default.spec.ts:1:8 - error TS1259: Module '"<cwd>/lib"' can only be default-imported using the 'esModuleInterop' flag
13+
ts-jest[ts-compiler] (WARN) import-default.spec.ts:1:8 - error TS1259: Module '"<cwd>/lib"' can only be default-imported using the 'esModuleInterop' flag
1614
1715
1 import lib from './lib'
1816
~~~
@@ -88,8 +86,7 @@ exports[`run with options: {"module":"es2015","esModuleInterop":false} 1`] = `
8886
===[ STDOUT ]===================================================================
8987
9088
===[ STDERR ]===================================================================
91-
ts-jest[config] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
92-
message TS151001: If you have issues related to imports, you should consider setting \`esModuleInterop\` to \`true\` in your TypeScript configuration file (usually \`tsconfig.json\`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.
89+
ts-jest[config] (WARN) message TS151001: If you have issues related to imports, you should consider setting \`esModuleInterop\` to \`true\` in your TypeScript configuration file (usually \`tsconfig.json\`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.
9390
PASS ./ts-jest-tools.spec.ts
9491
PASS ./import-legacy.spec.ts
9592
PASS ./import-star.spec.ts
@@ -127,8 +124,7 @@ exports[`run with options: {"module":"es2015","esModuleInterop":true} 1`] = `
127124
===[ STDERR ]===================================================================
128125
PASS ./ts-jest-tools.spec.ts
129126
PASS ./import-legacy.spec.ts
130-
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
131-
import-star.spec.ts:5:10 - error TS2349: This expression is not callable.
127+
ts-jest[ts-compiler] (WARN) import-star.spec.ts:5:10 - error TS2349: This expression is not callable.
132128
Type 'typeof lib' has no call signatures.
133129
134130
5 expect(lib()).toBe('foo')
@@ -172,8 +168,7 @@ exports[`run with options: {"module":"es2015"} 1`] = `
172168
===[ STDOUT ]===================================================================
173169
174170
===[ STDERR ]===================================================================
175-
ts-jest[config] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
176-
message TS151001: If you have issues related to imports, you should consider setting \`esModuleInterop\` to \`true\` in your TypeScript configuration file (usually \`tsconfig.json\`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.
171+
ts-jest[config] (WARN) message TS151001: If you have issues related to imports, you should consider setting \`esModuleInterop\` to \`true\` in your TypeScript configuration file (usually \`tsconfig.json\`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.
177172
PASS ./ts-jest-tools.spec.ts
178173
PASS ./import-legacy.spec.ts
179174
PASS ./import-star.spec.ts

0 commit comments

Comments
 (0)