@rstest/core 0.4.0 → 0.5.0
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 +18 -19
- package/dist/0~33.js +10 -20
- package/dist/0~493.js +0 -21
- package/dist/0~603.js +5 -2
- 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} +179 -17
- package/dist/0~85.js +20 -45
- package/dist/{0~669.js → 0~876.js} +24 -20
- package/dist/{0~120.js → 0~908.js} +333 -5
- package/dist/0~928.js +1 -1
- package/dist/0~967.js +1 -1
- package/dist/0~969.js +1 -1
- package/dist/0~971.js +2 -2
- package/dist/index.js +566 -57
- package/dist/worker.js +674 -22
- package/dist-types/index.d.ts +241 -20
- package/dist-types/worker.d.ts +221 -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 = {
|
|
@@ -106,7 +106,7 @@ export const __webpack_modules__ = {
|
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
-
var external_node_path_ = __webpack_require__("
|
|
109
|
+
var external_node_path_ = __webpack_require__("path");
|
|
110
110
|
var external_node_url_ = __webpack_require__("node:url");
|
|
111
111
|
const PLUGIN_CSS_FILTER = 'rstest:css-filter';
|
|
112
112
|
const css_filter_dirname = external_node_path_["default"].dirname((0, external_node_url_.fileURLToPath)(import.meta.url));
|
|
@@ -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 {
|
|
@@ -598,7 +598,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
598
598
|
const entries = Object.keys(manifest.entries);
|
|
599
599
|
for (const entry of entries){
|
|
600
600
|
const data = manifest.entries[entry];
|
|
601
|
-
entryFiles[entry] = ((data?.initial?.js || []).concat(data?.async?.js || []) || []).map((file)=>
|
|
601
|
+
entryFiles[entry] = ((data?.initial?.js || []).concat(data?.async?.js || []) || []).map((file)=>dist.Ay.join(outputPath, file));
|
|
602
602
|
}
|
|
603
603
|
return entryFiles;
|
|
604
604
|
};
|
|
@@ -622,7 +622,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
622
622
|
const sourceEntries = await globTestSourceEntries(environmentName);
|
|
623
623
|
for (const entry of Object.keys(entrypoints)){
|
|
624
624
|
const e = entrypoints[entry];
|
|
625
|
-
const distPath =
|
|
625
|
+
const distPath = dist.Ay.join(outputPath, e.assets[e.assets.length - 1].name);
|
|
626
626
|
if (setupFiles[environmentName][entry]) setupEntries.push({
|
|
627
627
|
distPath,
|
|
628
628
|
testPath: setupFiles[environmentName][entry],
|
|
@@ -641,7 +641,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
641
641
|
}
|
|
642
642
|
const inlineSourceMap = 'inline-source-map' === stats.compilation.options.devtool;
|
|
643
643
|
const sourceMaps = Object.fromEntries((await Promise.all(assets.map(async (asset)=>{
|
|
644
|
-
const assetFilePath =
|
|
644
|
+
const assetFilePath = dist.Ay.join(outputPath, asset.name);
|
|
645
645
|
if (inlineSourceMap) {
|
|
646
646
|
const content = await readFile(assetFilePath);
|
|
647
647
|
return [
|
|
@@ -651,7 +651,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
651
651
|
}
|
|
652
652
|
const sourceMapPath = asset?.info.related?.sourceMap?.[0];
|
|
653
653
|
if (sourceMapPath) {
|
|
654
|
-
const filePath =
|
|
654
|
+
const filePath = dist.Ay.join(outputPath, sourceMapPath);
|
|
655
655
|
const sourceMap = await readFile(filePath);
|
|
656
656
|
return [
|
|
657
657
|
assetFilePath,
|
|
@@ -673,7 +673,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
673
673
|
setupEntries,
|
|
674
674
|
buildTime: buildTime,
|
|
675
675
|
assetFiles: Object.fromEntries(await Promise.all(assets.map(async (a)=>{
|
|
676
|
-
const filePath =
|
|
676
|
+
const filePath = dist.Ay.join(outputPath, a.name);
|
|
677
677
|
return [
|
|
678
678
|
filePath,
|
|
679
679
|
await readFile(filePath)
|
|
@@ -696,9 +696,171 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
696
696
|
var external_node_os_ = __webpack_require__("node:os");
|
|
697
697
|
var utils = __webpack_require__("./src/utils/index.ts");
|
|
698
698
|
var external_node_url_ = __webpack_require__("node:url");
|
|
699
|
-
|
|
699
|
+
const TYPE_REQUEST = "q";
|
|
700
|
+
const TYPE_RESPONSE = "s";
|
|
701
|
+
const DEFAULT_TIMEOUT = 6e4;
|
|
702
|
+
function defaultSerialize(i) {
|
|
703
|
+
return i;
|
|
704
|
+
}
|
|
705
|
+
const defaultDeserialize = defaultSerialize;
|
|
706
|
+
const { clearTimeout: dist_clearTimeout, setTimeout: dist_setTimeout } = globalThis;
|
|
707
|
+
const random = Math.random.bind(Math);
|
|
708
|
+
function createBirpc(functions, options) {
|
|
709
|
+
const { post, on, off = ()=>{}, eventNames = [], serialize = defaultSerialize, deserialize = defaultDeserialize, resolver, bind = "rpc", timeout = DEFAULT_TIMEOUT } = options;
|
|
710
|
+
const rpcPromiseMap = /* @__PURE__ */ new Map();
|
|
711
|
+
let _promise;
|
|
712
|
+
let closed = false;
|
|
713
|
+
const rpc = new Proxy({}, {
|
|
714
|
+
get (_, method) {
|
|
715
|
+
if ("$functions" === method) return functions;
|
|
716
|
+
if ("$close" === method) return close;
|
|
717
|
+
if ("$rejectPendingCalls" === method) return rejectPendingCalls;
|
|
718
|
+
if ("$closed" === method) return closed;
|
|
719
|
+
if ("then" === method && !eventNames.includes("then") && !("then" in functions)) return;
|
|
720
|
+
const sendEvent = (...args)=>{
|
|
721
|
+
post(serialize({
|
|
722
|
+
m: method,
|
|
723
|
+
a: args,
|
|
724
|
+
t: TYPE_REQUEST
|
|
725
|
+
}));
|
|
726
|
+
};
|
|
727
|
+
if (eventNames.includes(method)) {
|
|
728
|
+
sendEvent.asEvent = sendEvent;
|
|
729
|
+
return sendEvent;
|
|
730
|
+
}
|
|
731
|
+
const sendCall = async (...args)=>{
|
|
732
|
+
if (closed) throw new Error(`[birpc] rpc is closed, cannot call "${method}"`);
|
|
733
|
+
if (_promise) try {
|
|
734
|
+
await _promise;
|
|
735
|
+
} finally{
|
|
736
|
+
_promise = void 0;
|
|
737
|
+
}
|
|
738
|
+
return new Promise((resolve, reject)=>{
|
|
739
|
+
const id = nanoid();
|
|
740
|
+
let timeoutId;
|
|
741
|
+
if (timeout >= 0) {
|
|
742
|
+
timeoutId = dist_setTimeout(()=>{
|
|
743
|
+
try {
|
|
744
|
+
const handleResult = options.onTimeoutError?.(method, args);
|
|
745
|
+
if (true !== handleResult) throw new Error(`[birpc] timeout on calling "${method}"`);
|
|
746
|
+
} catch (e) {
|
|
747
|
+
reject(e);
|
|
748
|
+
}
|
|
749
|
+
rpcPromiseMap.delete(id);
|
|
750
|
+
}, timeout);
|
|
751
|
+
if ("object" == typeof timeoutId) timeoutId = timeoutId.unref?.();
|
|
752
|
+
}
|
|
753
|
+
rpcPromiseMap.set(id, {
|
|
754
|
+
resolve,
|
|
755
|
+
reject,
|
|
756
|
+
timeoutId,
|
|
757
|
+
method
|
|
758
|
+
});
|
|
759
|
+
post(serialize({
|
|
760
|
+
m: method,
|
|
761
|
+
a: args,
|
|
762
|
+
i: id,
|
|
763
|
+
t: "q"
|
|
764
|
+
}));
|
|
765
|
+
});
|
|
766
|
+
};
|
|
767
|
+
sendCall.asEvent = sendEvent;
|
|
768
|
+
return sendCall;
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
function close(customError) {
|
|
772
|
+
closed = true;
|
|
773
|
+
rpcPromiseMap.forEach(({ reject, method })=>{
|
|
774
|
+
const error = new Error(`[birpc] rpc is closed, cannot call "${method}"`);
|
|
775
|
+
if (customError) {
|
|
776
|
+
customError.cause ??= error;
|
|
777
|
+
return reject(customError);
|
|
778
|
+
}
|
|
779
|
+
reject(error);
|
|
780
|
+
});
|
|
781
|
+
rpcPromiseMap.clear();
|
|
782
|
+
off(onMessage);
|
|
783
|
+
}
|
|
784
|
+
function rejectPendingCalls(handler) {
|
|
785
|
+
const entries = Array.from(rpcPromiseMap.values());
|
|
786
|
+
const handlerResults = entries.map(({ method, reject })=>{
|
|
787
|
+
if (!handler) return reject(new Error(`[birpc]: rejected pending call "${method}".`));
|
|
788
|
+
return handler({
|
|
789
|
+
method,
|
|
790
|
+
reject
|
|
791
|
+
});
|
|
792
|
+
});
|
|
793
|
+
rpcPromiseMap.clear();
|
|
794
|
+
return handlerResults;
|
|
795
|
+
}
|
|
796
|
+
async function onMessage(data, ...extra) {
|
|
797
|
+
let msg;
|
|
798
|
+
try {
|
|
799
|
+
msg = deserialize(data);
|
|
800
|
+
} catch (e) {
|
|
801
|
+
if (options.onGeneralError?.(e) !== true) throw e;
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
if (msg.t === TYPE_REQUEST) {
|
|
805
|
+
const { m: method, a: args } = msg;
|
|
806
|
+
let result, error;
|
|
807
|
+
const fn = resolver ? resolver(method, functions[method]) : functions[method];
|
|
808
|
+
if (fn) try {
|
|
809
|
+
result = await fn.apply("rpc" === bind ? rpc : functions, args);
|
|
810
|
+
} catch (e) {
|
|
811
|
+
error = e;
|
|
812
|
+
}
|
|
813
|
+
else error = new Error(`[birpc] function "${method}" not found`);
|
|
814
|
+
if (msg.i) {
|
|
815
|
+
if (error && options.onError) options.onError(error, method, args);
|
|
816
|
+
if (error && options.onFunctionError) {
|
|
817
|
+
if (true === options.onFunctionError(error, method, args)) return;
|
|
818
|
+
}
|
|
819
|
+
if (!error) try {
|
|
820
|
+
post(serialize({
|
|
821
|
+
t: TYPE_RESPONSE,
|
|
822
|
+
i: msg.i,
|
|
823
|
+
r: result
|
|
824
|
+
}), ...extra);
|
|
825
|
+
return;
|
|
826
|
+
} catch (e) {
|
|
827
|
+
error = e;
|
|
828
|
+
if (options.onGeneralError?.(e, method, args) !== true) throw e;
|
|
829
|
+
}
|
|
830
|
+
try {
|
|
831
|
+
post(serialize({
|
|
832
|
+
t: TYPE_RESPONSE,
|
|
833
|
+
i: msg.i,
|
|
834
|
+
e: error
|
|
835
|
+
}), ...extra);
|
|
836
|
+
} catch (e) {
|
|
837
|
+
if (options.onGeneralError?.(e, method, args) !== true) throw e;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
} else {
|
|
841
|
+
const { i: ack, r: result, e: error } = msg;
|
|
842
|
+
const promise = rpcPromiseMap.get(ack);
|
|
843
|
+
if (promise) {
|
|
844
|
+
dist_clearTimeout(promise.timeoutId);
|
|
845
|
+
if (error) promise.reject(error);
|
|
846
|
+
else promise.resolve(result);
|
|
847
|
+
}
|
|
848
|
+
rpcPromiseMap.delete(ack);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
_promise = on(onMessage);
|
|
852
|
+
return rpc;
|
|
853
|
+
}
|
|
854
|
+
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
855
|
+
function nanoid(size = 21) {
|
|
856
|
+
let id = "";
|
|
857
|
+
let i = size;
|
|
858
|
+
while(i--)id += urlAlphabet[64 * random() | 0];
|
|
859
|
+
return id;
|
|
860
|
+
}
|
|
861
|
+
var pathe_M_eThtNZ = __webpack_require__("../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs");
|
|
700
862
|
const forks_filename = (0, external_node_url_.fileURLToPath)(import.meta.url);
|
|
701
|
-
const forks_dirname = (0,
|
|
863
|
+
const forks_dirname = (0, pathe_M_eThtNZ.d)(forks_filename);
|
|
702
864
|
function createChannel(rpcMethods) {
|
|
703
865
|
const emitter = new __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__["default"]();
|
|
704
866
|
const cleanup = ()=>emitter.removeAllListeners();
|
|
@@ -714,7 +876,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
714
876
|
emitter.emit(events.response, message);
|
|
715
877
|
}
|
|
716
878
|
};
|
|
717
|
-
|
|
879
|
+
createBirpc(rpcMethods, {
|
|
718
880
|
serialize: __WEBPACK_EXTERNAL_MODULE_node_v8_d0df5498__["default"].serialize,
|
|
719
881
|
deserialize: (v)=>__WEBPACK_EXTERNAL_MODULE_node_v8_d0df5498__["default"].deserialize(Buffer.from(v)),
|
|
720
882
|
post (v) {
|
|
@@ -733,7 +895,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
733
895
|
const { maxWorkers: maxThreads, minWorkers: minThreads, env, execArgv = [], isolate = true } = poolOptions;
|
|
734
896
|
const options = {
|
|
735
897
|
runtime: 'child_process',
|
|
736
|
-
filename: (0,
|
|
898
|
+
filename: (0, pathe_M_eThtNZ.r)(forks_dirname, './worker.js'),
|
|
737
899
|
env,
|
|
738
900
|
execArgv,
|
|
739
901
|
maxThreads,
|