/
esnext.test.ts.snap
204 lines (164 loc) · 7.82 KB
/
esnext.test.ts.snap
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`run with options: {"module":"esnext","allowSyntheticDefaultImports":false} 1`] = `
× jest --no-cache
↳ exit code: 1
===[ STDOUT ]===================================================================
===[ STDERR ]===================================================================
ts-jest[config] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
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.
PASS ./ts-jest-tools.spec.ts
PASS ./import-legacy.spec.ts
PASS ./import-star.spec.ts
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
import-default.spec.ts:1:8 - error TS1259: Module '"<cwd>/lib"' can only be default-imported using the 'esModuleInterop' flag
1 import lib from './lib'
~~~
lib.d.ts:5:1
5 export = lib
~~~~~~~~~~~~
This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
FAIL ./import-default.spec.ts
● import default
expect(received).toBe(expected) // Object.is equality
Expected: "function"
Received: "undefined"
2 |
3 | test('import default', () => {
> 4 | expect(typeof lib).toBe('function')
| ^
5 | expect(lib()).toBe('foo')
6 | expect(lib.bar).toBe('bar')
7 | })
at Object.<anonymous> (import-default.spec.ts:4:22)
Test Suites: 1 failed, 3 passed, 4 total
Tests: 1 failed, 4 passed, 5 total
Snapshots: 0 total
Time: XXs
Ran all test suites.
================================================================================
`;
exports[`run with options: {"module":"esnext","allowSyntheticDefaultImports":true} 1`] = `
× jest --no-cache
↳ exit code: 1
===[ STDOUT ]===================================================================
===[ STDERR ]===================================================================
PASS ./ts-jest-tools.spec.ts
PASS ./import-legacy.spec.ts
PASS ./import-star.spec.ts
FAIL ./import-default.spec.ts
● import default
expect(received).toBe(expected) // Object.is equality
Expected: "function"
Received: "undefined"
2 |
3 | test('import default', () => {
> 4 | expect(typeof lib).toBe('function')
| ^
5 | expect(lib()).toBe('foo')
6 | expect(lib.bar).toBe('bar')
7 | })
at Object.<anonymous> (import-default.spec.ts:4:22)
Test Suites: 1 failed, 3 passed, 4 total
Tests: 1 failed, 4 passed, 5 total
Snapshots: 0 total
Time: XXs
Ran all test suites.
================================================================================
`;
exports[`run with options: {"module":"esnext","esModuleInterop":false} 1`] = `
× jest --no-cache
↳ exit code: 1
===[ STDOUT ]===================================================================
===[ STDERR ]===================================================================
ts-jest[config] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
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.
PASS ./ts-jest-tools.spec.ts
PASS ./import-legacy.spec.ts
PASS ./import-star.spec.ts
FAIL ./import-default.spec.ts
● import default
expect(received).toBe(expected) // Object.is equality
Expected: "function"
Received: "undefined"
2 |
3 | test('import default', () => {
> 4 | expect(typeof lib).toBe('function')
| ^
5 | expect(lib()).toBe('foo')
6 | expect(lib.bar).toBe('bar')
7 | })
at Object.<anonymous> (import-default.spec.ts:4:22)
Test Suites: 1 failed, 3 passed, 4 total
Tests: 1 failed, 4 passed, 5 total
Snapshots: 0 total
Time: XXs
Ran all test suites.
================================================================================
`;
exports[`run with options: {"module":"esnext","esModuleInterop":true} 1`] = `
× jest --no-cache
↳ exit code: 1
===[ STDOUT ]===================================================================
===[ STDERR ]===================================================================
PASS ./ts-jest-tools.spec.ts
PASS ./import-legacy.spec.ts
ts-jest[ts-compiler] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
import-star.spec.ts:5:10 - error TS2349: This expression is not callable.
Type 'typeof lib' has no call signatures.
5 expect(lib()).toBe('foo')
~~~
import-star.spec.ts:1:1
1 import * as lib from './lib'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.
FAIL ./import-star.spec.ts
● import default
expect(received).toBe(expected) // Object.is equality
Expected: "function"
Received: "object"
2 |
3 | test('import default', () => {
> 4 | expect(typeof lib).toBe('function')
| ^
5 | expect(lib()).toBe('foo')
6 | expect(lib.bar).toBe('bar')
7 | })
at Object.<anonymous> (import-star.spec.ts:4:22)
PASS ./import-default.spec.ts
Test Suites: 1 failed, 3 passed, 4 total
Tests: 1 failed, 4 passed, 5 total
Snapshots: 0 total
Time: XXs
Ran all test suites.
================================================================================
`;
exports[`run with options: {"module":"esnext"} 1`] = `
× jest --no-cache
↳ exit code: 1
===[ STDOUT ]===================================================================
===[ STDERR ]===================================================================
ts-jest[config] (WARN) TypeScript diagnostics (customize using \`[jest-config].globals.ts-jest.diagnostics\` option):
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.
PASS ./ts-jest-tools.spec.ts
PASS ./import-legacy.spec.ts
PASS ./import-star.spec.ts
FAIL ./import-default.spec.ts
● import default
expect(received).toBe(expected) // Object.is equality
Expected: "function"
Received: "undefined"
2 |
3 | test('import default', () => {
> 4 | expect(typeof lib).toBe('function')
| ^
5 | expect(lib()).toBe('foo')
6 | expect(lib.bar).toBe('bar')
7 | })
at Object.<anonymous> (import-default.spec.ts:4:22)
Test Suites: 1 failed, 3 passed, 4 total
Tests: 1 failed, 4 passed, 5 total
Snapshots: 0 total
Time: XXs
Ran all test suites.
================================================================================
`;