@rstest/core 0.0.3 → 0.0.5
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 +2 -2
- package/README.md +9 -1
- package/dist/285.js +2 -1
- package/dist/353.js +6 -5
- package/dist/355.js +1 -1
- package/dist/{992.js → 612.js} +225 -35
- package/dist/629.js +1 -0
- package/dist/{973.js → 723.js} +33 -28
- package/dist/813.js +1 -1
- package/dist/867.js +10 -4
- package/dist/cli.js +87 -9
- package/dist/cssFilterLoader.mjs +22 -0
- package/dist/worker.js +112 -42
- package/dist-types/node.d.ts +18 -7
- package/dist-types/public.d.ts +37 -28
- package/dist-types/worker.d.ts +16 -5
- package/package.json +7 -6
package/LICENSE
CHANGED
|
@@ -139,9 +139,9 @@ Licensed under MIT license in the repository at https://github.com/jestjs/jest.g
|
|
|
139
139
|
|
|
140
140
|
### @jridgewell/trace-mapping
|
|
141
141
|
|
|
142
|
-
Licensed under MIT license in the repository at git+https://github.com/jridgewell/
|
|
142
|
+
Licensed under MIT license in the repository at git+https://github.com/jridgewell/sourcemaps.git.
|
|
143
143
|
|
|
144
|
-
> Copyright
|
|
144
|
+
> Copyright 2024 Justin Ridgewell <justin@ridgewell.name>
|
|
145
145
|
>
|
|
146
146
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
147
147
|
> of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
Rstest is a testing framework powered by Rspack.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Documentation
|
|
10
|
+
|
|
11
|
+
See [Documentation](https://rstest.rs).
|
|
12
|
+
|
|
13
|
+
## Contributing
|
|
14
|
+
|
|
15
|
+
Please read the [Contributing Guide](https://github.com/web-infra-dev/rstest/blob/main/CONTRIBUTING.md).
|
|
16
|
+
|
|
17
|
+
## License
|
|
10
18
|
|
|
11
19
|
Rstest is licensed under the [MIT License](https://github.com/web-infra-dev/rstest/blob/main/LICENSE).
|
package/dist/285.js
CHANGED
|
@@ -26,6 +26,7 @@ export const __webpack_modules__ = {
|
|
|
26
26
|
const getRsbuildStats = await (0, _rsbuild__WEBPACK_IMPORTED_MODULE_4__.r)({
|
|
27
27
|
name,
|
|
28
28
|
globTestSourceEntries,
|
|
29
|
+
normalizedConfig: context.normalizedConfig,
|
|
29
30
|
setupFiles,
|
|
30
31
|
rsbuildInstance,
|
|
31
32
|
rootPath
|
|
@@ -54,7 +55,7 @@ export const __webpack_modules__ = {
|
|
|
54
55
|
const hasError = list.some((file)=>file.errors?.length);
|
|
55
56
|
if (hasError) {
|
|
56
57
|
const { printError } = await Promise.all([
|
|
57
|
-
__webpack_require__.e("
|
|
58
|
+
__webpack_require__.e("723"),
|
|
58
59
|
__webpack_require__.e("355")
|
|
59
60
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/utils/error.ts"));
|
|
60
61
|
process.exitCode = 1;
|
package/dist/353.js
CHANGED
|
@@ -323,7 +323,7 @@ export const __webpack_modules__ = {
|
|
|
323
323
|
utils.kg.log(`${utils.$_.bgRed(' FAIL ')} ${(0, utils.aj)(relativePath)} ${nameStr.length ? `${utils.$_.dim(utils.Qd)} ${nameStr}` : ''}`);
|
|
324
324
|
if (test.errors) {
|
|
325
325
|
const { printError } = await Promise.all([
|
|
326
|
-
__webpack_require__.e("
|
|
326
|
+
__webpack_require__.e("723"),
|
|
327
327
|
__webpack_require__.e("355")
|
|
328
328
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/utils/error.ts"));
|
|
329
329
|
for (const error of test.errors)await printError(error, getSourcemap, rootPath);
|
|
@@ -374,7 +374,8 @@ export const __webpack_modules__ = {
|
|
|
374
374
|
const icon = isSlowCase && 'pass' === result.status ? utils.$_.yellow(statusStr[result.status]) : statusColorfulStr[result.status];
|
|
375
375
|
const nameStr = (0, utils.Yz)(result);
|
|
376
376
|
const duration = void 0 !== result.duration ? ` (${(0, utils.AS)(result.duration, false)})` : '';
|
|
377
|
-
|
|
377
|
+
const retry = result.retryCount ? utils.$_.yellow(` (retry x${result.retryCount})`) : '';
|
|
378
|
+
console.log(` ${icon} ${nameStr}${utils.$_.gray(duration)}${retry}`);
|
|
378
379
|
if (result.errors) for (const error of result.errors)console.error(utils.$_.red(` ${error.message}`));
|
|
379
380
|
}
|
|
380
381
|
}
|
|
@@ -451,7 +452,7 @@ export const __webpack_modules__ = {
|
|
|
451
452
|
});
|
|
452
453
|
return {
|
|
453
454
|
command,
|
|
454
|
-
version: "0.0.
|
|
455
|
+
version: "0.0.5",
|
|
455
456
|
rootPath,
|
|
456
457
|
reporters,
|
|
457
458
|
snapshotManager,
|
|
@@ -466,14 +467,14 @@ export const __webpack_modules__ = {
|
|
|
466
467
|
}, config);
|
|
467
468
|
const runTests = async ()=>{
|
|
468
469
|
const { runTests } = await Promise.all([
|
|
469
|
-
__webpack_require__.e("
|
|
470
|
+
__webpack_require__.e("612"),
|
|
470
471
|
__webpack_require__.e("629")
|
|
471
472
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/core/runTests.ts"));
|
|
472
473
|
await runTests(context, fileFilters);
|
|
473
474
|
};
|
|
474
475
|
const listTests = async (options)=>{
|
|
475
476
|
const { listTests } = await Promise.all([
|
|
476
|
-
__webpack_require__.e("
|
|
477
|
+
__webpack_require__.e("612"),
|
|
477
478
|
__webpack_require__.e("285")
|
|
478
479
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/core/listTests.ts"));
|
|
479
480
|
await listTests(context, fileFilters, options);
|
package/dist/355.js
CHANGED
|
@@ -7,7 +7,7 @@ export const __webpack_modules__ = {
|
|
|
7
7
|
printError: ()=>printError
|
|
8
8
|
});
|
|
9
9
|
var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:fs");
|
|
10
|
-
var _jridgewell_trace_mapping__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.
|
|
10
|
+
var _jridgewell_trace_mapping__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.29/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs");
|
|
11
11
|
var stacktrace_parser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/stacktrace-parser@0.1.11/node_modules/stacktrace-parser/dist/stack-trace-parser.esm.js");
|
|
12
12
|
var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/index.ts");
|
|
13
13
|
async function printError(error, getSourcemap, rootPath) {
|
package/dist/{992.js → 612.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const __webpack_ids__ = [
|
|
2
|
-
"
|
|
2
|
+
"612"
|
|
3
3
|
];
|
|
4
4
|
export const __webpack_modules__ = {
|
|
5
5
|
"./src/core/rsbuild.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -11,6 +11,38 @@ export const __webpack_modules__ = {
|
|
|
11
11
|
var core_ = __webpack_require__("@rsbuild/core");
|
|
12
12
|
var external_pathe_ = __webpack_require__("pathe");
|
|
13
13
|
var utils = __webpack_require__("./src/utils/index.ts");
|
|
14
|
+
var external_node_path_ = __webpack_require__("node:path");
|
|
15
|
+
var external_node_url_ = __webpack_require__("node:url");
|
|
16
|
+
const PLUGIN_CSS_FILTER = 'rstest:css-filter';
|
|
17
|
+
const css_filter_dirname = external_node_path_["default"].dirname((0, external_node_url_.fileURLToPath)(import.meta.url));
|
|
18
|
+
const pluginCSSFilter = ()=>({
|
|
19
|
+
name: PLUGIN_CSS_FILTER,
|
|
20
|
+
setup (api) {
|
|
21
|
+
api.modifyBundlerChain({
|
|
22
|
+
order: 'post',
|
|
23
|
+
handler: async (chain, { target, CHAIN_ID, environment })=>{
|
|
24
|
+
const emitCss = environment.config.output.emitCss ?? 'web' === target;
|
|
25
|
+
if (!emitCss) {
|
|
26
|
+
const ruleIds = [
|
|
27
|
+
CHAIN_ID.RULE.CSS,
|
|
28
|
+
CHAIN_ID.RULE.SASS,
|
|
29
|
+
CHAIN_ID.RULE.LESS,
|
|
30
|
+
CHAIN_ID.RULE.STYLUS
|
|
31
|
+
];
|
|
32
|
+
for (const ruleId of ruleIds){
|
|
33
|
+
if (!chain.module.rules.has(ruleId)) continue;
|
|
34
|
+
const rule = chain.module.rule(ruleId);
|
|
35
|
+
if (!rule.uses.has(CHAIN_ID.USE.CSS)) continue;
|
|
36
|
+
const cssLoaderOptions = rule.use(CHAIN_ID.USE.CSS).get('options');
|
|
37
|
+
if (cssLoaderOptions.modules && ('object' != typeof cssLoaderOptions.modules || false !== cssLoaderOptions.modules.auto)) rule.use('rstest-css-pre-filter').loader(external_node_path_["default"].join(css_filter_dirname, 'cssFilterLoader.mjs')).options({
|
|
38
|
+
modules: cssLoaderOptions.modules
|
|
39
|
+
}).after(ruleId);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
14
46
|
class TestFileWatchPlugin {
|
|
15
47
|
contextToWatch = null;
|
|
16
48
|
constructor(contextToWatch){
|
|
@@ -47,8 +79,8 @@ export const __webpack_modules__ = {
|
|
|
47
79
|
config.watchOptions.ignored = '**/**';
|
|
48
80
|
const sourceEntries = await globTestSourceEntries();
|
|
49
81
|
config.entry = {
|
|
50
|
-
...
|
|
51
|
-
...
|
|
82
|
+
...setupFiles,
|
|
83
|
+
...sourceEntries
|
|
52
84
|
};
|
|
53
85
|
}
|
|
54
86
|
});
|
|
@@ -73,12 +105,155 @@ export const __webpack_modules__ = {
|
|
|
73
105
|
});
|
|
74
106
|
}
|
|
75
107
|
};
|
|
108
|
+
class MockRuntimeRspackPlugin {
|
|
109
|
+
apply(compiler) {
|
|
110
|
+
const { RuntimeModule } = compiler.webpack;
|
|
111
|
+
class RetestImportRuntimeModule extends RuntimeModule {
|
|
112
|
+
constructor(){
|
|
113
|
+
super('rstest runtime');
|
|
114
|
+
}
|
|
115
|
+
generate() {
|
|
116
|
+
return `
|
|
117
|
+
if (typeof __webpack_require__ === 'undefined') {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const originalRequire = __webpack_require__;
|
|
122
|
+
__webpack_require__ = function(...args) {
|
|
123
|
+
try {
|
|
124
|
+
return originalRequire(...args);
|
|
125
|
+
} catch (e) {
|
|
126
|
+
const errMsg = e.message ?? e.toString();
|
|
127
|
+
if (errMsg.includes('__webpack_modules__[moduleId] is not a function')) {
|
|
128
|
+
throw new Error(\`Cannot find module '\${args[0]}'\`)
|
|
129
|
+
}
|
|
130
|
+
throw e;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
Object.keys(originalRequire).forEach(key => {
|
|
135
|
+
__webpack_require__[key] = originalRequire[key];
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
__webpack_require__.rstest_original_modules = {};
|
|
139
|
+
|
|
140
|
+
// TODO: Remove "reset_modules" in next Rspack version.
|
|
141
|
+
__webpack_require__.rstest_reset_modules = __webpack_require__.reset_modules = () => {
|
|
142
|
+
const mockedIds = Object.keys(__webpack_require__.rstest_original_modules)
|
|
143
|
+
Object.keys(__webpack_module_cache__).forEach(id => {
|
|
144
|
+
// Do not reset mocks registry.
|
|
145
|
+
if (!mockedIds.includes(id)) {
|
|
146
|
+
delete __webpack_module_cache__[id];
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// TODO: Remove "unmock" in next Rspack version.
|
|
152
|
+
__webpack_require__.rstest_unmock = __webpack_require__.unmock = (id) => {
|
|
153
|
+
delete __webpack_module_cache__[id]
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// TODO: Remove "require_actual" and "import_actual" in next Rspack version.
|
|
157
|
+
__webpack_require__.rstest_require_actual = __webpack_require__.rstest_import_actual = __webpack_require__.require_actual = __webpack_require__.import_actual = (id) => {
|
|
158
|
+
const originalModule = __webpack_require__.rstest_original_modules[id];
|
|
159
|
+
// Use fallback module if the module is not mocked.
|
|
160
|
+
const fallbackMod = __webpack_require__(id);
|
|
161
|
+
return originalModule ? originalModule : fallbackMod;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// TODO: Remove "set_mock" in next Rspack version.
|
|
165
|
+
__webpack_require__.rstest_set_mock = __webpack_require__.set_mock = (id, modFactory) => {
|
|
166
|
+
let requiredModule = undefined
|
|
167
|
+
try {
|
|
168
|
+
requiredModule = __webpack_require__(id);
|
|
169
|
+
} catch {
|
|
170
|
+
// TODO: non-resolved module
|
|
171
|
+
} finally {
|
|
172
|
+
__webpack_require__.rstest_original_modules[id] = requiredModule;
|
|
173
|
+
}
|
|
174
|
+
if (typeof modFactory === 'string' || typeof modFactory === 'number') {
|
|
175
|
+
__webpack_module_cache__[id] = { exports: __webpack_require__(modFactory) };
|
|
176
|
+
} else if (typeof modFactory === 'function') {
|
|
177
|
+
let exports = modFactory();
|
|
178
|
+
__webpack_require__.r(exports);
|
|
179
|
+
__webpack_module_cache__[id] = { exports, id, loaded: true };
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
`;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
compiler.hooks.thisCompilation.tap('CustomPlugin', (compilation)=>{
|
|
186
|
+
compilation.hooks.additionalTreeRuntimeRequirements.tap('CustomPlugin', (chunk)=>{
|
|
187
|
+
compilation.addRuntimeModule(chunk, new RetestImportRuntimeModule());
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const pluginMockRuntime = {
|
|
193
|
+
name: 'rstest:mock-runtime',
|
|
194
|
+
setup: (api)=>{
|
|
195
|
+
api.modifyRspackConfig(async (config)=>{
|
|
196
|
+
config.plugins.push(new MockRuntimeRspackPlugin());
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
class RstestCacheControlPlugin {
|
|
201
|
+
apply(compiler) {
|
|
202
|
+
const { RuntimeModule } = compiler.webpack;
|
|
203
|
+
class RetestCacheControlModule extends RuntimeModule {
|
|
204
|
+
constructor(){
|
|
205
|
+
super('rstest_cache_control');
|
|
206
|
+
}
|
|
207
|
+
generate() {
|
|
208
|
+
return `
|
|
209
|
+
global.setupIds = [];
|
|
210
|
+
|
|
211
|
+
function __rstest_clean_core_cache__() {
|
|
212
|
+
if (typeof __webpack_require__ === 'undefined') {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
delete __webpack_module_cache__['@rstest/core'];
|
|
216
|
+
|
|
217
|
+
global.setupIds.forEach((id) => {
|
|
218
|
+
delete __webpack_module_cache__[id];
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
223
|
+
`;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
compiler.hooks.thisCompilation.tap('CustomPlugin', (compilation)=>{
|
|
227
|
+
compilation.hooks.additionalTreeRuntimeRequirements.tap('CustomPlugin', (chunk)=>{
|
|
228
|
+
compilation.addRuntimeModule(chunk, new RetestCacheControlModule());
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const pluginCacheControl = (setupFiles)=>({
|
|
234
|
+
name: 'rstest:cache-control',
|
|
235
|
+
setup: (api)=>{
|
|
236
|
+
api.transform({
|
|
237
|
+
test: setupFiles
|
|
238
|
+
}, ({ code })=>({
|
|
239
|
+
code: `
|
|
240
|
+
${code}
|
|
241
|
+
if (global.setupIds && __webpack_module__.id) {
|
|
242
|
+
global.setupIds.push(__webpack_module__.id);
|
|
243
|
+
}
|
|
244
|
+
`
|
|
245
|
+
}));
|
|
246
|
+
api.modifyRspackConfig(async (config)=>{
|
|
247
|
+
config.plugins.push(new RstestCacheControlPlugin());
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
});
|
|
76
251
|
const isMultiCompiler = (compiler)=>'compilers' in compiler && Array.isArray(compiler.compilers);
|
|
77
252
|
const autoExternalNodeModules = ({ context, request, dependencyType, getResolve }, callback)=>{
|
|
78
|
-
if (!request
|
|
253
|
+
if (!request) return callback();
|
|
79
254
|
if (request.startsWith('@swc/helpers/')) return callback();
|
|
80
255
|
const doExternal = (externalPath = request)=>{
|
|
81
|
-
callback(void 0, externalPath, 'commonjs' === dependencyType ? 'commonjs' : '
|
|
256
|
+
callback(void 0, externalPath, 'commonjs' === dependencyType ? 'commonjs' : 'import');
|
|
82
257
|
};
|
|
83
258
|
const resolver = getResolve?.();
|
|
84
259
|
if (!resolver) return callback();
|
|
@@ -88,11 +263,20 @@ export const __webpack_modules__ = {
|
|
|
88
263
|
return callback();
|
|
89
264
|
});
|
|
90
265
|
};
|
|
266
|
+
const autoExternalNodeBuiltin = ({ request, dependencyType }, callback)=>{
|
|
267
|
+
if (!request) return callback();
|
|
268
|
+
const isNodeBuiltin = utils.Tn.some((builtin)=>{
|
|
269
|
+
if ('string' == typeof builtin) return builtin === request;
|
|
270
|
+
return builtin.test(request);
|
|
271
|
+
});
|
|
272
|
+
if (isNodeBuiltin) callback(void 0, request, 'commonjs' === dependencyType ? 'commonjs' : 'module-import');
|
|
273
|
+
else callback();
|
|
274
|
+
};
|
|
91
275
|
const prepareRsbuild = async (context, globTestSourceEntries, setupFiles)=>{
|
|
92
|
-
const { command, normalizedConfig: { name, plugins, resolve, source, output, tools, testEnvironment } } = context;
|
|
276
|
+
const { command, normalizedConfig: { isolate, name, plugins, resolve, source, output, tools, testEnvironment, performance, dev = {} } } = context;
|
|
93
277
|
const debugMode = (0, utils.L1)();
|
|
94
278
|
core_.logger.level = debugMode ? 'verbose' : 'error';
|
|
95
|
-
const writeToDisk = debugMode;
|
|
279
|
+
const writeToDisk = dev.writeToDisk || debugMode;
|
|
96
280
|
const rsbuildInstance = await (0, core_.createRsbuild)({
|
|
97
281
|
rsbuildConfig: {
|
|
98
282
|
tools,
|
|
@@ -105,6 +289,7 @@ export const __webpack_modules__ = {
|
|
|
105
289
|
strictPort: false,
|
|
106
290
|
middlewareMode: true
|
|
107
291
|
},
|
|
292
|
+
performance,
|
|
108
293
|
environments: {
|
|
109
294
|
[name]: {
|
|
110
295
|
dev: {
|
|
@@ -123,28 +308,28 @@ export const __webpack_modules__ = {
|
|
|
123
308
|
distPath: {
|
|
124
309
|
root: utils.Nk
|
|
125
310
|
},
|
|
126
|
-
externals: [
|
|
127
|
-
{
|
|
128
|
-
'@rstest/core': 'global @rstest/core'
|
|
129
|
-
},
|
|
130
|
-
'node' === testEnvironment ? autoExternalNodeModules : {}
|
|
131
|
-
],
|
|
132
311
|
target: 'node'
|
|
133
312
|
},
|
|
134
313
|
tools: {
|
|
135
314
|
rspack: (config)=>{
|
|
136
315
|
config.output ??= {};
|
|
137
316
|
config.output.iife = false;
|
|
138
|
-
config.
|
|
139
|
-
node: true
|
|
140
|
-
};
|
|
317
|
+
config.output.importFunctionName = '__rstest_dynamic_import__';
|
|
141
318
|
config.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';
|
|
142
319
|
config.plugins.push(new core_.rspack.experiments.RstestPlugin({
|
|
143
320
|
injectModulePathName: true,
|
|
144
|
-
hoistMockModule: true,
|
|
145
321
|
importMetaPathName: true,
|
|
146
|
-
|
|
322
|
+
hoistMockModule: true,
|
|
323
|
+
manualMockRoot: external_pathe_["default"].resolve(context.rootPath, '__mocks__')
|
|
147
324
|
}));
|
|
325
|
+
config.externals = (0, utils.XQ)(config.externals) || [];
|
|
326
|
+
config.externals.unshift({
|
|
327
|
+
'@rstest/core': 'global @rstest/core'
|
|
328
|
+
});
|
|
329
|
+
if ('node' === testEnvironment) config.externals.push(autoExternalNodeModules);
|
|
330
|
+
config.externalsPresets ??= {};
|
|
331
|
+
config.externalsPresets.node = false;
|
|
332
|
+
config.externals.push(autoExternalNodeBuiltin);
|
|
148
333
|
config.module.parser ??= {};
|
|
149
334
|
config.module.parser.javascript = {
|
|
150
335
|
importDynamic: false,
|
|
@@ -152,29 +337,26 @@ export const __webpack_modules__ = {
|
|
|
152
337
|
requireAsExpression: false,
|
|
153
338
|
...config.module.parser.javascript || {}
|
|
154
339
|
};
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
340
|
+
config.resolve ??= {};
|
|
341
|
+
config.resolve.extensions ??= [];
|
|
342
|
+
config.resolve.extensions.push('.cjs');
|
|
343
|
+
if ('node' === testEnvironment && (0, utils.mP)().major < 20) config.resolve.mainFields = config.resolve.mainFields?.filter((filed)=>'module' !== filed) || [
|
|
344
|
+
'main'
|
|
345
|
+
];
|
|
161
346
|
config.optimization = {
|
|
162
|
-
...config.optimization || {},
|
|
163
347
|
moduleIds: 'named',
|
|
164
348
|
chunkIds: 'named',
|
|
349
|
+
...config.optimization || {},
|
|
165
350
|
runtimeChunk: {
|
|
166
351
|
name: 'runtime'
|
|
167
|
-
},
|
|
168
|
-
splitChunks: {
|
|
169
|
-
chunks: 'all',
|
|
170
|
-
minSize: 0,
|
|
171
|
-
maxInitialRequests: Number.POSITIVE_INFINITY
|
|
172
352
|
}
|
|
173
353
|
};
|
|
174
354
|
}
|
|
175
355
|
},
|
|
176
356
|
plugins: [
|
|
177
357
|
pluginIgnoreResolveError,
|
|
358
|
+
pluginMockRuntime,
|
|
359
|
+
pluginCSSFilter(),
|
|
178
360
|
pluginEntryWatch({
|
|
179
361
|
globTestSourceEntries,
|
|
180
362
|
setupFiles,
|
|
@@ -185,9 +367,12 @@ export const __webpack_modules__ = {
|
|
|
185
367
|
}
|
|
186
368
|
}
|
|
187
369
|
});
|
|
370
|
+
if (!isolate) rsbuildInstance.addPlugins([
|
|
371
|
+
pluginCacheControl(Object.values(setupFiles))
|
|
372
|
+
]);
|
|
188
373
|
return rsbuildInstance;
|
|
189
374
|
};
|
|
190
|
-
const createRsbuildServer = async ({ name, globTestSourceEntries, setupFiles, rsbuildInstance })=>{
|
|
375
|
+
const createRsbuildServer = async ({ name, globTestSourceEntries, setupFiles, rsbuildInstance, normalizedConfig })=>{
|
|
191
376
|
let rspackCompiler;
|
|
192
377
|
const rstestCompilerPlugin = {
|
|
193
378
|
name: 'rstest:compiler',
|
|
@@ -204,7 +389,10 @@ export const __webpack_modules__ = {
|
|
|
204
389
|
getPortSilently: true
|
|
205
390
|
});
|
|
206
391
|
if ((0, utils.L1)()) await rsbuildInstance.inspectConfig({
|
|
207
|
-
writeToDisk: true
|
|
392
|
+
writeToDisk: true,
|
|
393
|
+
extraConfigs: {
|
|
394
|
+
retest: normalizedConfig
|
|
395
|
+
}
|
|
208
396
|
});
|
|
209
397
|
const outputFileSystem = (isMultiCompiler(rspackCompiler) ? rspackCompiler.compilers[0].outputFileSystem : rspackCompiler.outputFileSystem) || external_node_fs_["default"];
|
|
210
398
|
const getRsbuildStats = async ()=>{
|
|
@@ -397,8 +585,9 @@ export const __webpack_modules__ = {
|
|
|
397
585
|
...execArgv,
|
|
398
586
|
'--experimental-vm-modules',
|
|
399
587
|
'--experimental-import-meta-resolve',
|
|
400
|
-
'--no-warnings'
|
|
401
|
-
|
|
588
|
+
'--no-warnings',
|
|
589
|
+
(0, utils.PA)() ? '--experimental-detect-module' : void 0
|
|
590
|
+
].filter(Boolean),
|
|
402
591
|
env: {
|
|
403
592
|
NODE_ENV: 'test',
|
|
404
593
|
FORCE_COLOR: '1',
|
|
@@ -421,7 +610,8 @@ export const __webpack_modules__ = {
|
|
|
421
610
|
maxConcurrency,
|
|
422
611
|
printConsoleTrace,
|
|
423
612
|
disableConsoleIntercept,
|
|
424
|
-
testEnvironment
|
|
613
|
+
testEnvironment,
|
|
614
|
+
isolate
|
|
425
615
|
};
|
|
426
616
|
const rpcMethods = {
|
|
427
617
|
onTestCaseResult: async (result)=>{
|
package/dist/629.js
CHANGED
|
@@ -33,6 +33,7 @@ export const __webpack_modules__ = {
|
|
|
33
33
|
const rsbuildInstance = await (0, _rsbuild__WEBPACK_IMPORTED_MODULE_2__.z)(context, globTestSourceEntries, setupFiles);
|
|
34
34
|
const getRsbuildStats = await (0, _rsbuild__WEBPACK_IMPORTED_MODULE_2__.r)({
|
|
35
35
|
name,
|
|
36
|
+
normalizedConfig: context.normalizedConfig,
|
|
36
37
|
globTestSourceEntries,
|
|
37
38
|
setupFiles,
|
|
38
39
|
rsbuildInstance,
|
package/dist/{973.js → 723.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export const __webpack_ids__ = [
|
|
2
|
-
"
|
|
2
|
+
"723"
|
|
3
3
|
];
|
|
4
4
|
export const __webpack_modules__ = {
|
|
5
|
-
"../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.
|
|
5
|
+
"../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.29/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
6
6
|
__webpack_require__.d(__webpack_exports__, {
|
|
7
7
|
s7: ()=>TraceMap,
|
|
8
8
|
Sk: ()=>originalPositionFor
|
|
@@ -212,7 +212,7 @@ export const __webpack_modules__ = {
|
|
|
212
212
|
if (!path || addTrailingSlash && !path.endsWith('/..')) path += '/';
|
|
213
213
|
url.path = path;
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function resolve_uri_resolve(input, base) {
|
|
216
216
|
if (!input && !base) return '';
|
|
217
217
|
const url = parseUrl(input);
|
|
218
218
|
let inputType = url.type;
|
|
@@ -255,20 +255,21 @@ export const __webpack_modules__ = {
|
|
|
255
255
|
return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
|
-
function trace_mapping_resolve(input, base) {
|
|
259
|
-
if (base && !base.endsWith('/')) base += '/';
|
|
260
|
-
return resolve(input, base);
|
|
261
|
-
}
|
|
262
258
|
function stripFilename(path) {
|
|
263
|
-
if (!path) return
|
|
264
|
-
const index = path.lastIndexOf(
|
|
259
|
+
if (!path) return "";
|
|
260
|
+
const index = path.lastIndexOf("/");
|
|
265
261
|
return path.slice(0, index + 1);
|
|
266
262
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
263
|
+
function resolver(mapUrl, sourceRoot) {
|
|
264
|
+
const from = stripFilename(mapUrl);
|
|
265
|
+
const prefix = sourceRoot ? sourceRoot + "/" : "";
|
|
266
|
+
return (source)=>resolve_uri_resolve(prefix + (source || ""), from);
|
|
267
|
+
}
|
|
268
|
+
var COLUMN = 0;
|
|
269
|
+
var SOURCES_INDEX = 1;
|
|
270
|
+
var SOURCE_LINE = 2;
|
|
271
|
+
var SOURCE_COLUMN = 3;
|
|
272
|
+
var NAMES_INDEX = 4;
|
|
272
273
|
function maybeSort(mappings, owned) {
|
|
273
274
|
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
|
274
275
|
if (unsortedIndex === mappings.length) return mappings;
|
|
@@ -291,7 +292,7 @@ export const __webpack_modules__ = {
|
|
|
291
292
|
function trace_mapping_sortComparator(a, b) {
|
|
292
293
|
return a[COLUMN] - b[COLUMN];
|
|
293
294
|
}
|
|
294
|
-
|
|
295
|
+
var found = false;
|
|
295
296
|
function binarySearch(haystack, needle, low, high) {
|
|
296
297
|
while(low <= high){
|
|
297
298
|
const mid = low + (high - low >> 1);
|
|
@@ -337,15 +338,18 @@ export const __webpack_modules__ = {
|
|
|
337
338
|
state.lastNeedle = needle;
|
|
338
339
|
return state.lastIndex = binarySearch(haystack, needle, low, high);
|
|
339
340
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
341
|
+
function parse(map) {
|
|
342
|
+
return "string" == typeof map ? JSON.parse(map) : map;
|
|
343
|
+
}
|
|
344
|
+
var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
|
|
345
|
+
var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
|
|
346
|
+
var LEAST_UPPER_BOUND = -1;
|
|
347
|
+
var GREATEST_LOWER_BOUND = 1;
|
|
348
|
+
var TraceMap = class {
|
|
345
349
|
constructor(map, mapUrl){
|
|
346
|
-
const isString =
|
|
350
|
+
const isString = "string" == typeof map;
|
|
347
351
|
if (!isString && map._decodedMemo) return map;
|
|
348
|
-
const parsed =
|
|
352
|
+
const parsed = parse(map);
|
|
349
353
|
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
|
350
354
|
this.version = version;
|
|
351
355
|
this.file = file;
|
|
@@ -354,21 +358,22 @@ export const __webpack_modules__ = {
|
|
|
354
358
|
this.sources = sources;
|
|
355
359
|
this.sourcesContent = sourcesContent;
|
|
356
360
|
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
|
|
357
|
-
const
|
|
358
|
-
this.resolvedSources = sources.map(
|
|
361
|
+
const resolve = resolver(mapUrl, sourceRoot);
|
|
362
|
+
this.resolvedSources = sources.map(resolve);
|
|
359
363
|
const { mappings } = parsed;
|
|
360
|
-
if (
|
|
364
|
+
if ("string" == typeof mappings) {
|
|
361
365
|
this._encoded = mappings;
|
|
362
366
|
this._decoded = void 0;
|
|
363
|
-
} else {
|
|
367
|
+
} else if (Array.isArray(mappings)) {
|
|
364
368
|
this._encoded = void 0;
|
|
365
369
|
this._decoded = maybeSort(mappings, isString);
|
|
366
|
-
}
|
|
370
|
+
} else if (parsed.sections) throw new Error("TraceMap passed sectioned source map, please use FlattenMap export instead");
|
|
371
|
+
else throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
|
|
367
372
|
this._decodedMemo = memoizedState();
|
|
368
373
|
this._bySources = void 0;
|
|
369
374
|
this._bySourceMemos = void 0;
|
|
370
375
|
}
|
|
371
|
-
}
|
|
376
|
+
};
|
|
372
377
|
function cast(map) {
|
|
373
378
|
return map;
|
|
374
379
|
}
|
package/dist/813.js
CHANGED
|
@@ -129,11 +129,11 @@ export const __webpack_modules__ = {
|
|
|
129
129
|
$_: ()=>helper.$_,
|
|
130
130
|
Yz: ()=>helper.Yz
|
|
131
131
|
});
|
|
132
|
+
var constants = __webpack_require__("./src/utils/constants.ts");
|
|
132
133
|
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
133
134
|
__webpack_require__("./src/utils/logger.ts");
|
|
134
135
|
__webpack_require__("node:fs");
|
|
135
136
|
__webpack_require__("node:fs/promises");
|
|
136
137
|
__webpack_require__("pathe");
|
|
137
|
-
var constants = __webpack_require__("./src/utils/constants.ts");
|
|
138
138
|
}
|
|
139
139
|
};
|