forked from jestjs/jest
/
script_transformer.test.js.snap
256 lines (240 loc) · 8.77 KB
/
script_transformer.test.js.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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ScriptTransformer passes expected transform options to getCacheKey 1`] = `
Object {
"config": Object {
"automock": false,
"cache": true,
"cacheDirectory": "/cache/",
"clearMocks": false,
"coveragePathIgnorePatterns": Array [],
"cwd": "/test_root_dir/",
"detectLeaks": false,
"detectOpenHandles": false,
"displayName": undefined,
"errorOnDeprecated": false,
"extraGlobals": Array [],
"filter": undefined,
"forceCoverageMatch": Array [],
"globalSetup": undefined,
"globalTeardown": undefined,
"globals": Object {},
"haste": Object {},
"moduleDirectories": Array [],
"moduleFileExtensions": Array [
"js",
],
"moduleLoader": "/test_module_loader_path",
"moduleNameMapper": Array [],
"modulePathIgnorePatterns": Array [],
"modulePaths": Array [],
"name": "test",
"prettierPath": "prettier",
"resetMocks": false,
"resetModules": false,
"resolver": undefined,
"restoreMocks": false,
"rootDir": "/",
"roots": Array [],
"runner": "jest-runner",
"setupFiles": Array [],
"setupFilesAfterEnv": Array [],
"skipFilter": false,
"skipNodeResolution": false,
"slowTestThreshold": 5,
"snapshotResolver": undefined,
"snapshotSerializers": Array [],
"testEnvironment": "node",
"testEnvironmentOptions": Object {},
"testLocationInResults": false,
"testMatch": Array [],
"testPathIgnorePatterns": Array [],
"testRegex": Array [
"\\\\.test\\\\.js$",
],
"testRunner": "jest-jasmine2",
"testURL": "http://localhost",
"timers": "real",
"transform": Array [
Array [
"^.+\\\\.js$",
"test_preprocessor",
],
],
"transformIgnorePatterns": Array [
"/node_modules/",
],
"unmockedModulePathPatterns": undefined,
"watchPathIgnorePatterns": Array [],
},
"instrument": true,
"rootDir": "/",
"supportsDynamicImport": false,
"supportsStaticESM": false,
}
`;
exports[`ScriptTransformer transforms a file properly 1`] = `
/* istanbul ignore next */
function cov_25u22311x4() {
var path = "/fruits/banana.js";
var hash = "3f8e915bed83285455a8a16aa04dc0cf5242d755";
var global = new Function("return this")();
var gcv = "__coverage__";
var coverageData = {
path: "/fruits/banana.js",
statementMap: {
"0": {
start: {
line: 1,
column: 0
},
end: {
line: 1,
column: 26
}
}
},
fnMap: {},
branchMap: {},
s: {
"0": 0
},
f: {},
b: {},
inputSourceMap: null,
_coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
hash: "3f8e915bed83285455a8a16aa04dc0cf5242d755"
};
var coverage = global[gcv] || (global[gcv] = {});
if (!coverage[path] || coverage[path].hash !== hash) {
coverage[path] = coverageData;
}
var actualCoverage = coverage[path];
{
// @ts-ignore
cov_25u22311x4 = function () {
return actualCoverage;
};
}
return actualCoverage;
}
cov_25u22311x4();
cov_25u22311x4().s[0]++;
module.exports = "banana";
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJhbmFuYS5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFlWTs7Ozs7Ozs7OztBQWZaQSxNQUFNLENBQUNDLE9BQVAsR0FBaUIsUUFBakIiLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IFwiYmFuYW5hXCI7Il19
`;
exports[`ScriptTransformer transforms a file properly 2`] = `
/* istanbul ignore next */
function cov_23yvu8etmu() {
var path = "/fruits/kiwi.js";
var hash = "8b5afd38d79008f13ebc229b89ef82b12ee9447a";
var global = new Function("return this")();
var gcv = "__coverage__";
var coverageData = {
path: "/fruits/kiwi.js",
statementMap: {
"0": {
start: {
line: 1,
column: 0
},
end: {
line: 1,
column: 30
}
},
"1": {
start: {
line: 1,
column: 23
},
end: {
line: 1,
column: 29
}
}
},
fnMap: {
"0": {
name: "(anonymous_0)",
decl: {
start: {
line: 1,
column: 17
},
end: {
line: 1,
column: 18
}
},
loc: {
start: {
line: 1,
column: 23
},
end: {
line: 1,
column: 29
}
},
line: 1
}
},
branchMap: {},
s: {
"0": 0,
"1": 0
},
f: {
"0": 0
},
b: {},
inputSourceMap: null,
_coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
hash: "8b5afd38d79008f13ebc229b89ef82b12ee9447a"
};
var coverage = global[gcv] || (global[gcv] = {});
if (!coverage[path] || coverage[path].hash !== hash) {
coverage[path] = coverageData;
}
var actualCoverage = coverage[path];
{
// @ts-ignore
cov_23yvu8etmu = function () {
return actualCoverage;
};
}
return actualCoverage;
}
cov_23yvu8etmu();
cov_23yvu8etmu().s[0]++;
module.exports = () => {
/* istanbul ignore next */
cov_23yvu8etmu().f[0]++;
cov_23yvu8etmu().s[1]++;
return "kiwi";
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImtpd2kuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFlWTs7Ozs7Ozs7Ozs7QUFmWkEsTUFBTSxDQUFDQyxPQUFQLEdBQWlCLE1BQU07QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFNLENBQTdCIiwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSAoKSA9PiBcImtpd2lcIjsiXX0=
`;
exports[`ScriptTransformer uses multiple preprocessors 1`] = `
const TRANSFORMED = {
filename: '/fruits/banana.js',
script: 'module.exports = "banana";',
config: '{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extraGlobals":[],"forceCoverageMatch":[],"globals":{},"haste":{},"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleLoader":"/test_module_loader_path","moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"name":"test","prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-jasmine2","testURL":"http://localhost","timers":"real","transform":[["^.+\\\\.js$","test_preprocessor"],["^.+\\\\.css$","css-preprocessor"]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]}',
};
`;
exports[`ScriptTransformer uses multiple preprocessors 2`] = `
module.exports = {
filename: /styles/App.css,
rawFirstLine: root {,
};
`;
exports[`ScriptTransformer uses multiple preprocessors 3`] = `module.exports = "react";`;
exports[`ScriptTransformer uses the supplied preprocessor 1`] = `
const TRANSFORMED = {
filename: '/fruits/banana.js',
script: 'module.exports = "banana";',
config: '{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extraGlobals":[],"forceCoverageMatch":[],"globals":{},"haste":{},"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleLoader":"/test_module_loader_path","moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"name":"test","prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-jasmine2","testURL":"http://localhost","timers":"real","transform":[["^.+\\\\.js$","test_preprocessor"]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]}',
};
`;
exports[`ScriptTransformer uses the supplied preprocessor 2`] = `module.exports = "react";`;
exports[`ScriptTransformer warns of unparseable inlined source maps from the preprocessor 1`] = `jest-transform: The source map produced for the file /fruits/banana.js by preprocessor-with-sourcemaps was invalid. Proceeding without source mapping for that file.`;