@rstest/core 0.1.1 → 0.1.2
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/dist/359.js +3 -3
- package/dist/{562.js → 854.js} +41 -3
- package/dist/cli.js +9 -6
- package/package.json +2 -2
package/dist/359.js
CHANGED
|
@@ -581,7 +581,7 @@ export const __webpack_modules__ = {
|
|
|
581
581
|
});
|
|
582
582
|
return {
|
|
583
583
|
command,
|
|
584
|
-
version: "0.1.
|
|
584
|
+
version: "0.1.2",
|
|
585
585
|
rootPath,
|
|
586
586
|
reporters,
|
|
587
587
|
snapshotManager,
|
|
@@ -596,14 +596,14 @@ export const __webpack_modules__ = {
|
|
|
596
596
|
}, config);
|
|
597
597
|
const runTests = async ()=>{
|
|
598
598
|
const { runTests } = await Promise.all([
|
|
599
|
-
__webpack_require__.e("
|
|
599
|
+
__webpack_require__.e("854"),
|
|
600
600
|
__webpack_require__.e("629")
|
|
601
601
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/core/runTests.ts"));
|
|
602
602
|
await runTests(context, fileFilters);
|
|
603
603
|
};
|
|
604
604
|
const listTests = async (options)=>{
|
|
605
605
|
const { listTests } = await Promise.all([
|
|
606
|
-
__webpack_require__.e("
|
|
606
|
+
__webpack_require__.e("854"),
|
|
607
607
|
__webpack_require__.e("285")
|
|
608
608
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/core/listTests.ts"));
|
|
609
609
|
await listTests(context, fileFilters, options);
|
package/dist/{562.js → 854.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
export const __webpack_ids__ = [
|
|
4
|
-
"
|
|
4
|
+
"854"
|
|
5
5
|
];
|
|
6
6
|
export const __webpack_modules__ = {
|
|
7
7
|
"./src/core/rsbuild.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -237,6 +237,22 @@ export const __webpack_modules__ = {
|
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
};
|
|
240
|
+
var external_node_inspector_ = __webpack_require__("node:inspector");
|
|
241
|
+
const enable = void 0 !== external_node_inspector_["default"].url();
|
|
242
|
+
const pluginInspect = ()=>enable ? {
|
|
243
|
+
name: 'rstest:inspect',
|
|
244
|
+
setup: (api)=>{
|
|
245
|
+
api.modifyRspackConfig(async (config)=>{
|
|
246
|
+
config.devtool = 'inline-source-map';
|
|
247
|
+
config.optimization ??= {};
|
|
248
|
+
config.optimization.splitChunks = {
|
|
249
|
+
...config.optimization.splitChunks || {},
|
|
250
|
+
maxSize: 1048576,
|
|
251
|
+
chunks: 'all'
|
|
252
|
+
};
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
} : null;
|
|
240
256
|
class MockRuntimeRspackPlugin {
|
|
241
257
|
apply(compiler) {
|
|
242
258
|
const { RuntimeModule } = compiler.webpack;
|
|
@@ -412,6 +428,19 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
412
428
|
});
|
|
413
429
|
}
|
|
414
430
|
});
|
|
431
|
+
function parseInlineSourceMap(code) {
|
|
432
|
+
const inlineSourceMapRegex = /\/\/# sourceMappingURL=data:application\/json(?:;charset=utf-8)?;base64,(.+)\s*$/m;
|
|
433
|
+
const match = code.match(inlineSourceMapRegex);
|
|
434
|
+
if (!match || !match[1]) return null;
|
|
435
|
+
try {
|
|
436
|
+
const base64Data = match[1];
|
|
437
|
+
const decodedStr = Buffer.from(base64Data, 'base64').toString('utf-8');
|
|
438
|
+
const sourceMap = JSON.parse(decodedStr);
|
|
439
|
+
return sourceMap;
|
|
440
|
+
} catch (_error) {
|
|
441
|
+
return null;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
415
444
|
const isMultiCompiler = (compiler)=>'compilers' in compiler && Array.isArray(compiler.compilers);
|
|
416
445
|
const prepareRsbuild = async (context, globTestSourceEntries, setupFiles)=>{
|
|
417
446
|
const { command, normalizedConfig: { isolate, plugins, resolve, source, output, tools, testEnvironment, performance, dev = {} } } = context;
|
|
@@ -450,7 +479,8 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
450
479
|
isWatch: 'watch' === command
|
|
451
480
|
}),
|
|
452
481
|
pluginExternal(testEnvironment),
|
|
453
|
-
!isolate ? pluginCacheControl(Object.values(setupFiles)) : null
|
|
482
|
+
!isolate ? pluginCacheControl(Object.values(setupFiles)) : null,
|
|
483
|
+
pluginInspect()
|
|
454
484
|
].filter(Boolean)
|
|
455
485
|
}
|
|
456
486
|
});
|
|
@@ -524,9 +554,17 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
524
554
|
files: entryFiles[entry]
|
|
525
555
|
});
|
|
526
556
|
}
|
|
557
|
+
const inlineSourceMap = 'inline-source-map' === stats.compilation.options.devtool;
|
|
527
558
|
const sourceMaps = Object.fromEntries((await Promise.all(assets.map(async (asset)=>{
|
|
528
|
-
const sourceMapPath = asset?.info.related?.sourceMap?.[0];
|
|
529
559
|
const assetFilePath = external_pathe_["default"].join(outputPath, asset.name);
|
|
560
|
+
if (inlineSourceMap) {
|
|
561
|
+
const content = await readFile(assetFilePath);
|
|
562
|
+
return [
|
|
563
|
+
assetFilePath,
|
|
564
|
+
parseInlineSourceMap(content)
|
|
565
|
+
];
|
|
566
|
+
}
|
|
567
|
+
const sourceMapPath = asset?.info.related?.sourceMap?.[0];
|
|
530
568
|
if (sourceMapPath) {
|
|
531
569
|
const filePath = external_pathe_["default"].join(outputPath, sourceMapPath);
|
|
532
570
|
const sourceMap = await readFile(filePath);
|
package/dist/cli.js
CHANGED
|
@@ -6,6 +6,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_birpc__ from "birpc";
|
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__ from "node:events";
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_inspector_dd9822d6__ from "node:inspector";
|
|
9
10
|
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
|
|
10
11
|
import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
|
|
11
12
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
@@ -2855,6 +2856,9 @@ var __webpack_modules__ = {
|
|
|
2855
2856
|
"node:fs/promises": function(module) {
|
|
2856
2857
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__;
|
|
2857
2858
|
},
|
|
2859
|
+
"node:inspector": function(module) {
|
|
2860
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_inspector_dd9822d6__;
|
|
2861
|
+
},
|
|
2858
2862
|
"node:module": function(module) {
|
|
2859
2863
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__;
|
|
2860
2864
|
},
|
|
@@ -3678,7 +3682,6 @@ class CAC extends EventEmitter {
|
|
|
3678
3682
|
const cac = (name = "")=>new CAC(name);
|
|
3679
3683
|
const dist = cac;
|
|
3680
3684
|
var external_pathe_ = __webpack_require__("pathe");
|
|
3681
|
-
var external_std_env_ = __webpack_require__("std-env");
|
|
3682
3685
|
var src_config = __webpack_require__("./src/config.ts");
|
|
3683
3686
|
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
3684
3687
|
function initNodeEnv() {
|
|
@@ -3691,7 +3694,7 @@ function prepareCli() {
|
|
|
3691
3694
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
|
|
3692
3695
|
}
|
|
3693
3696
|
function showRstest() {
|
|
3694
|
-
logger.k.greet(" Rstest v0.1.
|
|
3697
|
+
logger.k.greet(" Rstest v0.1.2");
|
|
3695
3698
|
logger.k.log('');
|
|
3696
3699
|
}
|
|
3697
3700
|
const applyCommonOptions = (cli)=>{
|
|
@@ -3740,12 +3743,12 @@ async function initCli(options) {
|
|
|
3740
3743
|
function setupCommands() {
|
|
3741
3744
|
const cli = dist('rstest');
|
|
3742
3745
|
cli.help();
|
|
3743
|
-
cli.version("0.1.
|
|
3746
|
+
cli.version("0.1.2");
|
|
3744
3747
|
applyCommonOptions(cli);
|
|
3745
|
-
cli.command('[...filters]', 'run tests').action(async (filters, options)=>{
|
|
3748
|
+
cli.command('[...filters]', 'run tests').option('--watch', 'Run tests in watch mode').action(async (filters, options)=>{
|
|
3746
3749
|
showRstest();
|
|
3747
|
-
if (
|
|
3748
|
-
else await runRest(options, filters, '
|
|
3750
|
+
if (options.watch) await runRest(options, filters, 'watch');
|
|
3751
|
+
else await runRest(options, filters, 'run');
|
|
3749
3752
|
});
|
|
3750
3753
|
const runRest = async (options, filters, command)=>{
|
|
3751
3754
|
let rstest;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rstest/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "The Rsbuild-based test tool.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rstest/issues"
|
|
@@ -104,6 +104,6 @@
|
|
|
104
104
|
"build": "rslib build && npx prettier ./LICENSE.md --write",
|
|
105
105
|
"typecheck": "tsc --noEmit",
|
|
106
106
|
"dev": "rslib build --watch",
|
|
107
|
-
"test": "npx rstest
|
|
107
|
+
"test": "npx rstest --globals"
|
|
108
108
|
}
|
|
109
109
|
}
|