@rstest/core 0.2.1 → 0.2.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/{72.js → 171.js} +2 -1
- package/dist/{920.js → 33.js} +35 -32
- package/dist/{44.js → 350.js} +6 -5
- package/dist/{813.js → 607.js} +16 -15
- package/dist/{208.js → 655.js} +60 -59
- package/dist/{359.js → 698.js} +74 -66
- package/dist/{355.js → 704.js} +17 -16
- package/dist/{965.js → 711.js} +6 -5
- package/dist/{443.js → 755.js} +2 -1
- package/dist/{723.js → 829.js} +5 -4
- package/dist/{867.js → 85.js} +56 -55
- package/dist/{668.js → 928.js} +3 -2
- package/dist/{25.js → 967.js} +8 -7
- package/dist/{64.js → 969.js} +2 -1
- package/dist/{285.js → 971.js} +12 -11
- package/dist/{854.js → 985.js} +14 -13
- package/dist/index.js +83 -83
- package/dist/worker.js +38 -36
- package/dist-types/index.d.ts +1 -0
- package/dist-types/worker.d.ts +1 -0
- package/package.json +4 -4
- /package/dist/{208.js.LICENSE.txt → 655.js.LICENSE.txt} +0 -0
- /package/dist/{668.js.LICENSE.txt → 928.js.LICENSE.txt} +0 -0
package/dist/index.js
CHANGED
|
@@ -2181,8 +2181,8 @@ var __webpack_modules__ = {
|
|
|
2181
2181
|
},
|
|
2182
2182
|
"./src/cli/commands.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2183
2183
|
__webpack_require__.d(__webpack_exports__, {
|
|
2184
|
-
|
|
2185
|
-
|
|
2184
|
+
a8: ()=>runRest,
|
|
2185
|
+
QF: ()=>setupCommands
|
|
2186
2186
|
});
|
|
2187
2187
|
var external_events_ = __webpack_require__("events");
|
|
2188
2188
|
function toArr(any) {
|
|
@@ -2682,8 +2682,8 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2682
2682
|
};
|
|
2683
2683
|
async function initCli(options) {
|
|
2684
2684
|
const cwd = process.cwd();
|
|
2685
|
-
const root = options.root ? (0, helper.
|
|
2686
|
-
const { content: config, filePath: configFilePath } = await (0, src_config.
|
|
2685
|
+
const root = options.root ? (0, helper.FI)(cwd, options.root) : cwd;
|
|
2686
|
+
const { content: config, filePath: configFilePath } = await (0, src_config.Z9)({
|
|
2687
2687
|
cwd: root,
|
|
2688
2688
|
path: options.config,
|
|
2689
2689
|
configLoader: options.configLoader
|
|
@@ -2710,9 +2710,9 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2710
2710
|
'testEnvironment'
|
|
2711
2711
|
];
|
|
2712
2712
|
for (const key of keys)if (void 0 !== options[key]) config[key] = options[key];
|
|
2713
|
-
if (options.exclude) config.exclude = (0, helper.
|
|
2714
|
-
if (options.reporter) config.reporters = (0, helper.
|
|
2715
|
-
if (options.include) config.include = (0, helper.
|
|
2713
|
+
if (options.exclude) config.exclude = (0, helper.bg)(options.exclude);
|
|
2714
|
+
if (options.reporter) config.reporters = (0, helper.bg)(options.reporter);
|
|
2715
|
+
if (options.include) config.include = (0, helper.bg)(options.include);
|
|
2716
2716
|
return {
|
|
2717
2717
|
config,
|
|
2718
2718
|
configFilePath: configFilePath ?? void 0
|
|
@@ -2722,13 +2722,13 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2722
2722
|
let rstest;
|
|
2723
2723
|
try {
|
|
2724
2724
|
const { config, configFilePath } = await initCli(options);
|
|
2725
|
-
const { createRstest } = await __webpack_require__.e("
|
|
2725
|
+
const { createRstest } = await __webpack_require__.e("698").then(__webpack_require__.bind(__webpack_require__, "./src/core/index.ts"));
|
|
2726
2726
|
rstest = createRstest({
|
|
2727
2727
|
config,
|
|
2728
2728
|
configFilePath
|
|
2729
2729
|
}, command, filters.map(external_pathe_.normalize));
|
|
2730
2730
|
if ('watch' === command && configFilePath) {
|
|
2731
|
-
const { watchFilesForRestart } = await __webpack_require__.e("
|
|
2731
|
+
const { watchFilesForRestart } = await __webpack_require__.e("967").then(__webpack_require__.bind(__webpack_require__, "./src/core/restart.ts"));
|
|
2732
2732
|
watchFilesForRestart({
|
|
2733
2733
|
rstest,
|
|
2734
2734
|
options,
|
|
@@ -2738,18 +2738,18 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2738
2738
|
await rstest.runTests();
|
|
2739
2739
|
} catch (err) {
|
|
2740
2740
|
for (const reporter of rstest?.context.reporters || [])reporter.onExit?.();
|
|
2741
|
-
logger.
|
|
2742
|
-
logger.
|
|
2741
|
+
logger.v.error('Failed to run Rstest.');
|
|
2742
|
+
logger.v.error((0, helper.Wk)(err));
|
|
2743
2743
|
process.exit(1);
|
|
2744
2744
|
}
|
|
2745
2745
|
};
|
|
2746
2746
|
function setupCommands() {
|
|
2747
2747
|
const cli = dist('rstest');
|
|
2748
2748
|
cli.help();
|
|
2749
|
-
cli.version("0.2.
|
|
2749
|
+
cli.version("0.2.2");
|
|
2750
2750
|
applyCommonOptions(cli);
|
|
2751
|
-
cli.command('[...filters]', 'run tests').option('--watch', 'Run tests in watch mode').action(async (filters, options)=>{
|
|
2752
|
-
(0, prepare.
|
|
2751
|
+
cli.command('[...filters]', 'run tests').option('-w, --watch', 'Run tests in watch mode').action(async (filters, options)=>{
|
|
2752
|
+
(0, prepare.N)();
|
|
2753
2753
|
if (options.watch) await runRest({
|
|
2754
2754
|
options,
|
|
2755
2755
|
filters,
|
|
@@ -2762,7 +2762,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2762
2762
|
});
|
|
2763
2763
|
});
|
|
2764
2764
|
cli.command('run [...filters]', 'run tests without watch mode').action(async (filters, options)=>{
|
|
2765
|
-
(0, prepare.
|
|
2765
|
+
(0, prepare.N)();
|
|
2766
2766
|
await runRest({
|
|
2767
2767
|
options,
|
|
2768
2768
|
filters,
|
|
@@ -2770,7 +2770,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2770
2770
|
});
|
|
2771
2771
|
});
|
|
2772
2772
|
cli.command('watch [...filters]', 'run tests in watch mode').action(async (filters, options)=>{
|
|
2773
|
-
(0, prepare.
|
|
2773
|
+
(0, prepare.N)();
|
|
2774
2774
|
await runRest({
|
|
2775
2775
|
options,
|
|
2776
2776
|
filters,
|
|
@@ -2780,7 +2780,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2780
2780
|
cli.command('list [...filters]', 'lists all test files that Rstest will run').option('--filesOnly', 'only list the test files').option('--json [boolean/path]', 'print tests as JSON or write to a file').action(async (filters, options)=>{
|
|
2781
2781
|
try {
|
|
2782
2782
|
const { config, configFilePath } = await initCli(options);
|
|
2783
|
-
const { createRstest } = await __webpack_require__.e("
|
|
2783
|
+
const { createRstest } = await __webpack_require__.e("698").then(__webpack_require__.bind(__webpack_require__, "./src/core/index.ts"));
|
|
2784
2784
|
const rstest = createRstest({
|
|
2785
2785
|
config,
|
|
2786
2786
|
configFilePath
|
|
@@ -2790,8 +2790,8 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2790
2790
|
json: options.json
|
|
2791
2791
|
});
|
|
2792
2792
|
} catch (err) {
|
|
2793
|
-
logger.
|
|
2794
|
-
logger.
|
|
2793
|
+
logger.v.error('Failed to run Rstest list.');
|
|
2794
|
+
logger.v.error((0, helper.Wk)(err));
|
|
2795
2795
|
process.exit(1);
|
|
2796
2796
|
}
|
|
2797
2797
|
});
|
|
@@ -2800,8 +2800,8 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2800
2800
|
},
|
|
2801
2801
|
"./src/cli/prepare.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2802
2802
|
__webpack_require__.d(__webpack_exports__, {
|
|
2803
|
-
|
|
2804
|
-
|
|
2803
|
+
N: ()=>showRstest,
|
|
2804
|
+
k: ()=>prepareCli
|
|
2805
2805
|
});
|
|
2806
2806
|
var _utils_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/utils/logger.ts");
|
|
2807
2807
|
function initNodeEnv() {
|
|
@@ -2814,35 +2814,35 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2814
2814
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
|
|
2815
2815
|
}
|
|
2816
2816
|
function showRstest() {
|
|
2817
|
-
_utils_logger__WEBPACK_IMPORTED_MODULE_0__.
|
|
2818
|
-
_utils_logger__WEBPACK_IMPORTED_MODULE_0__.
|
|
2817
|
+
_utils_logger__WEBPACK_IMPORTED_MODULE_0__.v.greet(" Rstest v0.2.2");
|
|
2818
|
+
_utils_logger__WEBPACK_IMPORTED_MODULE_0__.v.log('');
|
|
2819
2819
|
}
|
|
2820
2820
|
},
|
|
2821
2821
|
"./src/config.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2822
2822
|
__webpack_require__.d(__webpack_exports__, {
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2823
|
+
ST: ()=>mergeRstestConfig,
|
|
2824
|
+
Z9: ()=>loadConfig,
|
|
2825
|
+
wX: ()=>withDefaultConfig
|
|
2826
2826
|
});
|
|
2827
2827
|
var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:fs");
|
|
2828
2828
|
var _rsbuild_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("@rsbuild/core");
|
|
2829
2829
|
var pathe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("pathe");
|
|
2830
2830
|
var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/index.ts");
|
|
2831
|
-
const findConfig = (basePath)=>_utils__WEBPACK_IMPORTED_MODULE_3__.
|
|
2831
|
+
const findConfig = (basePath)=>_utils__WEBPACK_IMPORTED_MODULE_3__.kv.map((ext)=>basePath + ext).find(node_fs__WEBPACK_IMPORTED_MODULE_0__["default"].existsSync);
|
|
2832
2832
|
const resolveConfigPath = (root, customConfig)=>{
|
|
2833
2833
|
if (customConfig) {
|
|
2834
2834
|
const customConfigPath = (0, pathe__WEBPACK_IMPORTED_MODULE_2__.isAbsolute)(customConfig) ? customConfig : (0, pathe__WEBPACK_IMPORTED_MODULE_2__.join)(root, customConfig);
|
|
2835
2835
|
if (node_fs__WEBPACK_IMPORTED_MODULE_0__["default"].existsSync(customConfigPath)) return customConfigPath;
|
|
2836
|
-
throw `Cannot find config file: ${_utils__WEBPACK_IMPORTED_MODULE_3__
|
|
2836
|
+
throw `Cannot find config file: ${_utils__WEBPACK_IMPORTED_MODULE_3__.yW.dim(customConfigPath)}`;
|
|
2837
2837
|
}
|
|
2838
|
-
const configFilePath = findConfig((0, pathe__WEBPACK_IMPORTED_MODULE_2__.join)(root, _utils__WEBPACK_IMPORTED_MODULE_3__.
|
|
2838
|
+
const configFilePath = findConfig((0, pathe__WEBPACK_IMPORTED_MODULE_2__.join)(root, _utils__WEBPACK_IMPORTED_MODULE_3__.t));
|
|
2839
2839
|
if (configFilePath) return configFilePath;
|
|
2840
2840
|
return null;
|
|
2841
2841
|
};
|
|
2842
2842
|
async function loadConfig({ cwd = process.cwd(), path, envMode, configLoader }) {
|
|
2843
2843
|
const configFilePath = resolveConfigPath(cwd, path);
|
|
2844
2844
|
if (!configFilePath) {
|
|
2845
|
-
_utils__WEBPACK_IMPORTED_MODULE_3__.
|
|
2845
|
+
_utils__WEBPACK_IMPORTED_MODULE_3__.vF.debug('no rstest config file found');
|
|
2846
2846
|
return {
|
|
2847
2847
|
content: {},
|
|
2848
2848
|
filePath: configFilePath
|
|
@@ -2903,7 +2903,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2903
2903
|
const merged = mergeRstestConfig(createDefaultConfig(), config);
|
|
2904
2904
|
merged.include = config.include || merged.include;
|
|
2905
2905
|
merged.exclude = (config.exclude || merged.exclude || []).concat([
|
|
2906
|
-
_utils__WEBPACK_IMPORTED_MODULE_3__.
|
|
2906
|
+
_utils__WEBPACK_IMPORTED_MODULE_3__.EJ
|
|
2907
2907
|
]);
|
|
2908
2908
|
merged.reporters = config.reporters ?? merged.reporters;
|
|
2909
2909
|
merged.pool = 'string' == typeof config.pool ? {
|
|
@@ -2914,11 +2914,11 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2914
2914
|
},
|
|
2915
2915
|
"./src/utils/constants.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2916
2916
|
__webpack_require__.d(__webpack_exports__, {
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2917
|
+
EJ: ()=>TEMP_RSTEST_OUTPUT_DIR_GLOB,
|
|
2918
|
+
kv: ()=>DEFAULT_CONFIG_EXTENSIONS,
|
|
2919
|
+
t: ()=>DEFAULT_CONFIG_NAME,
|
|
2920
|
+
vO: ()=>TEST_DELIMITER,
|
|
2921
|
+
zZ: ()=>TEMP_RSTEST_OUTPUT_DIR
|
|
2922
2922
|
});
|
|
2923
2923
|
const DEFAULT_CONFIG_NAME = 'rstest.config';
|
|
2924
2924
|
const TEST_DELIMITER = '>';
|
|
@@ -2935,17 +2935,17 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2935
2935
|
},
|
|
2936
2936
|
"./src/utils/helper.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2937
2937
|
__webpack_require__.d(__webpack_exports__, {
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2938
|
+
C3: ()=>needFlagExperimentalDetectModule,
|
|
2939
|
+
FI: ()=>getAbsolutePath,
|
|
2940
|
+
Kv: ()=>NODE_BUILTINS,
|
|
2941
|
+
Ok: ()=>serializableConfig,
|
|
2942
|
+
P2: ()=>parsePosix,
|
|
2943
|
+
Un: ()=>isTTY,
|
|
2944
|
+
Wk: ()=>formatError,
|
|
2945
|
+
bg: ()=>castArray,
|
|
2946
|
+
fN: ()=>getTaskNameWithPrefix,
|
|
2947
|
+
kV: ()=>prettyTime,
|
|
2948
|
+
yW: ()=>picocolors__WEBPACK_IMPORTED_MODULE_2___default.a
|
|
2949
2949
|
});
|
|
2950
2950
|
var pathe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("pathe");
|
|
2951
2951
|
var picocolors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
@@ -2997,7 +2997,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2997
2997
|
return time;
|
|
2998
2998
|
};
|
|
2999
2999
|
const getTaskNames = (test)=>(test.parentNames || []).concat(test.name).filter(Boolean);
|
|
3000
|
-
const getTaskNameWithPrefix = (test, delimiter = _constants__WEBPACK_IMPORTED_MODULE_1__.
|
|
3000
|
+
const getTaskNameWithPrefix = (test, delimiter = _constants__WEBPACK_IMPORTED_MODULE_1__.vO)=>getTaskNames(test).join(` ${delimiter} `);
|
|
3001
3001
|
const REGEXP_FLAG_PREFIX = 'RSTEST_REGEXP:';
|
|
3002
3002
|
const wrapRegex = (value)=>`${REGEXP_FLAG_PREFIX}${value.toString()}`;
|
|
3003
3003
|
const serializableConfig = (normalizedConfig)=>{
|
|
@@ -3090,25 +3090,25 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3090
3090
|
},
|
|
3091
3091
|
"./src/utils/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3092
3092
|
__webpack_require__.d(__webpack_exports__, {
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3093
|
+
C3: ()=>helper.C3,
|
|
3094
|
+
Ok: ()=>helper.Ok,
|
|
3095
|
+
XJ: ()=>formatTestPath,
|
|
3096
|
+
zZ: ()=>constants.zZ,
|
|
3097
|
+
fN: ()=>helper.fN,
|
|
3098
|
+
vF: ()=>logger.v,
|
|
3099
|
+
vO: ()=>constants.vO,
|
|
3100
|
+
tG: ()=>getTestEntries,
|
|
3101
|
+
kv: ()=>constants.kv,
|
|
3102
|
+
yW: ()=>helper.yW,
|
|
3103
|
+
EQ: ()=>prettyTestPath,
|
|
3104
|
+
_o: ()=>logger._,
|
|
3105
|
+
pr: ()=>getSetupFiles,
|
|
3106
|
+
Kv: ()=>helper.Kv,
|
|
3107
|
+
t: ()=>constants.t,
|
|
3108
|
+
kV: ()=>helper.kV,
|
|
3109
|
+
EJ: ()=>constants.EJ,
|
|
3110
|
+
bg: ()=>helper.bg,
|
|
3111
|
+
Un: ()=>helper.Un
|
|
3112
3112
|
});
|
|
3113
3113
|
var constants = __webpack_require__("./src/utils/constants.ts");
|
|
3114
3114
|
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
@@ -3177,12 +3177,12 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3177
3177
|
return;
|
|
3178
3178
|
}
|
|
3179
3179
|
};
|
|
3180
|
-
const getSetupFiles = (setups, rootPath)=>Object.fromEntries((0, helper.
|
|
3181
|
-
const setupFilePath = (0, helper.
|
|
3180
|
+
const getSetupFiles = (setups, rootPath)=>Object.fromEntries((0, helper.bg)(setups).map((setupFile)=>{
|
|
3181
|
+
const setupFilePath = (0, helper.FI)(rootPath, setupFile);
|
|
3182
3182
|
try {
|
|
3183
3183
|
if (!(0, external_node_fs_.existsSync)(setupFilePath)) {
|
|
3184
|
-
let errorMessage = `Setup file ${helper
|
|
3185
|
-
if (setupFilePath !== setupFile) errorMessage += helper
|
|
3184
|
+
let errorMessage = `Setup file ${helper.yW.red(setupFile)} not found`;
|
|
3185
|
+
if (setupFilePath !== setupFile) errorMessage += helper.yW.gray(` (resolved path: ${setupFilePath})`);
|
|
3186
3186
|
throw errorMessage;
|
|
3187
3187
|
}
|
|
3188
3188
|
const relativePath = external_pathe_["default"].relative(rootPath, setupFilePath);
|
|
@@ -3199,8 +3199,8 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3199
3199
|
}
|
|
3200
3200
|
}));
|
|
3201
3201
|
const prettyTestPath = (testPath)=>{
|
|
3202
|
-
const { dir, base } = (0, helper.
|
|
3203
|
-
return `${'.' !== dir ? helper
|
|
3202
|
+
const { dir, base } = (0, helper.P2)(testPath);
|
|
3203
|
+
return `${'.' !== dir ? helper.yW.gray(`${dir}/`) : ''}${helper.yW.cyan(base)}`;
|
|
3204
3204
|
};
|
|
3205
3205
|
const formatTestPath = (root, testFilePath)=>{
|
|
3206
3206
|
let testPath = testFilePath;
|
|
@@ -3210,8 +3210,8 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3210
3210
|
},
|
|
3211
3211
|
"./src/utils/logger.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
3212
3212
|
__webpack_require__.d(__webpack_exports__, {
|
|
3213
|
-
|
|
3214
|
-
|
|
3213
|
+
v: ()=>src_logger,
|
|
3214
|
+
_: ()=>isDebug
|
|
3215
3215
|
});
|
|
3216
3216
|
var external_node_os_ = __webpack_require__("node:os");
|
|
3217
3217
|
var external_node_tty_ = __webpack_require__("node:tty");
|
|
@@ -3482,8 +3482,8 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3482
3482
|
src_logger.override({
|
|
3483
3483
|
debug: (message, ...args)=>{
|
|
3484
3484
|
if ('verbose' !== src_logger.level) return;
|
|
3485
|
-
const time = helper
|
|
3486
|
-
console.log(` ${helper
|
|
3485
|
+
const time = helper.yW.gray(getTime());
|
|
3486
|
+
console.log(` ${helper.yW.magenta('rstest')} ${time} ${message}`, ...args);
|
|
3487
3487
|
}
|
|
3488
3488
|
});
|
|
3489
3489
|
},
|
|
@@ -3825,7 +3825,7 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
3825
3825
|
})();
|
|
3826
3826
|
(()=>{
|
|
3827
3827
|
var installedChunks = {
|
|
3828
|
-
|
|
3828
|
+
410: 0
|
|
3829
3829
|
};
|
|
3830
3830
|
var installChunk = (data)=>{
|
|
3831
3831
|
var __webpack_ids__ = data.__webpack_ids__;
|
|
@@ -3864,17 +3864,17 @@ var logger = __webpack_require__("./src/utils/logger.ts");
|
|
|
3864
3864
|
var commands = __webpack_require__("./src/cli/commands.ts");
|
|
3865
3865
|
var prepare = __webpack_require__("./src/cli/prepare.ts");
|
|
3866
3866
|
async function runCLI() {
|
|
3867
|
-
(0, prepare.
|
|
3867
|
+
(0, prepare.k)();
|
|
3868
3868
|
try {
|
|
3869
|
-
(0, commands.
|
|
3869
|
+
(0, commands.QF)();
|
|
3870
3870
|
} catch (err) {
|
|
3871
|
-
logger.
|
|
3872
|
-
logger.
|
|
3871
|
+
logger.v.error('Failed to start Rstest CLI.');
|
|
3872
|
+
logger.v.error(err);
|
|
3873
3873
|
}
|
|
3874
3874
|
}
|
|
3875
3875
|
var src_config = __webpack_require__("./src/config.ts");
|
|
3876
3876
|
function defineConfig(config) {
|
|
3877
3877
|
return config;
|
|
3878
3878
|
}
|
|
3879
|
-
var __webpack_exports__mergeRstestConfig = src_config.
|
|
3879
|
+
var __webpack_exports__mergeRstestConfig = src_config.ST;
|
|
3880
3880
|
export { defineConfig, runCLI, __webpack_exports__mergeRstestConfig as mergeRstestConfig };
|
package/dist/worker.js
CHANGED
|
@@ -4967,11 +4967,11 @@ var __webpack_modules__ = {
|
|
|
4967
4967
|
},
|
|
4968
4968
|
"./src/runtime/util.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4969
4969
|
__webpack_require__.d(__webpack_exports__, {
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4970
|
+
zH: ()=>setRealTimers,
|
|
4971
|
+
nD: ()=>formatName,
|
|
4972
|
+
o9: ()=>formatTestError,
|
|
4973
|
+
si: ()=>TestRegisterError,
|
|
4974
|
+
rZ: ()=>getRealTimers
|
|
4975
4975
|
});
|
|
4976
4976
|
var external_node_util_ = __webpack_require__("node:util");
|
|
4977
4977
|
var build = __webpack_require__("../../node_modules/.pnpm/jest-diff@30.0.5/node_modules/jest-diff/build/index.js");
|
|
@@ -5045,9 +5045,9 @@ var __webpack_modules__ = {
|
|
|
5045
5045
|
},
|
|
5046
5046
|
"./src/utils/constants.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
5047
5047
|
__webpack_require__.d(__webpack_exports__, {
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5048
|
+
TE: ()=>globalApis,
|
|
5049
|
+
q_: ()=>ROOT_SUITE_NAME,
|
|
5050
|
+
vO: ()=>TEST_DELIMITER
|
|
5051
5051
|
});
|
|
5052
5052
|
const TEST_DELIMITER = '>';
|
|
5053
5053
|
const ROOT_SUITE_NAME = 'Rstest:_internal_root_suite';
|
|
@@ -5067,12 +5067,12 @@ var __webpack_modules__ = {
|
|
|
5067
5067
|
},
|
|
5068
5068
|
"./src/utils/helper.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
5069
5069
|
__webpack_require__.d(__webpack_exports__, {
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5070
|
+
Gv: ()=>isObject,
|
|
5071
|
+
bg: ()=>castArray,
|
|
5072
|
+
fN: ()=>getTaskNameWithPrefix,
|
|
5073
|
+
gy: ()=>undoSerializableConfig,
|
|
5074
|
+
kV: ()=>prettyTime,
|
|
5075
|
+
yW: ()=>picocolors__WEBPACK_IMPORTED_MODULE_2___default.a
|
|
5076
5076
|
});
|
|
5077
5077
|
__webpack_require__("pathe");
|
|
5078
5078
|
var picocolors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
@@ -5104,7 +5104,7 @@ var __webpack_modules__ = {
|
|
|
5104
5104
|
return time;
|
|
5105
5105
|
};
|
|
5106
5106
|
const getTaskNames = (test)=>(test.parentNames || []).concat(test.name).filter(Boolean);
|
|
5107
|
-
const getTaskNameWithPrefix = (test, delimiter = _constants__WEBPACK_IMPORTED_MODULE_1__.
|
|
5107
|
+
const getTaskNameWithPrefix = (test, delimiter = _constants__WEBPACK_IMPORTED_MODULE_1__.vO)=>getTaskNames(test).join(` ${delimiter} `);
|
|
5108
5108
|
const REGEXP_FLAG_PREFIX = 'RSTEST_REGEXP:';
|
|
5109
5109
|
const unwrapRegex = (value)=>{
|
|
5110
5110
|
if (value.startsWith(REGEXP_FLAG_PREFIX)) {
|
|
@@ -5127,7 +5127,7 @@ var __webpack_modules__ = {
|
|
|
5127
5127
|
},
|
|
5128
5128
|
"./src/utils/logger.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
5129
5129
|
__webpack_require__.d(__webpack_exports__, {
|
|
5130
|
-
|
|
5130
|
+
v: ()=>src_logger
|
|
5131
5131
|
});
|
|
5132
5132
|
var external_node_os_ = __webpack_require__("node:os");
|
|
5133
5133
|
var external_node_tty_ = __webpack_require__("node:tty");
|
|
@@ -5398,8 +5398,8 @@ var __webpack_modules__ = {
|
|
|
5398
5398
|
src_logger.override({
|
|
5399
5399
|
debug: (message, ...args)=>{
|
|
5400
5400
|
if ('verbose' !== src_logger.level) return;
|
|
5401
|
-
const time = helper
|
|
5402
|
-
console.log(` ${helper
|
|
5401
|
+
const time = helper.yW.gray(getTime());
|
|
5402
|
+
console.log(` ${helper.yW.magenta('rstest')} ${time} ${message}`, ...args);
|
|
5403
5403
|
}
|
|
5404
5404
|
});
|
|
5405
5405
|
},
|
|
@@ -5533,7 +5533,7 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
5533
5533
|
})();
|
|
5534
5534
|
(()=>{
|
|
5535
5535
|
var installedChunks = {
|
|
5536
|
-
|
|
5536
|
+
270: 0
|
|
5537
5537
|
};
|
|
5538
5538
|
var installChunk = (data)=>{
|
|
5539
5539
|
var __webpack_ids__ = data.__webpack_ids__;
|
|
@@ -5641,7 +5641,7 @@ const createRequire = (filename, distPath, rstestContext, assetFiles, interopDef
|
|
|
5641
5641
|
interopDefault
|
|
5642
5642
|
});
|
|
5643
5643
|
} catch (err) {
|
|
5644
|
-
logger.
|
|
5644
|
+
logger.v.error(`load file ${joinedPath} failed:\n`, err instanceof Error ? err.message : err);
|
|
5645
5645
|
}
|
|
5646
5646
|
const resolved = _require.resolve(id);
|
|
5647
5647
|
return _require(resolved);
|
|
@@ -5804,20 +5804,20 @@ class RstestSnapshotEnvironment extends NodeSnapshotEnvironment {
|
|
|
5804
5804
|
return `// Rstest Snapshot v${this.getVersion()}`;
|
|
5805
5805
|
}
|
|
5806
5806
|
}
|
|
5807
|
-
const getGlobalApi = (api)=>constants.
|
|
5807
|
+
const getGlobalApi = (api)=>constants.TE.reduce((apis, key)=>{
|
|
5808
5808
|
apis[key] = api[key];
|
|
5809
5809
|
return apis;
|
|
5810
5810
|
}, {});
|
|
5811
5811
|
const listeners = [];
|
|
5812
5812
|
let isTeardown = false;
|
|
5813
5813
|
const preparePool = async ({ entryInfo: { distPath, testPath }, sourceMaps, updateSnapshot, context })=>{
|
|
5814
|
-
(0, util.
|
|
5815
|
-
context.runtimeConfig = (0, helper.
|
|
5814
|
+
(0, util.zH)();
|
|
5815
|
+
context.runtimeConfig = (0, helper.gy)(context.runtimeConfig);
|
|
5816
5816
|
const cleanupFns = [];
|
|
5817
5817
|
const { rpc } = createRuntimeRpc(createForksRpcOptions());
|
|
5818
5818
|
const { runtimeConfig: { globals, printConsoleTrace, disableConsoleIntercept, testEnvironment } } = context;
|
|
5819
5819
|
if (!disableConsoleIntercept) {
|
|
5820
|
-
const { createCustomConsole } = await __webpack_require__.e("
|
|
5820
|
+
const { createCustomConsole } = await __webpack_require__.e("607").then(__webpack_require__.bind(__webpack_require__, "./src/runtime/worker/console.ts"));
|
|
5821
5821
|
global.console = createCustomConsole({
|
|
5822
5822
|
rpc,
|
|
5823
5823
|
testPath,
|
|
@@ -5836,10 +5836,10 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, sourceMaps, upda
|
|
|
5836
5836
|
environment: 'node'
|
|
5837
5837
|
};
|
|
5838
5838
|
const { createRstestRuntime } = await Promise.all([
|
|
5839
|
-
__webpack_require__.e("
|
|
5840
|
-
__webpack_require__.e("
|
|
5839
|
+
__webpack_require__.e("655"),
|
|
5840
|
+
__webpack_require__.e("85")
|
|
5841
5841
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/runtime/api/index.ts"));
|
|
5842
|
-
const { install } = await __webpack_require__.e("
|
|
5842
|
+
const { install } = await __webpack_require__.e("969").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js", 23));
|
|
5843
5843
|
install({
|
|
5844
5844
|
retrieveSourceMap: (source)=>{
|
|
5845
5845
|
if (sourceMaps[source]) return {
|
|
@@ -5849,14 +5849,16 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, sourceMaps, upda
|
|
|
5849
5849
|
return null;
|
|
5850
5850
|
}
|
|
5851
5851
|
});
|
|
5852
|
-
listeners.forEach((fn)=>
|
|
5852
|
+
listeners.forEach((fn)=>{
|
|
5853
|
+
fn();
|
|
5854
|
+
});
|
|
5853
5855
|
listeners.length = 0;
|
|
5854
5856
|
const unhandledErrors = [];
|
|
5855
5857
|
const handleError = (e, type)=>{
|
|
5856
5858
|
const error = 'string' == typeof e ? new Error(e) : e;
|
|
5857
5859
|
error.name = type;
|
|
5858
5860
|
if (isTeardown) {
|
|
5859
|
-
error.stack = `${helper
|
|
5861
|
+
error.stack = `${helper.yW.yellow('Caught error after test environment was torn down:')}\n\n${error.stack}`;
|
|
5860
5862
|
console.error(error);
|
|
5861
5863
|
} else {
|
|
5862
5864
|
console.error(error);
|
|
@@ -5877,14 +5879,14 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, sourceMaps, upda
|
|
|
5877
5879
|
break;
|
|
5878
5880
|
case 'jsdom':
|
|
5879
5881
|
{
|
|
5880
|
-
const { environment } = await __webpack_require__.e("
|
|
5882
|
+
const { environment } = await __webpack_require__.e("711").then(__webpack_require__.bind(__webpack_require__, "./src/runtime/worker/env/jsdom.ts"));
|
|
5881
5883
|
const { teardown } = await environment.setup(global, {});
|
|
5882
5884
|
cleanupFns.push(()=>teardown(global));
|
|
5883
5885
|
break;
|
|
5884
5886
|
}
|
|
5885
5887
|
case 'happy-dom':
|
|
5886
5888
|
{
|
|
5887
|
-
const { environment } = await __webpack_require__.e("
|
|
5889
|
+
const { environment } = await __webpack_require__.e("350").then(__webpack_require__.bind(__webpack_require__, "./src/runtime/worker/env/happyDom.ts"));
|
|
5888
5890
|
const { teardown } = await environment.setup(global, {});
|
|
5889
5891
|
cleanupFns.push(async ()=>teardown(global));
|
|
5890
5892
|
break;
|
|
@@ -5958,7 +5960,7 @@ const runInPool = async (options)=>{
|
|
|
5958
5960
|
});
|
|
5959
5961
|
process.off('SIGTERM', onExit);
|
|
5960
5962
|
const teardown = async ()=>{
|
|
5961
|
-
await new Promise((resolve)=>(0, util.
|
|
5963
|
+
await new Promise((resolve)=>(0, util.rZ)().setTimeout(resolve));
|
|
5962
5964
|
await Promise.all(cleanups.map((fn)=>fn()));
|
|
5963
5965
|
isTeardown = true;
|
|
5964
5966
|
process.once('SIGTERM', onExit);
|
|
@@ -5979,13 +5981,13 @@ const runInPool = async (options)=>{
|
|
|
5979
5981
|
return {
|
|
5980
5982
|
testPath,
|
|
5981
5983
|
tests,
|
|
5982
|
-
errors: (0, util.
|
|
5984
|
+
errors: (0, util.o9)(unhandledErrors)
|
|
5983
5985
|
};
|
|
5984
5986
|
} catch (err) {
|
|
5985
5987
|
return {
|
|
5986
5988
|
testPath,
|
|
5987
5989
|
tests: [],
|
|
5988
|
-
errors: (0, util.
|
|
5990
|
+
errors: (0, util.o9)(err)
|
|
5989
5991
|
};
|
|
5990
5992
|
} finally{
|
|
5991
5993
|
await teardown();
|
|
@@ -6015,7 +6017,7 @@ const runInPool = async (options)=>{
|
|
|
6015
6017
|
}, api);
|
|
6016
6018
|
if (unhandledErrors.length > 0) {
|
|
6017
6019
|
results.status = 'fail';
|
|
6018
|
-
results.errors = (results.errors || []).concat(...(0, util.
|
|
6020
|
+
results.errors = (results.errors || []).concat(...(0, util.o9)(unhandledErrors));
|
|
6019
6021
|
}
|
|
6020
6022
|
return results;
|
|
6021
6023
|
} catch (err) {
|
|
@@ -6024,7 +6026,7 @@ const runInPool = async (options)=>{
|
|
|
6024
6026
|
status: 'fail',
|
|
6025
6027
|
name: '',
|
|
6026
6028
|
results: [],
|
|
6027
|
-
errors: (0, util.
|
|
6029
|
+
errors: (0, util.o9)(err)
|
|
6028
6030
|
};
|
|
6029
6031
|
} finally{
|
|
6030
6032
|
await teardown();
|
package/dist-types/index.d.ts
CHANGED
package/dist-types/worker.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rstest/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "The Rsbuild-based test tool.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rstest/issues"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"chai": "^5.2.1",
|
|
48
48
|
"@types/chai": "^5.2.2",
|
|
49
|
-
"@rsbuild/core": "1.4
|
|
49
|
+
"@rsbuild/core": "1.5.0-beta.4",
|
|
50
50
|
"birpc": "2.5.0",
|
|
51
51
|
"pathe": "^2.0.3",
|
|
52
52
|
"std-env": "^3.9.0",
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"@vitest/expect": "^3.2.4",
|
|
57
57
|
"@vitest/snapshot": "^3.2.4",
|
|
58
58
|
"@babel/code-frame": "^7.27.1",
|
|
59
|
-
"@jridgewell/trace-mapping": "0.3.
|
|
59
|
+
"@jridgewell/trace-mapping": "0.3.30",
|
|
60
60
|
"@microsoft/api-extractor": "^7.52.10",
|
|
61
|
-
"@rslib/core": "0.
|
|
61
|
+
"@rslib/core": "0.12.2",
|
|
62
62
|
"@sinonjs/fake-timers": "^14.0.0",
|
|
63
63
|
"@types/babel__code-frame": "^7.0.6",
|
|
64
64
|
"@types/jsdom": "^21.1.7",
|
|
File without changes
|
|
File without changes
|