@rstest/core 0.4.1 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +127 -0
- package/dist/0~204.js +83 -0
- package/dist/0~223.js +19 -20
- package/dist/0~33.js +11 -23
- package/dist/0~655.js +3198 -8
- package/dist/0~655.js.LICENSE.txt +264 -0
- package/dist/0~691.js +58 -9
- package/dist/{0~938.js → 0~816.js} +183 -19
- package/dist/0~836.js +1 -1
- package/dist/0~85.js +20 -24
- package/dist/{0~669.js → 0~876.js} +36 -22
- package/dist/{0~120.js → 0~908.js} +333 -5
- package/dist/0~928.js +1 -1
- package/dist/0~969.js +1 -1
- package/dist/0~971.js +2 -2
- package/dist/index.js +594 -120
- package/dist/worker.js +651 -22
- package/dist-types/index.d.ts +250 -20
- package/dist-types/worker.d.ts +230 -18
- package/package.json +7 -5
|
@@ -6,6 +6,270 @@
|
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
/*!
|
|
10
|
+
* Chai - addChainingMethod utility
|
|
11
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
12
|
+
* MIT Licensed
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/*!
|
|
16
|
+
* Chai - addLengthGuard utility
|
|
17
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
18
|
+
* MIT Licensed
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/*!
|
|
22
|
+
* Chai - addMethod utility
|
|
23
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
24
|
+
* MIT Licensed
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/*!
|
|
28
|
+
* Chai - addProperty utility
|
|
29
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
30
|
+
* MIT Licensed
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/*!
|
|
34
|
+
* Chai - compareByInspect utility
|
|
35
|
+
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
|
36
|
+
* MIT Licensed
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/*!
|
|
40
|
+
* Chai - expectTypes utility
|
|
41
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
42
|
+
* MIT Licensed
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/*!
|
|
46
|
+
* Chai - flag utility
|
|
47
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
48
|
+
* MIT Licensed
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/*!
|
|
52
|
+
* Chai - getActual utility
|
|
53
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
54
|
+
* MIT Licensed
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
/*!
|
|
58
|
+
* Chai - getOwnEnumerableProperties utility
|
|
59
|
+
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
|
60
|
+
* MIT Licensed
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/*!
|
|
64
|
+
* Chai - getOwnEnumerablePropertySymbols utility
|
|
65
|
+
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
|
66
|
+
* MIT Licensed
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/*!
|
|
70
|
+
* Chai - getProperties utility
|
|
71
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
72
|
+
* MIT Licensed
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
/*!
|
|
76
|
+
* Chai - isNaN utility
|
|
77
|
+
* Copyright(c) 2012-2015 Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
|
|
78
|
+
* MIT Licensed
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
/*!
|
|
82
|
+
* Chai - isProxyEnabled helper
|
|
83
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
84
|
+
* MIT Licensed
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
/*!
|
|
88
|
+
* Chai - message composition utility
|
|
89
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
90
|
+
* MIT Licensed
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/*!
|
|
94
|
+
* Chai - overwriteChainableMethod utility
|
|
95
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
96
|
+
* MIT Licensed
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
/*!
|
|
100
|
+
* Chai - overwriteMethod utility
|
|
101
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
102
|
+
* MIT Licensed
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
/*!
|
|
106
|
+
* Chai - overwriteProperty utility
|
|
107
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
108
|
+
* MIT Licensed
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
/*!
|
|
112
|
+
* Chai - proxify utility
|
|
113
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
114
|
+
* MIT Licensed
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
/*!
|
|
118
|
+
* Chai - test utility
|
|
119
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
120
|
+
* MIT Licensed
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
/*!
|
|
124
|
+
* Chai - transferFlags utility
|
|
125
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
126
|
+
* MIT Licensed
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
/*!
|
|
130
|
+
* chai
|
|
131
|
+
* Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>
|
|
132
|
+
* MIT Licensed
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
/*!
|
|
136
|
+
* chai
|
|
137
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
|
138
|
+
* MIT Licensed
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
/*!
|
|
142
|
+
* chai
|
|
143
|
+
* http://chaijs.com
|
|
144
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
|
145
|
+
* MIT Licensed
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
/*! Bundled license information:
|
|
149
|
+
|
|
150
|
+
deep-eql/index.js:
|
|
151
|
+
(*!
|
|
152
|
+
* deep-eql
|
|
153
|
+
* Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
|
|
154
|
+
* MIT Licensed
|
|
155
|
+
*)
|
|
156
|
+
(*!
|
|
157
|
+
* Check to see if the MemoizeMap has recorded a result of the two operands
|
|
158
|
+
*
|
|
159
|
+
* @param {Mixed} leftHandOperand
|
|
160
|
+
* @param {Mixed} rightHandOperand
|
|
161
|
+
* @param {MemoizeMap} memoizeMap
|
|
162
|
+
* @returns {Boolean|null} result
|
|
163
|
+
*)
|
|
164
|
+
(*!
|
|
165
|
+
* Set the result of the equality into the MemoizeMap
|
|
166
|
+
*
|
|
167
|
+
* @param {Mixed} leftHandOperand
|
|
168
|
+
* @param {Mixed} rightHandOperand
|
|
169
|
+
* @param {MemoizeMap} memoizeMap
|
|
170
|
+
* @param {Boolean} result
|
|
171
|
+
*)
|
|
172
|
+
(*!
|
|
173
|
+
* Primary Export
|
|
174
|
+
*)
|
|
175
|
+
(*!
|
|
176
|
+
* The main logic of the `deepEqual` function.
|
|
177
|
+
*
|
|
178
|
+
* @param {Mixed} leftHandOperand
|
|
179
|
+
* @param {Mixed} rightHandOperand
|
|
180
|
+
* @param {Object} [options] (optional) Additional options
|
|
181
|
+
* @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality.
|
|
182
|
+
* @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of
|
|
183
|
+
complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular
|
|
184
|
+
references to blow the stack.
|
|
185
|
+
* @return {Boolean} equal match
|
|
186
|
+
*)
|
|
187
|
+
(*!
|
|
188
|
+
* Compare two Regular Expressions for equality.
|
|
189
|
+
*
|
|
190
|
+
* @param {RegExp} leftHandOperand
|
|
191
|
+
* @param {RegExp} rightHandOperand
|
|
192
|
+
* @return {Boolean} result
|
|
193
|
+
*)
|
|
194
|
+
(*!
|
|
195
|
+
* Compare two Sets/Maps for equality. Faster than other equality functions.
|
|
196
|
+
*
|
|
197
|
+
* @param {Set} leftHandOperand
|
|
198
|
+
* @param {Set} rightHandOperand
|
|
199
|
+
* @param {Object} [options] (Optional)
|
|
200
|
+
* @return {Boolean} result
|
|
201
|
+
*)
|
|
202
|
+
(*!
|
|
203
|
+
* Simple equality for flat iterable objects such as Arrays, TypedArrays or Node.js buffers.
|
|
204
|
+
*
|
|
205
|
+
* @param {Iterable} leftHandOperand
|
|
206
|
+
* @param {Iterable} rightHandOperand
|
|
207
|
+
* @param {Object} [options] (Optional)
|
|
208
|
+
* @return {Boolean} result
|
|
209
|
+
*)
|
|
210
|
+
(*!
|
|
211
|
+
* Simple equality for generator objects such as those returned by generator functions.
|
|
212
|
+
*
|
|
213
|
+
* @param {Iterable} leftHandOperand
|
|
214
|
+
* @param {Iterable} rightHandOperand
|
|
215
|
+
* @param {Object} [options] (Optional)
|
|
216
|
+
* @return {Boolean} result
|
|
217
|
+
*)
|
|
218
|
+
(*!
|
|
219
|
+
* Determine if the given object has an @@iterator function.
|
|
220
|
+
*
|
|
221
|
+
* @param {Object} target
|
|
222
|
+
* @return {Boolean} `true` if the object has an @@iterator function.
|
|
223
|
+
*)
|
|
224
|
+
(*!
|
|
225
|
+
* Gets all iterator entries from the given Object. If the Object has no @@iterator function, returns an empty array.
|
|
226
|
+
* This will consume the iterator - which could have side effects depending on the @@iterator implementation.
|
|
227
|
+
*
|
|
228
|
+
* @param {Object} target
|
|
229
|
+
* @returns {Array} an array of entries from the @@iterator function
|
|
230
|
+
*)
|
|
231
|
+
(*!
|
|
232
|
+
* Gets all entries from a Generator. This will consume the generator - which could have side effects.
|
|
233
|
+
*
|
|
234
|
+
* @param {Generator} target
|
|
235
|
+
* @returns {Array} an array of entries from the Generator.
|
|
236
|
+
*)
|
|
237
|
+
(*!
|
|
238
|
+
* Gets all own and inherited enumerable keys from a target.
|
|
239
|
+
*
|
|
240
|
+
* @param {Object} target
|
|
241
|
+
* @returns {Array} an array of own and inherited enumerable keys from the target.
|
|
242
|
+
*)
|
|
243
|
+
(*!
|
|
244
|
+
* Determines if two objects have matching values, given a set of keys. Defers to deepEqual for the equality check of
|
|
245
|
+
* each key. If any value of the given key is not equal, the function will return false (early).
|
|
246
|
+
*
|
|
247
|
+
* @param {Mixed} leftHandOperand
|
|
248
|
+
* @param {Mixed} rightHandOperand
|
|
249
|
+
* @param {Array} keys An array of keys to compare the values of leftHandOperand and rightHandOperand against
|
|
250
|
+
* @param {Object} [options] (Optional)
|
|
251
|
+
* @return {Boolean} result
|
|
252
|
+
*)
|
|
253
|
+
(*!
|
|
254
|
+
* Recursively check the equality of two Objects. Once basic sameness has been established it will defer to `deepEqual`
|
|
255
|
+
* for each enumerable key in the object.
|
|
256
|
+
*
|
|
257
|
+
* @param {Mixed} leftHandOperand
|
|
258
|
+
* @param {Mixed} rightHandOperand
|
|
259
|
+
* @param {Object} [options] (Optional)
|
|
260
|
+
* @return {Boolean} result
|
|
261
|
+
*)
|
|
262
|
+
(*!
|
|
263
|
+
* Returns true if the argument is a primitive.
|
|
264
|
+
*
|
|
265
|
+
* This intentionally returns true for all objects that can be compared by reference,
|
|
266
|
+
* including functions and symbols.
|
|
267
|
+
*
|
|
268
|
+
* @param {Mixed} value
|
|
269
|
+
* @return {Boolean} result
|
|
270
|
+
*)
|
|
271
|
+
*/
|
|
272
|
+
|
|
9
273
|
/**
|
|
10
274
|
* @license React
|
|
11
275
|
* react-is.development.js
|
package/dist/0~691.js
CHANGED
|
@@ -9,26 +9,75 @@ export const __webpack_modules__ = {
|
|
|
9
9
|
__webpack_require__.d(__webpack_exports__, {
|
|
10
10
|
checkThresholds: ()=>checkThresholds
|
|
11
11
|
});
|
|
12
|
+
var pathe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs");
|
|
13
|
+
var picomatch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js");
|
|
14
|
+
var picomatch__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__.n(picomatch__WEBPACK_IMPORTED_MODULE_1__);
|
|
12
15
|
var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/utils/index.ts");
|
|
13
|
-
|
|
16
|
+
const THRESHOLD_KEYS = [
|
|
17
|
+
'lines',
|
|
18
|
+
'functions',
|
|
19
|
+
'statements',
|
|
20
|
+
'branches'
|
|
21
|
+
];
|
|
22
|
+
function checkThresholds({ coverageMap, thresholds, coverageProvider, rootPath }) {
|
|
14
23
|
if (!thresholds) return {
|
|
15
24
|
success: true,
|
|
16
25
|
message: ''
|
|
17
26
|
};
|
|
18
|
-
const summary = coverageMap.getCoverageSummary();
|
|
19
27
|
const failedThresholds = [];
|
|
20
|
-
const
|
|
28
|
+
const allFiles = coverageMap.files();
|
|
29
|
+
const thresholdGroup = [
|
|
30
|
+
{
|
|
31
|
+
statements: thresholds.statements,
|
|
32
|
+
functions: thresholds.functions,
|
|
33
|
+
branches: thresholds.branches,
|
|
34
|
+
lines: thresholds.lines,
|
|
35
|
+
name: 'global',
|
|
36
|
+
coverageMap,
|
|
37
|
+
perFile: false
|
|
38
|
+
}
|
|
39
|
+
];
|
|
40
|
+
for (const key of Object.keys(thresholds)){
|
|
41
|
+
if (THRESHOLD_KEYS.includes(key) || 'object' != typeof thresholds[key]) continue;
|
|
42
|
+
const globCoverageMap = coverageProvider.createCoverageMap();
|
|
43
|
+
const matcher = picomatch__WEBPACK_IMPORTED_MODULE_1___default()(key);
|
|
44
|
+
const matchedFiles = allFiles.filter((file)=>matcher((0, pathe__WEBPACK_IMPORTED_MODULE_2__.b)(rootPath, file)));
|
|
45
|
+
if (!matchedFiles.length) {
|
|
46
|
+
failedThresholds.push(`${_utils__WEBPACK_IMPORTED_MODULE_0__.yW.red('Error')}: coverage data for "${key}" was not found`);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
for (const file of matchedFiles){
|
|
50
|
+
const fileCoverage = coverageMap.fileCoverageFor(file);
|
|
51
|
+
globCoverageMap.addFileCoverage(fileCoverage);
|
|
52
|
+
}
|
|
53
|
+
thresholdGroup.push({
|
|
54
|
+
...thresholds[key],
|
|
55
|
+
name: key,
|
|
56
|
+
coverageMap: globCoverageMap
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const check = (name, type, actual, expected, file)=>{
|
|
60
|
+
let errorMsg = '';
|
|
21
61
|
if (void 0 !== expected) {
|
|
22
62
|
if (expected < 0) {
|
|
23
63
|
const uncovered = actual.total - actual.covered;
|
|
24
|
-
if (uncovered > -expected)
|
|
25
|
-
} else if (actual.pct < expected)
|
|
64
|
+
if (uncovered > -expected) errorMsg += `uncovered ${name} ${_utils__WEBPACK_IMPORTED_MODULE_0__.yW.red(`${uncovered}`)} exceeds maximum ${'global' === type ? 'global' : `"${type}"`} threshold allowed ${_utils__WEBPACK_IMPORTED_MODULE_0__.yW.yellow(`${-expected}`)}`;
|
|
65
|
+
} else if (actual.pct < expected) errorMsg += `coverage for ${name} ${_utils__WEBPACK_IMPORTED_MODULE_0__.yW.red(`${actual.pct}%`)} does not meet ${'global' === type ? 'global' : `"${type}"`} threshold ${_utils__WEBPACK_IMPORTED_MODULE_0__.yW.yellow(`${expected}%`)}`;
|
|
26
66
|
}
|
|
67
|
+
if (errorMsg) failedThresholds.push(`${_utils__WEBPACK_IMPORTED_MODULE_0__.yW.red('Error')}: ${file ? `${(0, pathe__WEBPACK_IMPORTED_MODULE_2__.b)(rootPath, file)} ` : ''}${errorMsg}`);
|
|
27
68
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
69
|
+
thresholdGroup.forEach(({ name, coverageMap, ...thresholds })=>{
|
|
70
|
+
const summaries = thresholds.perFile ? coverageMap.files().map((file)=>({
|
|
71
|
+
file,
|
|
72
|
+
summary: coverageMap.fileCoverageFor(file).toSummary()
|
|
73
|
+
})) : [
|
|
74
|
+
{
|
|
75
|
+
file: '',
|
|
76
|
+
summary: coverageMap.getCoverageSummary()
|
|
77
|
+
}
|
|
78
|
+
];
|
|
79
|
+
for (const { summary, file } of summaries)for (const key of THRESHOLD_KEYS)if (void 0 !== thresholds[key]) check(key, name, summary[key], thresholds[key], file);
|
|
80
|
+
});
|
|
32
81
|
return {
|
|
33
82
|
success: 0 === failedThresholds.length,
|
|
34
83
|
message: failedThresholds.join('\n')
|
|
@@ -2,13 +2,12 @@ import 'module';
|
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE_node_v8_d0df5498__ from "node:v8";
|
|
5
|
-
import * as __WEBPACK_EXTERNAL_MODULE_birpc__ from "birpc";
|
|
6
5
|
import * as __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__ from "node:events";
|
|
7
6
|
import * as __WEBPACK_EXTERNAL_MODULE_tinypool__ from "tinypool";
|
|
8
7
|
import * as __WEBPACK_EXTERNAL_MODULE_node_inspector_dd9822d6__ from "node:inspector";
|
|
9
|
-
export const __webpack_id__ = "
|
|
8
|
+
export const __webpack_id__ = "816";
|
|
10
9
|
export const __webpack_ids__ = [
|
|
11
|
-
"
|
|
10
|
+
"816"
|
|
12
11
|
];
|
|
13
12
|
export const __webpack_modules__ = {
|
|
14
13
|
"./src/core/rsbuild.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -17,7 +16,7 @@ export const __webpack_modules__ = {
|
|
|
17
16
|
zh: ()=>prepareRsbuild
|
|
18
17
|
});
|
|
19
18
|
var core_ = __webpack_require__("@rsbuild/core");
|
|
20
|
-
var
|
|
19
|
+
var dist = __webpack_require__("../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.mjs");
|
|
21
20
|
var utils = __webpack_require__("./src/utils/index.ts");
|
|
22
21
|
const RUNTIME_CHUNK_NAME = 'runtime';
|
|
23
22
|
const pluginBasic = (context)=>({
|
|
@@ -35,7 +34,8 @@ export const __webpack_modules__ = {
|
|
|
35
34
|
}, {
|
|
36
35
|
source: {
|
|
37
36
|
define: {
|
|
38
|
-
'import.meta.rstest': "global['@rstest/core']"
|
|
37
|
+
'import.meta.rstest': "global['@rstest/core']",
|
|
38
|
+
'import.meta.env': 'process.env'
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
output: {
|
|
@@ -59,7 +59,7 @@ export const __webpack_modules__ = {
|
|
|
59
59
|
injectModulePathName: true,
|
|
60
60
|
importMetaPathName: true,
|
|
61
61
|
hoistMockModule: true,
|
|
62
|
-
manualMockRoot:
|
|
62
|
+
manualMockRoot: dist.Ay.resolve(rootPath, '__mocks__')
|
|
63
63
|
}));
|
|
64
64
|
config.module.parser ??= {};
|
|
65
65
|
config.module.parser.javascript = {
|
|
@@ -167,7 +167,7 @@ export const __webpack_modules__ = {
|
|
|
167
167
|
config.watchOptions ??= {};
|
|
168
168
|
config.watchOptions.ignored = (0, utils.bg)(config.watchOptions.ignored || []);
|
|
169
169
|
if (0 === config.watchOptions.ignored.length) config.watchOptions.ignored.push('**/.git', '**/node_modules');
|
|
170
|
-
config.watchOptions.ignored.push(utils.EJ, '**/*.snap');
|
|
170
|
+
config.watchOptions.ignored.push(utils.EJ, context.normalizedConfig.coverage.reportsDirectory, '**/*.snap');
|
|
171
171
|
const configFilePath = context.projects.find((project)=>project.environmentName === environment.name)?.configFilePath;
|
|
172
172
|
if (configFilePath) config.watchOptions.ignored.push(configFilePath);
|
|
173
173
|
} else {
|
|
@@ -183,6 +183,7 @@ export const __webpack_modules__ = {
|
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
185
|
});
|
|
186
|
+
var external_node_module_ = __webpack_require__("node:module");
|
|
186
187
|
const autoExternalNodeModules = ({ context, request, dependencyType, getResolve }, callback)=>{
|
|
187
188
|
if (!request) return callback();
|
|
188
189
|
if (request.startsWith('@swc/helpers/')) return callback();
|
|
@@ -199,7 +200,7 @@ export const __webpack_modules__ = {
|
|
|
199
200
|
};
|
|
200
201
|
function autoExternalNodeBuiltin({ request, dependencyType }, callback) {
|
|
201
202
|
if (!request) return void callback();
|
|
202
|
-
const isNodeBuiltin = utils.
|
|
203
|
+
const isNodeBuiltin = (0, external_node_module_.isBuiltin)(request) || utils.Uq.some((builtin)=>{
|
|
203
204
|
if ('string' == typeof builtin) return builtin === request;
|
|
204
205
|
return builtin.test(request);
|
|
205
206
|
});
|
|
@@ -598,7 +599,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
598
599
|
const entries = Object.keys(manifest.entries);
|
|
599
600
|
for (const entry of entries){
|
|
600
601
|
const data = manifest.entries[entry];
|
|
601
|
-
entryFiles[entry] = ((data?.initial?.js || []).concat(data?.async?.js || []) || []).map((file)=>
|
|
602
|
+
entryFiles[entry] = ((data?.initial?.js || []).concat(data?.async?.js || []) || []).map((file)=>dist.Ay.join(outputPath, file));
|
|
602
603
|
}
|
|
603
604
|
return entryFiles;
|
|
604
605
|
};
|
|
@@ -622,7 +623,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
622
623
|
const sourceEntries = await globTestSourceEntries(environmentName);
|
|
623
624
|
for (const entry of Object.keys(entrypoints)){
|
|
624
625
|
const e = entrypoints[entry];
|
|
625
|
-
const distPath =
|
|
626
|
+
const distPath = dist.Ay.join(outputPath, e.assets[e.assets.length - 1].name);
|
|
626
627
|
if (setupFiles[environmentName][entry]) setupEntries.push({
|
|
627
628
|
distPath,
|
|
628
629
|
testPath: setupFiles[environmentName][entry],
|
|
@@ -641,7 +642,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
641
642
|
}
|
|
642
643
|
const inlineSourceMap = 'inline-source-map' === stats.compilation.options.devtool;
|
|
643
644
|
const sourceMaps = Object.fromEntries((await Promise.all(assets.map(async (asset)=>{
|
|
644
|
-
const assetFilePath =
|
|
645
|
+
const assetFilePath = dist.Ay.join(outputPath, asset.name);
|
|
645
646
|
if (inlineSourceMap) {
|
|
646
647
|
const content = await readFile(assetFilePath);
|
|
647
648
|
return [
|
|
@@ -651,7 +652,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
651
652
|
}
|
|
652
653
|
const sourceMapPath = asset?.info.related?.sourceMap?.[0];
|
|
653
654
|
if (sourceMapPath) {
|
|
654
|
-
const filePath =
|
|
655
|
+
const filePath = dist.Ay.join(outputPath, sourceMapPath);
|
|
655
656
|
const sourceMap = await readFile(filePath);
|
|
656
657
|
return [
|
|
657
658
|
assetFilePath,
|
|
@@ -673,7 +674,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
673
674
|
setupEntries,
|
|
674
675
|
buildTime: buildTime,
|
|
675
676
|
assetFiles: Object.fromEntries(await Promise.all(assets.map(async (a)=>{
|
|
676
|
-
const filePath =
|
|
677
|
+
const filePath = dist.Ay.join(outputPath, a.name);
|
|
677
678
|
return [
|
|
678
679
|
filePath,
|
|
679
680
|
await readFile(filePath)
|
|
@@ -696,9 +697,171 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
696
697
|
var external_node_os_ = __webpack_require__("node:os");
|
|
697
698
|
var utils = __webpack_require__("./src/utils/index.ts");
|
|
698
699
|
var external_node_url_ = __webpack_require__("node:url");
|
|
699
|
-
|
|
700
|
+
const TYPE_REQUEST = "q";
|
|
701
|
+
const TYPE_RESPONSE = "s";
|
|
702
|
+
const DEFAULT_TIMEOUT = 6e4;
|
|
703
|
+
function defaultSerialize(i) {
|
|
704
|
+
return i;
|
|
705
|
+
}
|
|
706
|
+
const defaultDeserialize = defaultSerialize;
|
|
707
|
+
const { clearTimeout: dist_clearTimeout, setTimeout: dist_setTimeout } = globalThis;
|
|
708
|
+
const random = Math.random.bind(Math);
|
|
709
|
+
function createBirpc(functions, options) {
|
|
710
|
+
const { post, on, off = ()=>{}, eventNames = [], serialize = defaultSerialize, deserialize = defaultDeserialize, resolver, bind = "rpc", timeout = DEFAULT_TIMEOUT } = options;
|
|
711
|
+
const rpcPromiseMap = /* @__PURE__ */ new Map();
|
|
712
|
+
let _promise;
|
|
713
|
+
let closed = false;
|
|
714
|
+
const rpc = new Proxy({}, {
|
|
715
|
+
get (_, method) {
|
|
716
|
+
if ("$functions" === method) return functions;
|
|
717
|
+
if ("$close" === method) return close;
|
|
718
|
+
if ("$rejectPendingCalls" === method) return rejectPendingCalls;
|
|
719
|
+
if ("$closed" === method) return closed;
|
|
720
|
+
if ("then" === method && !eventNames.includes("then") && !("then" in functions)) return;
|
|
721
|
+
const sendEvent = (...args)=>{
|
|
722
|
+
post(serialize({
|
|
723
|
+
m: method,
|
|
724
|
+
a: args,
|
|
725
|
+
t: TYPE_REQUEST
|
|
726
|
+
}));
|
|
727
|
+
};
|
|
728
|
+
if (eventNames.includes(method)) {
|
|
729
|
+
sendEvent.asEvent = sendEvent;
|
|
730
|
+
return sendEvent;
|
|
731
|
+
}
|
|
732
|
+
const sendCall = async (...args)=>{
|
|
733
|
+
if (closed) throw new Error(`[birpc] rpc is closed, cannot call "${method}"`);
|
|
734
|
+
if (_promise) try {
|
|
735
|
+
await _promise;
|
|
736
|
+
} finally{
|
|
737
|
+
_promise = void 0;
|
|
738
|
+
}
|
|
739
|
+
return new Promise((resolve, reject)=>{
|
|
740
|
+
const id = nanoid();
|
|
741
|
+
let timeoutId;
|
|
742
|
+
if (timeout >= 0) {
|
|
743
|
+
timeoutId = dist_setTimeout(()=>{
|
|
744
|
+
try {
|
|
745
|
+
const handleResult = options.onTimeoutError?.(method, args);
|
|
746
|
+
if (true !== handleResult) throw new Error(`[birpc] timeout on calling "${method}"`);
|
|
747
|
+
} catch (e) {
|
|
748
|
+
reject(e);
|
|
749
|
+
}
|
|
750
|
+
rpcPromiseMap.delete(id);
|
|
751
|
+
}, timeout);
|
|
752
|
+
if ("object" == typeof timeoutId) timeoutId = timeoutId.unref?.();
|
|
753
|
+
}
|
|
754
|
+
rpcPromiseMap.set(id, {
|
|
755
|
+
resolve,
|
|
756
|
+
reject,
|
|
757
|
+
timeoutId,
|
|
758
|
+
method
|
|
759
|
+
});
|
|
760
|
+
post(serialize({
|
|
761
|
+
m: method,
|
|
762
|
+
a: args,
|
|
763
|
+
i: id,
|
|
764
|
+
t: "q"
|
|
765
|
+
}));
|
|
766
|
+
});
|
|
767
|
+
};
|
|
768
|
+
sendCall.asEvent = sendEvent;
|
|
769
|
+
return sendCall;
|
|
770
|
+
}
|
|
771
|
+
});
|
|
772
|
+
function close(customError) {
|
|
773
|
+
closed = true;
|
|
774
|
+
rpcPromiseMap.forEach(({ reject, method })=>{
|
|
775
|
+
const error = new Error(`[birpc] rpc is closed, cannot call "${method}"`);
|
|
776
|
+
if (customError) {
|
|
777
|
+
customError.cause ??= error;
|
|
778
|
+
return reject(customError);
|
|
779
|
+
}
|
|
780
|
+
reject(error);
|
|
781
|
+
});
|
|
782
|
+
rpcPromiseMap.clear();
|
|
783
|
+
off(onMessage);
|
|
784
|
+
}
|
|
785
|
+
function rejectPendingCalls(handler) {
|
|
786
|
+
const entries = Array.from(rpcPromiseMap.values());
|
|
787
|
+
const handlerResults = entries.map(({ method, reject })=>{
|
|
788
|
+
if (!handler) return reject(new Error(`[birpc]: rejected pending call "${method}".`));
|
|
789
|
+
return handler({
|
|
790
|
+
method,
|
|
791
|
+
reject
|
|
792
|
+
});
|
|
793
|
+
});
|
|
794
|
+
rpcPromiseMap.clear();
|
|
795
|
+
return handlerResults;
|
|
796
|
+
}
|
|
797
|
+
async function onMessage(data, ...extra) {
|
|
798
|
+
let msg;
|
|
799
|
+
try {
|
|
800
|
+
msg = deserialize(data);
|
|
801
|
+
} catch (e) {
|
|
802
|
+
if (options.onGeneralError?.(e) !== true) throw e;
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
if (msg.t === TYPE_REQUEST) {
|
|
806
|
+
const { m: method, a: args } = msg;
|
|
807
|
+
let result, error;
|
|
808
|
+
const fn = resolver ? resolver(method, functions[method]) : functions[method];
|
|
809
|
+
if (fn) try {
|
|
810
|
+
result = await fn.apply("rpc" === bind ? rpc : functions, args);
|
|
811
|
+
} catch (e) {
|
|
812
|
+
error = e;
|
|
813
|
+
}
|
|
814
|
+
else error = new Error(`[birpc] function "${method}" not found`);
|
|
815
|
+
if (msg.i) {
|
|
816
|
+
if (error && options.onError) options.onError(error, method, args);
|
|
817
|
+
if (error && options.onFunctionError) {
|
|
818
|
+
if (true === options.onFunctionError(error, method, args)) return;
|
|
819
|
+
}
|
|
820
|
+
if (!error) try {
|
|
821
|
+
post(serialize({
|
|
822
|
+
t: TYPE_RESPONSE,
|
|
823
|
+
i: msg.i,
|
|
824
|
+
r: result
|
|
825
|
+
}), ...extra);
|
|
826
|
+
return;
|
|
827
|
+
} catch (e) {
|
|
828
|
+
error = e;
|
|
829
|
+
if (options.onGeneralError?.(e, method, args) !== true) throw e;
|
|
830
|
+
}
|
|
831
|
+
try {
|
|
832
|
+
post(serialize({
|
|
833
|
+
t: TYPE_RESPONSE,
|
|
834
|
+
i: msg.i,
|
|
835
|
+
e: error
|
|
836
|
+
}), ...extra);
|
|
837
|
+
} catch (e) {
|
|
838
|
+
if (options.onGeneralError?.(e, method, args) !== true) throw e;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
} else {
|
|
842
|
+
const { i: ack, r: result, e: error } = msg;
|
|
843
|
+
const promise = rpcPromiseMap.get(ack);
|
|
844
|
+
if (promise) {
|
|
845
|
+
dist_clearTimeout(promise.timeoutId);
|
|
846
|
+
if (error) promise.reject(error);
|
|
847
|
+
else promise.resolve(result);
|
|
848
|
+
}
|
|
849
|
+
rpcPromiseMap.delete(ack);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
_promise = on(onMessage);
|
|
853
|
+
return rpc;
|
|
854
|
+
}
|
|
855
|
+
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
856
|
+
function nanoid(size = 21) {
|
|
857
|
+
let id = "";
|
|
858
|
+
let i = size;
|
|
859
|
+
while(i--)id += urlAlphabet[64 * random() | 0];
|
|
860
|
+
return id;
|
|
861
|
+
}
|
|
862
|
+
var pathe_M_eThtNZ = __webpack_require__("../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs");
|
|
700
863
|
const forks_filename = (0, external_node_url_.fileURLToPath)(import.meta.url);
|
|
701
|
-
const forks_dirname = (0,
|
|
864
|
+
const forks_dirname = (0, pathe_M_eThtNZ.d)(forks_filename);
|
|
702
865
|
function createChannel(rpcMethods) {
|
|
703
866
|
const emitter = new __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__["default"]();
|
|
704
867
|
const cleanup = ()=>emitter.removeAllListeners();
|
|
@@ -714,7 +877,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
714
877
|
emitter.emit(events.response, message);
|
|
715
878
|
}
|
|
716
879
|
};
|
|
717
|
-
|
|
880
|
+
createBirpc(rpcMethods, {
|
|
718
881
|
serialize: __WEBPACK_EXTERNAL_MODULE_node_v8_d0df5498__["default"].serialize,
|
|
719
882
|
deserialize: (v)=>__WEBPACK_EXTERNAL_MODULE_node_v8_d0df5498__["default"].deserialize(Buffer.from(v)),
|
|
720
883
|
post (v) {
|
|
@@ -733,7 +896,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
733
896
|
const { maxWorkers: maxThreads, minWorkers: minThreads, env, execArgv = [], isolate = true } = poolOptions;
|
|
734
897
|
const options = {
|
|
735
898
|
runtime: 'child_process',
|
|
736
|
-
filename: (0,
|
|
899
|
+
filename: (0, pathe_M_eThtNZ.r)(forks_dirname, './worker.js'),
|
|
737
900
|
env,
|
|
738
901
|
execArgv,
|
|
739
902
|
maxThreads,
|
|
@@ -778,7 +941,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
778
941
|
return parsed > 0 ? parsed : 1;
|
|
779
942
|
};
|
|
780
943
|
const getRuntimeConfig = (context)=>{
|
|
781
|
-
const { testNamePattern, testTimeout, passWithNoTests, retry, globals, clearMocks, resetMocks, restoreMocks, unstubEnvs, unstubGlobals, maxConcurrency, printConsoleTrace, disableConsoleIntercept, testEnvironment, hookTimeout, isolate, coverage } = context.normalizedConfig;
|
|
944
|
+
const { testNamePattern, testTimeout, passWithNoTests, retry, globals, clearMocks, resetMocks, restoreMocks, unstubEnvs, unstubGlobals, maxConcurrency, printConsoleTrace, disableConsoleIntercept, testEnvironment, hookTimeout, isolate, coverage, snapshotFormat } = context.normalizedConfig;
|
|
782
945
|
return {
|
|
783
946
|
testNamePattern,
|
|
784
947
|
testTimeout,
|
|
@@ -796,7 +959,8 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
796
959
|
disableConsoleIntercept,
|
|
797
960
|
testEnvironment,
|
|
798
961
|
isolate,
|
|
799
|
-
coverage
|
|
962
|
+
coverage,
|
|
963
|
+
snapshotFormat
|
|
800
964
|
};
|
|
801
965
|
};
|
|
802
966
|
const filterAssetsByEntry = (entryInfo, assetFiles, setupAssets, sourceMaps, entryLength)=>{
|