/
ts-compiler.spec.ts.snap
185 lines (160 loc) · 9.07 KB
/
ts-compiler.spec.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
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TsCompiler isolatedModule false allowJs option should compile js file for allowJs true with outDir 1`] = `
===[ FILE: test-allow-js.js ]===================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = 42;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoidGVzdC1hbGxvdy1qcy5qcyIsIm1hcHBpbmdzIjoiOztBQUFBLGtCQUFlLEVBQUUsQ0FBQSIsIm5hbWVzIjpbXSwic291cmNlcyI6WyJ0ZXN0LWFsbG93LWpzLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IDQyIl0sInZlcnNpb24iOjN9
===[ INLINE SOURCE MAPS ]=======================================================
file: test-allow-js.js
mappings: ';;AAAA,kBAAe,EAAE,CAAA'
names: []
sources:
- test-allow-js.js
sourcesContent:
- export default 42
version: 3
================================================================================
`;
exports[`TsCompiler isolatedModule false allowJs option should compile js file for allowJs true without outDir 1`] = `
===[ FILE: test-allow-js.js ]===================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = 42;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoidGVzdC1hbGxvdy1qcy5qcyIsIm1hcHBpbmdzIjoiOztBQUFBLGtCQUFlLEVBQUUsQ0FBQSIsIm5hbWVzIjpbXSwic291cmNlcyI6WyJ0ZXN0LWFsbG93LWpzLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IDQyIl0sInZlcnNpb24iOjN9
===[ INLINE SOURCE MAPS ]=======================================================
file: test-allow-js.js
mappings: ';;AAAA,kBAAe,EAAE,CAAA'
names: []
sources:
- test-allow-js.js
sourcesContent:
- export default 42
version: 3
================================================================================
`;
exports[`TsCompiler isolatedModule false diagnostics should throw error when cannot compile 1`] = `
"Unable to require \`.d.ts\` file for file: test-cannot-compile.d.ts.
This is usually the result of a faulty configuration or import. Make sure there is a \`.js\`, \`.json\` or another executable extension available alongside \`test-cannot-compile.d.ts\`."
`;
exports[`TsCompiler isolatedModule false diagnostics shouldn't report diagnostic when processing file isn't used by any test files 1`] = `
Array [
"[level:20] getCompiledOutput(): compiling using language service
",
"[level:20] updateMemoryCache: update memory cache for language service
",
"[level:20] visitSourceFileNode(): hoisting
",
"[level:20] getCompiledOutput(): computing diagnostics using language service
",
]
`;
exports[`TsCompiler isolatedModule false jsx option should compile tsx file for jsx preserve 1`] = `
===[ FILE: test-jsx.tsx ]=======================================================
"use strict";
const App = () => {
return <>Test</>;
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoidGVzdC1qc3gudHN4IiwibWFwcGluZ3MiOiI7QUFDUSxNQUFNLEdBQUcsR0FBRyxHQUFHLEVBQUU7SUFDZixPQUFPLEVBQUUsSUFBSSxHQUFHLENBQUE7QUFDbEIsQ0FBQyxDQUFBIiwibmFtZXMiOltdLCJzb3VyY2VzIjpbInRlc3QtanN4LnRzeCJdLCJzb3VyY2VzQ29udGVudCI6WyJcbiAgICAgICAgY29uc3QgQXBwID0gKCkgPT4ge1xuICAgICAgICAgIHJldHVybiA8PlRlc3Q8Lz5cbiAgICAgICAgfVxuICAgICAgIl0sInZlcnNpb24iOjN9
===[ INLINE SOURCE MAPS ]=======================================================
file: test-jsx.tsx
mappings: ';AACQ,MAAM,GAAG,GAAG,GAAG,EAAE;IACf,OAAO,EAAE,IAAI,GAAG,CAAA;AAClB,CAAC,CAAA'
names: []
sources:
- test-jsx.tsx
sourcesContent:
- |2-
const App = () => {
return <>Test</>
}
version: 3
================================================================================
`;
exports[`TsCompiler isolatedModule false jsx option should compile tsx file for other jsx options 1`] = `
===[ FILE: test-jsx.tsx ]=======================================================
"use strict";
const App = () => {
return React.createElement(React.Fragment, null, "Test");
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoidGVzdC1qc3gudHN4IiwibWFwcGluZ3MiOiI7QUFDUSxNQUFNLEdBQUcsR0FBRyxHQUFHLEVBQUU7SUFDZixPQUFPLGlEQUFTLENBQUE7QUFDbEIsQ0FBQyxDQUFBIiwibmFtZXMiOltdLCJzb3VyY2VzIjpbInRlc3QtanN4LnRzeCJdLCJzb3VyY2VzQ29udGVudCI6WyJcbiAgICAgICAgY29uc3QgQXBwID0gKCkgPT4ge1xuICAgICAgICAgIHJldHVybiA8PlRlc3Q8Lz5cbiAgICAgICAgfVxuICAgICAgIl0sInZlcnNpb24iOjN9
===[ INLINE SOURCE MAPS ]=======================================================
file: test-jsx.tsx
mappings: ';AACQ,MAAM,GAAG,GAAG,GAAG,EAAE;IACf,OAAO,iDAAS,CAAA;AAClB,CAAC,CAAA'
names: []
sources:
- test-jsx.tsx
sourcesContent:
- |2-
const App = () => {
return <>Test</>
}
version: 3
================================================================================
`;
exports[`TsCompiler isolatedModule true diagnostics should report diagnostics related to codes with pathRegex config is undefined 1`] = `"foo.ts(2,23): error TS1005: '=>' expected."`;
exports[`TsCompiler isolatedModule true diagnostics should report diagnostics related to codes with pathRegex config matches file name 1`] = `"foo.ts(2,23): error TS1005: '=>' expected."`;
exports[`TsCompiler isolatedModule true jsx option should compile tsx file for jsx preserve 1`] = `
===[ FILE: foo.tsx ]============================================================
"use strict";
const App = () => {
return <>Test</>;
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiZm9vLnRzeCIsIm1hcHBpbmdzIjoiO0FBQ1EsTUFBTSxHQUFHLEdBQUcsR0FBRyxFQUFFO0lBQ2YsT0FBTyxFQUFFLElBQUksR0FBRyxDQUFBO0FBQ2xCLENBQUMsQ0FBQSIsIm5hbWVzIjpbXSwic291cmNlcyI6WyJmb28udHN4Il0sInNvdXJjZXNDb250ZW50IjpbIlxuICAgICAgICBjb25zdCBBcHAgPSAoKSA9PiB7XG4gICAgICAgICAgcmV0dXJuIDw+VGVzdDwvPlxuICAgICAgICB9XG4gICAgICAiXSwidmVyc2lvbiI6M30=
===[ INLINE SOURCE MAPS ]=======================================================
file: foo.tsx
mappings: ';AACQ,MAAM,GAAG,GAAG,GAAG,EAAE;IACf,OAAO,EAAE,IAAI,GAAG,CAAA;AAClB,CAAC,CAAA'
names: []
sources:
- foo.tsx
sourcesContent:
- |2-
const App = () => {
return <>Test</>
}
version: 3
================================================================================
`;
exports[`TsCompiler isolatedModule true jsx option should compile tsx file for other jsx options 1`] = `
===[ FILE: foo.tsx ]============================================================
"use strict";
const App = () => {
return React.createElement(React.Fragment, null, "Test");
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiZm9vLnRzeCIsIm1hcHBpbmdzIjoiO0FBQ1EsTUFBTSxHQUFHLEdBQUcsR0FBRyxFQUFFO0lBQ2YsT0FBTyxpREFBUyxDQUFBO0FBQ2xCLENBQUMsQ0FBQSIsIm5hbWVzIjpbXSwic291cmNlcyI6WyJmb28udHN4Il0sInNvdXJjZXNDb250ZW50IjpbIlxuICAgICAgICBjb25zdCBBcHAgPSAoKSA9PiB7XG4gICAgICAgICAgcmV0dXJuIDw+VGVzdDwvPlxuICAgICAgICB9XG4gICAgICAiXSwidmVyc2lvbiI6M30=
===[ INLINE SOURCE MAPS ]=======================================================
file: foo.tsx
mappings: ';AACQ,MAAM,GAAG,GAAG,GAAG,EAAE;IACf,OAAO,iDAAS,CAAA;AAClB,CAAC,CAAA'
names: []
sources:
- foo.tsx
sourcesContent:
- |2-
const App = () => {
return <>Test</>
}
version: 3
================================================================================
`;
exports[`TsCompiler isolatedModule true should compile js file for allowJs true 1`] = `
===[ FILE: foo.js ]=============================================================
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = 42;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJmaWxlIjoiZm9vLmpzIiwibWFwcGluZ3MiOiI7O0FBQUEsa0JBQWUsRUFBRSxDQUFBIiwibmFtZXMiOltdLCJzb3VyY2VzIjpbImZvby5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZGVmYXVsdCA0MiJdLCJ2ZXJzaW9uIjozfQ==
===[ INLINE SOURCE MAPS ]=======================================================
file: foo.js
mappings: ';;AAAA,kBAAe,EAAE,CAAA'
names: []
sources:
- foo.js
sourcesContent:
- export default 42
version: 3
================================================================================
`;
exports[`TsCompiler isolatedModule true support ESM should transpile codes to correct syntax with supportsStaticESM and useESM options 1`] = `99`;
exports[`TsCompiler isolatedModule true support ESM should transpile codes to correct syntax with supportsStaticESM and useESM options 2`] = `99`;
exports[`TsCompiler isolatedModule true support ESM should transpile codes to correct syntax with supportsStaticESM and useESM options 3`] = `99`;
exports[`TsCompiler isolatedModule true support ESM should transpile codes to correct syntax with supportsStaticESM and useESM options 4`] = `1`;
exports[`TsCompiler isolatedModule true support ESM should transpile codes to correct syntax with supportsStaticESM and useESM options 5`] = `1`;
exports[`TsCompiler isolatedModule true support ESM should transpile codes to correct syntax with supportsStaticESM and useESM options 6`] = `1`;