@rstest/core 0.9.0 → 0.9.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/LICENSE.md +2 -2
- package/dist/{0~89.js → 0~8843.js} +49 -33
- package/dist/{0~1472.js → 0~browserLoader.js} +5 -5
- package/dist/{0~7882.js → 0~browser~1.js} +46 -47
- package/dist/{0~8426.js → 0~checkThresholds.js} +2 -2
- package/dist/{0~130.js → 0~console.js} +15 -17
- package/dist/0~dist.js +1014 -0
- package/dist/{0~7583.js → 0~esm.js} +68 -70
- package/dist/{0~4403.js → 0~generate.js} +5 -6
- package/dist/{0~4809.js → 0~happyDom.js} +2 -2
- package/dist/{0~3346.js → 0~interop.js} +0 -1
- package/dist/{0~62.js → 0~jsdom.js} +2 -2
- package/dist/{0~262.js → 0~lib.js} +4 -1
- package/dist/{0~9634.js → 0~listTests.js} +14 -23
- package/dist/{0~6923.js → 0~loadEsModule.js} +16 -8
- package/dist/{0~5835.js → 0~loadModule.js} +27 -14
- package/dist/{0~6907.js → 0~magic-string.es.js} +2 -1
- package/dist/{0~2255.js → 0~plugin.js} +2 -4
- package/dist/{0~6588.js → 0~restart.js} +7 -11
- package/dist/{0~2173.js → 0~runTests.js} +27 -19
- package/dist/{487.js → 1255.js} +22 -15
- package/dist/{6151.js → 1949.js} +3027 -36
- package/dist/{6973.js → 255.js} +7 -8
- package/dist/{9131.js → 3145.js} +220 -486
- package/dist/{1157.js → 4411.js} +35 -35
- package/dist/{4484.js → 5040.js} +1 -2
- package/dist/{3160.js → 6830.js} +396 -93
- package/dist/7011.js +1 -1
- package/dist/{1294.js → 7552.js} +28 -22
- package/dist/{5734.js → 7704.js} +6 -5
- package/dist/browser-runtime/{2~907.js → 2~magic-string.es.js} +18 -11
- package/dist/browser-runtime/{389.js → 723.js} +3059 -80
- package/dist/browser-runtime/{389.js.LICENSE.txt → 723.js.LICENSE.txt} +0 -22
- package/dist/browser-runtime/index.js +1 -1
- package/dist/browser-runtime/rslib-runtime.js +11 -3
- package/dist/browser.js +9 -7
- package/dist/globalSetupWorker.js +4 -13
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -2
- package/dist/mockRuntimeCode.js +15 -9
- package/dist/rslib-runtime.js +5 -8
- package/dist/worker.js +23 -46
- package/package.json +12 -10
- package/dist/0~1240.js +0 -951
- package/dist/0~1981.js +0 -2
- package/dist/3160.js.LICENSE.txt +0 -21
- package/dist/4881.js +0 -2
- package/dist/6198.js +0 -2
- package/dist/721.js +0 -8
- /package/dist/{0~7583.js.LICENSE.txt → 0~esm.js.LICENSE.txt} +0 -0
- /package/dist/{0~3062.js → 0~utils.js} +0 -0
- /package/dist/{6151.js.LICENSE.txt → 1949.js.LICENSE.txt} +0 -0
- /package/dist/{4597.js → 1983.js} +0 -0
- /package/dist/{1294.js.LICENSE.txt → 7552.js.LICENSE.txt} +0 -0
package/dist/{9131.js → 3145.js}
RENAMED
|
@@ -1,27 +1,48 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import "
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
3
|
+
import node_fs, { existsSync, readFileSync, statSync } from "node:fs";
|
|
4
|
+
import { loadConfig, mergeRsbuildConfig } from "@rsbuild/core";
|
|
5
|
+
import { stripVTControlCharacters } from "node:util";
|
|
6
|
+
import promises from "node:fs/promises";
|
|
7
|
+
import node_path, { dirname as external_node_path_dirname, resolve as external_node_path_resolve } from "node:path";
|
|
8
|
+
import { createRequire } from "node:module";
|
|
9
|
+
import node_process from "node:process";
|
|
10
|
+
import { basename, isTTY, dirname as pathe_M_eThtNZ_dirname, resolve as pathe_M_eThtNZ_resolve, relative, getAbsolutePath, join, bgColor, formatRootStr, determineAgent, logger as logger_logger, castArray, dist_m, prettyTime, isDebug, color, isAbsolute, getTaskNameWithPrefix, normalize, formatError } from "./6830.js";
|
|
11
|
+
import { isDynamicPattern, glob, DEFAULT_CONFIG_NAME, prettyTestPath, globalApis, TEMP_RSTEST_OUTPUT_DIR_GLOB, formatTestPath, filterProjects, DEFAULT_CONFIG_EXTENSIONS, TS_CONFIG_FILE } from "./4411.js";
|
|
8
12
|
import { posix } from "./7011.js";
|
|
9
13
|
import { parse as stack_trace_parser_esm_parse } from "./1672.js";
|
|
10
14
|
import { decode } from "./4397.js";
|
|
11
|
-
import
|
|
15
|
+
import "./5040.js";
|
|
16
|
+
var init_namespaceObject = {};
|
|
17
|
+
__webpack_require__.r(init_namespaceObject);
|
|
18
|
+
__webpack_require__.d(init_namespaceObject, {
|
|
19
|
+
initCli: ()=>init_initCli
|
|
20
|
+
});
|
|
21
|
+
var src_core_namespaceObject = {};
|
|
22
|
+
__webpack_require__.r(src_core_namespaceObject);
|
|
23
|
+
__webpack_require__.d(src_core_namespaceObject, {
|
|
24
|
+
createRstest: ()=>core_createRstest
|
|
25
|
+
});
|
|
26
|
+
var error_namespaceObject = {};
|
|
27
|
+
__webpack_require__.r(error_namespaceObject);
|
|
28
|
+
__webpack_require__.d(error_namespaceObject, {
|
|
29
|
+
C: ()=>formatStack,
|
|
30
|
+
parseErrorStacktrace: ()=>error_parseErrorStacktrace,
|
|
31
|
+
printError: ()=>error_printError
|
|
32
|
+
});
|
|
12
33
|
function toArr(any) {
|
|
13
34
|
return null == any ? [] : Array.isArray(any) ? any : [
|
|
14
35
|
any
|
|
15
36
|
];
|
|
16
37
|
}
|
|
17
38
|
function toVal(out, key, val, opts) {
|
|
18
|
-
var x, old = out[key], nxt = ~opts.string.indexOf(key) ? null == val || true === val ?
|
|
39
|
+
var x, old = out[key], nxt = ~opts.string.indexOf(key) ? null == val || true === val ? "" : String(val) : "boolean" == typeof val ? val : ~opts.boolean.indexOf(key) ? "false" === val ? false : "true" === val || (out._.push((x = +val, 0 * x === 0) ? x : val), !!val) : (x = +val, 0 * x === 0) ? x : val;
|
|
19
40
|
out[key] = null == old ? nxt : Array.isArray(old) ? old.concat(nxt) : [
|
|
20
41
|
old,
|
|
21
42
|
nxt
|
|
22
43
|
];
|
|
23
44
|
}
|
|
24
|
-
function
|
|
45
|
+
function lib_default(args, opts) {
|
|
25
46
|
args = args || [];
|
|
26
47
|
opts = opts || {};
|
|
27
48
|
var k, arr, arg, name, val, out = {
|
|
@@ -57,26 +78,26 @@ function mri2(args, opts) {
|
|
|
57
78
|
const keys = strict ? Object.keys(opts.alias) : [];
|
|
58
79
|
for(i = 0; i < len; i++){
|
|
59
80
|
arg = args[i];
|
|
60
|
-
if (
|
|
81
|
+
if ("--" === arg) {
|
|
61
82
|
out._ = out._.concat(args.slice(++i));
|
|
62
83
|
break;
|
|
63
84
|
}
|
|
64
85
|
for(j = 0; j < arg.length && 45 === arg.charCodeAt(j); j++);
|
|
65
86
|
if (0 === j) out._.push(arg);
|
|
66
|
-
else if (
|
|
87
|
+
else if ("no-" === arg.substring(j, j + 3)) {
|
|
67
88
|
name = arg.substring(j + 3);
|
|
68
89
|
if (strict && !~keys.indexOf(name)) return opts.unknown(arg);
|
|
69
90
|
out[name] = false;
|
|
70
91
|
} else {
|
|
71
92
|
for(idx = j + 1; idx < arg.length && 61 !== arg.charCodeAt(idx); idx++);
|
|
72
93
|
name = arg.substring(j, idx);
|
|
73
|
-
val = arg.substring(++idx) || i + 1 === len || 45 === (
|
|
94
|
+
val = arg.substring(++idx) || i + 1 === len || 45 === ("" + args[i + 1]).charCodeAt(0) || args[++i];
|
|
74
95
|
arr = 2 === j ? [
|
|
75
96
|
name
|
|
76
97
|
] : name;
|
|
77
98
|
for(idx = 0; idx < arr.length; idx++){
|
|
78
99
|
name = arr[idx];
|
|
79
|
-
if (strict && !~keys.indexOf(name)) return opts.unknown(
|
|
100
|
+
if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
|
|
80
101
|
toVal(out, name, idx + 1 < arr.length || val, opts);
|
|
81
102
|
}
|
|
82
103
|
}
|
|
@@ -90,8 +111,10 @@ function mri2(args, opts) {
|
|
|
90
111
|
}
|
|
91
112
|
return out;
|
|
92
113
|
}
|
|
93
|
-
|
|
94
|
-
|
|
114
|
+
function removeBrackets(v) {
|
|
115
|
+
return v.replace(/[<[].+/, "").trim();
|
|
116
|
+
}
|
|
117
|
+
function findAllBrackets(v) {
|
|
95
118
|
const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
|
|
96
119
|
const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
|
|
97
120
|
const res = [];
|
|
@@ -113,8 +136,8 @@ const findAllBrackets = (v)=>{
|
|
|
113
136
|
let squareMatch;
|
|
114
137
|
while(squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v))res.push(parse(squareMatch));
|
|
115
138
|
return res;
|
|
116
|
-
}
|
|
117
|
-
|
|
139
|
+
}
|
|
140
|
+
function getMriOptions(options) {
|
|
118
141
|
const result = {
|
|
119
142
|
alias: {},
|
|
120
143
|
boolean: []
|
|
@@ -122,53 +145,74 @@ const getMriOptions = (options)=>{
|
|
|
122
145
|
for (const [index, option] of options.entries()){
|
|
123
146
|
if (option.names.length > 1) result.alias[option.names[0]] = option.names.slice(1);
|
|
124
147
|
if (option.isBoolean) if (option.negated) {
|
|
125
|
-
|
|
126
|
-
if (!hasStringTypeOption) result.boolean.push(option.names[0]);
|
|
148
|
+
if (!options.some((o, i)=>i !== index && o.names.some((name)=>option.names.includes(name)) && "boolean" == typeof o.required)) result.boolean.push(option.names[0]);
|
|
127
149
|
} else result.boolean.push(option.names[0]);
|
|
128
150
|
}
|
|
129
151
|
return result;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
152
|
+
}
|
|
153
|
+
function findLongest(arr) {
|
|
154
|
+
return arr.sort((a, b)=>a.length > b.length ? -1 : 1)[0];
|
|
155
|
+
}
|
|
156
|
+
function padRight(str, length) {
|
|
157
|
+
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
|
|
158
|
+
}
|
|
159
|
+
function camelcase(input) {
|
|
160
|
+
return input.replaceAll(/([a-z])-([a-z])/g, (_, p1, p2)=>p1 + p2.toUpperCase());
|
|
161
|
+
}
|
|
162
|
+
function setDotProp(obj, keys, val) {
|
|
163
|
+
let current = obj;
|
|
164
|
+
for(let i = 0; i < keys.length; i++){
|
|
165
|
+
const key = keys[i];
|
|
166
|
+
if (i === keys.length - 1) {
|
|
167
|
+
current[key] = val;
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (null == current[key]) {
|
|
171
|
+
const nextKeyIsArrayIndex = +keys[i + 1] > -1;
|
|
172
|
+
current[key] = nextKeyIsArrayIndex ? [] : {};
|
|
173
|
+
}
|
|
174
|
+
current = current[key];
|
|
142
175
|
}
|
|
143
|
-
}
|
|
144
|
-
|
|
176
|
+
}
|
|
177
|
+
function setByType(obj, transforms) {
|
|
145
178
|
for (const key of Object.keys(transforms)){
|
|
146
179
|
const transform = transforms[key];
|
|
147
180
|
if (transform.shouldTransform) {
|
|
148
|
-
obj[key] =
|
|
181
|
+
obj[key] = [
|
|
182
|
+
obj[key]
|
|
183
|
+
].flat();
|
|
149
184
|
if ("function" == typeof transform.transformFunction) obj[key] = obj[key].map(transform.transformFunction);
|
|
150
185
|
}
|
|
151
186
|
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const m = /([
|
|
187
|
+
}
|
|
188
|
+
function getFileName(input) {
|
|
189
|
+
const m = /([^\\/]+)$/.exec(input);
|
|
155
190
|
return m ? m[1] : "";
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
191
|
+
}
|
|
192
|
+
function camelcaseOptionName(name) {
|
|
193
|
+
return name.split(".").map((v, i)=>0 === i ? camelcase(v) : v).join(".");
|
|
194
|
+
}
|
|
195
|
+
var CACError = class extends Error {
|
|
159
196
|
constructor(message){
|
|
160
197
|
super(message);
|
|
161
|
-
this.name =
|
|
162
|
-
if ("function"
|
|
163
|
-
else this.stack = new Error(message).stack;
|
|
198
|
+
this.name = "CACError";
|
|
199
|
+
if ("function" != typeof Error.captureStackTrace) this.stack = new Error(message).stack;
|
|
164
200
|
}
|
|
165
|
-
}
|
|
166
|
-
|
|
201
|
+
};
|
|
202
|
+
var Option = class {
|
|
203
|
+
rawName;
|
|
204
|
+
description;
|
|
205
|
+
name;
|
|
206
|
+
names;
|
|
207
|
+
isBoolean;
|
|
208
|
+
required;
|
|
209
|
+
config;
|
|
210
|
+
negated;
|
|
167
211
|
constructor(rawName, description, config){
|
|
168
212
|
this.rawName = rawName;
|
|
169
213
|
this.description = description;
|
|
170
214
|
this.config = Object.assign({}, config);
|
|
171
|
-
rawName = rawName.
|
|
215
|
+
rawName = rawName.replaceAll(".*", "");
|
|
172
216
|
this.negated = false;
|
|
173
217
|
this.names = removeBrackets(rawName).split(",").map((v)=>{
|
|
174
218
|
let name = v.trim().replace(/^-{1,2}/, "");
|
|
@@ -178,16 +222,36 @@ class Option {
|
|
|
178
222
|
}
|
|
179
223
|
return camelcaseOptionName(name);
|
|
180
224
|
}).sort((a, b)=>a.length > b.length ? 1 : -1);
|
|
181
|
-
this.name = this.names
|
|
225
|
+
this.name = this.names.at(-1);
|
|
182
226
|
if (this.negated && null == this.config.default) this.config.default = true;
|
|
183
227
|
if (rawName.includes("<")) this.required = true;
|
|
184
228
|
else if (rawName.includes("[")) this.required = false;
|
|
185
229
|
else this.isBoolean = true;
|
|
186
230
|
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
231
|
+
};
|
|
232
|
+
let runtimeProcessArgs;
|
|
233
|
+
let runtimeInfo;
|
|
234
|
+
if ("u" > typeof process) {
|
|
235
|
+
let runtimeName;
|
|
236
|
+
runtimeName = "u" > typeof Deno && "string" == typeof Deno.version?.deno ? "deno" : "u" > typeof Bun && "string" == typeof Bun.version ? "bun" : "node";
|
|
237
|
+
runtimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`;
|
|
238
|
+
runtimeProcessArgs = process.argv;
|
|
239
|
+
} else runtimeInfo = "u" < typeof navigator ? "unknown" : `${navigator.platform} ${navigator.userAgent}`;
|
|
240
|
+
var Command = class {
|
|
241
|
+
rawName;
|
|
242
|
+
description;
|
|
243
|
+
config;
|
|
244
|
+
cli;
|
|
245
|
+
options;
|
|
246
|
+
aliasNames;
|
|
247
|
+
name;
|
|
248
|
+
args;
|
|
249
|
+
commandAction;
|
|
250
|
+
usageText;
|
|
251
|
+
versionNumber;
|
|
252
|
+
examples;
|
|
253
|
+
helpCallback;
|
|
254
|
+
globalCommand;
|
|
191
255
|
constructor(rawName, description, config = {}, cli){
|
|
192
256
|
this.rawName = rawName;
|
|
193
257
|
this.description = description;
|
|
@@ -258,14 +322,12 @@ class Command {
|
|
|
258
322
|
title: "Usage",
|
|
259
323
|
body: ` $ ${name} ${this.usageText || this.rawName}`
|
|
260
324
|
});
|
|
261
|
-
|
|
262
|
-
if (showCommands) {
|
|
325
|
+
if ((this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0) {
|
|
263
326
|
const longestCommandName = findLongest(commands.map((command)=>command.rawName));
|
|
264
327
|
sections.push({
|
|
265
328
|
title: "Commands",
|
|
266
329
|
body: commands.map((command)=>` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`).join("\n")
|
|
267
|
-
}
|
|
268
|
-
sections.push({
|
|
330
|
+
}, {
|
|
269
331
|
title: "For more info, run any command with the `--help` flag",
|
|
270
332
|
body: commands.map((command)=>` $ ${name}${"" === command.name ? "" : ` ${command.name}`} --help`).join("\n")
|
|
271
333
|
});
|
|
@@ -290,13 +352,12 @@ class Command {
|
|
|
290
352
|
}).join("\n")
|
|
291
353
|
});
|
|
292
354
|
if (helpCallback) sections = helpCallback(sections) || sections;
|
|
293
|
-
console.
|
|
294
|
-
${section.body}` : section.body).join("\n\n"));
|
|
355
|
+
console.info(sections.map((section)=>section.title ? `${section.title}:\n${section.body}` : section.body).join("\n\n"));
|
|
295
356
|
}
|
|
296
357
|
outputVersion() {
|
|
297
358
|
const { name } = this.cli;
|
|
298
359
|
const { versionNumber } = this.cli.globalCommand;
|
|
299
|
-
if (versionNumber) console.
|
|
360
|
+
if (versionNumber) console.info(`${name}/${versionNumber} ${runtimeInfo}`);
|
|
300
361
|
}
|
|
301
362
|
checkRequiredArgs() {
|
|
302
363
|
const minimalArgsCount = this.args.filter((arg)=>arg.required).length;
|
|
@@ -322,14 +383,27 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
322
383
|
}
|
|
323
384
|
}
|
|
324
385
|
}
|
|
325
|
-
|
|
326
|
-
|
|
386
|
+
checkUnusedArgs() {
|
|
387
|
+
const maximumArgsCount = this.args.some((arg)=>arg.variadic) ? 1 / 0 : this.args.length;
|
|
388
|
+
if (maximumArgsCount < this.cli.args.length) throw new CACError(`Unused args: ${this.cli.args.slice(maximumArgsCount).map((arg)=>`\`${arg}\``).join(", ")}`);
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
var GlobalCommand = class extends Command {
|
|
327
392
|
constructor(cli){
|
|
328
393
|
super("@@global@@", "", {}, cli);
|
|
329
394
|
}
|
|
330
|
-
}
|
|
331
|
-
var
|
|
332
|
-
|
|
395
|
+
};
|
|
396
|
+
var CAC = class extends EventTarget {
|
|
397
|
+
name;
|
|
398
|
+
commands;
|
|
399
|
+
globalCommand;
|
|
400
|
+
matchedCommand;
|
|
401
|
+
matchedCommandName;
|
|
402
|
+
rawArgs;
|
|
403
|
+
args;
|
|
404
|
+
options;
|
|
405
|
+
showHelpOnExit;
|
|
406
|
+
showVersionOnExit;
|
|
333
407
|
constructor(name = ""){
|
|
334
408
|
super();
|
|
335
409
|
this.name = name;
|
|
@@ -387,7 +461,11 @@ class CAC extends EventEmitter {
|
|
|
387
461
|
this.matchedCommand = void 0;
|
|
388
462
|
this.matchedCommandName = void 0;
|
|
389
463
|
}
|
|
390
|
-
parse(argv
|
|
464
|
+
parse(argv, { run = true } = {}) {
|
|
465
|
+
if (!argv) {
|
|
466
|
+
if (!runtimeProcessArgs) throw new Error("No argv provided and runtime process argv is not available.");
|
|
467
|
+
argv = runtimeProcessArgs;
|
|
468
|
+
}
|
|
391
469
|
this.rawArgs = argv;
|
|
392
470
|
if (!this.name) this.name = argv[1] ? getFileName(argv[1]) : "cli";
|
|
393
471
|
let shouldParse = true;
|
|
@@ -396,19 +474,24 @@ class CAC extends EventEmitter {
|
|
|
396
474
|
const commandName = parsed.args[0];
|
|
397
475
|
if (command.isMatched(commandName)) {
|
|
398
476
|
shouldParse = false;
|
|
399
|
-
const parsedInfo =
|
|
477
|
+
const parsedInfo = {
|
|
478
|
+
...parsed,
|
|
400
479
|
args: parsed.args.slice(1)
|
|
401
|
-
}
|
|
480
|
+
};
|
|
402
481
|
this.setParsedInfo(parsedInfo, command, commandName);
|
|
403
|
-
this.
|
|
482
|
+
this.dispatchEvent(new CustomEvent(`command:${commandName}`, {
|
|
483
|
+
detail: command
|
|
484
|
+
}));
|
|
404
485
|
}
|
|
405
486
|
}
|
|
406
487
|
if (shouldParse) {
|
|
407
|
-
for (const command of this.commands)if (
|
|
488
|
+
for (const command of this.commands)if (command.isDefaultCommand) {
|
|
408
489
|
shouldParse = false;
|
|
409
490
|
const parsed = this.mri(argv.slice(2), command);
|
|
410
491
|
this.setParsedInfo(parsed, command);
|
|
411
|
-
this.
|
|
492
|
+
this.dispatchEvent(new CustomEvent("command:!", {
|
|
493
|
+
detail: command
|
|
494
|
+
}));
|
|
412
495
|
}
|
|
413
496
|
}
|
|
414
497
|
if (shouldParse) {
|
|
@@ -430,7 +513,9 @@ class CAC extends EventEmitter {
|
|
|
430
513
|
options: this.options
|
|
431
514
|
};
|
|
432
515
|
if (run) this.runMatchedCommand();
|
|
433
|
-
if (!this.matchedCommand && this.args[0]) this.
|
|
516
|
+
if (!this.matchedCommand && this.args[0]) this.dispatchEvent(new CustomEvent("command:*", {
|
|
517
|
+
detail: this.args[0]
|
|
518
|
+
}));
|
|
434
519
|
return parsedArgv;
|
|
435
520
|
}
|
|
436
521
|
mri(argv, command) {
|
|
@@ -441,12 +526,13 @@ class CAC extends EventEmitter {
|
|
|
441
526
|
const mriOptions = getMriOptions(cliOptions);
|
|
442
527
|
let argsAfterDoubleDashes = [];
|
|
443
528
|
const doubleDashesIndex = argv.indexOf("--");
|
|
444
|
-
if (
|
|
529
|
+
if (-1 !== doubleDashesIndex) {
|
|
445
530
|
argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
|
|
446
531
|
argv = argv.slice(0, doubleDashesIndex);
|
|
447
532
|
}
|
|
448
|
-
let parsed =
|
|
449
|
-
parsed = Object.keys(parsed).reduce((res, name)=>
|
|
533
|
+
let parsed = lib_default(argv, mriOptions);
|
|
534
|
+
parsed = Object.keys(parsed).reduce((res, name)=>({
|
|
535
|
+
...res,
|
|
450
536
|
[camelcaseOptionName(name)]: parsed[name]
|
|
451
537
|
}), {
|
|
452
538
|
_: []
|
|
@@ -456,20 +542,17 @@ class CAC extends EventEmitter {
|
|
|
456
542
|
"--": argsAfterDoubleDashes
|
|
457
543
|
};
|
|
458
544
|
const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
|
|
459
|
-
|
|
545
|
+
const transforms = Object.create(null);
|
|
460
546
|
for (const cliOption of cliOptions){
|
|
461
547
|
if (!ignoreDefault && void 0 !== cliOption.config.default) for (const name of cliOption.names)options[name] = cliOption.config.default;
|
|
462
|
-
if (Array.isArray(cliOption.config.type)) {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
transforms[cliOption.name]["transformFunction"] = cliOption.config.type[0];
|
|
467
|
-
}
|
|
548
|
+
if (Array.isArray(cliOption.config.type) && void 0 === transforms[cliOption.name]) {
|
|
549
|
+
transforms[cliOption.name] = Object.create(null);
|
|
550
|
+
transforms[cliOption.name].shouldTransform = true;
|
|
551
|
+
transforms[cliOption.name].transformFunction = cliOption.config.type[0];
|
|
468
552
|
}
|
|
469
553
|
}
|
|
470
554
|
for (const key of Object.keys(parsed))if ("_" !== key) {
|
|
471
|
-
|
|
472
|
-
setDotProp(options, keys, parsed[key]);
|
|
555
|
+
setDotProp(options, key.split("."), parsed[key]);
|
|
473
556
|
setByType(options, transforms);
|
|
474
557
|
}
|
|
475
558
|
return {
|
|
@@ -483,6 +566,7 @@ class CAC extends EventEmitter {
|
|
|
483
566
|
command.checkUnknownOptions();
|
|
484
567
|
command.checkOptionValue();
|
|
485
568
|
command.checkRequiredArgs();
|
|
569
|
+
command.checkUnusedArgs();
|
|
486
570
|
const actionArgs = [];
|
|
487
571
|
command.args.forEach((arg, index)=>{
|
|
488
572
|
if (arg.variadic) actionArgs.push(args.slice(index));
|
|
@@ -491,9 +575,8 @@ class CAC extends EventEmitter {
|
|
|
491
575
|
actionArgs.push(options);
|
|
492
576
|
return command.commandAction.apply(this, actionArgs);
|
|
493
577
|
}
|
|
494
|
-
}
|
|
578
|
+
};
|
|
495
579
|
const cac = (name = "")=>new CAC(name);
|
|
496
|
-
const dist = cac;
|
|
497
580
|
function initNodeEnv() {
|
|
498
581
|
if (!process.env.NODE_ENV) process.env.NODE_ENV = 'test';
|
|
499
582
|
}
|
|
@@ -504,7 +587,7 @@ function prepareCli() {
|
|
|
504
587
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) logger_logger.log();
|
|
505
588
|
}
|
|
506
589
|
function showRstest() {
|
|
507
|
-
logger_logger.greet(" Rstest v0.9.
|
|
590
|
+
logger_logger.greet(" Rstest v0.9.2");
|
|
508
591
|
logger_logger.log('');
|
|
509
592
|
}
|
|
510
593
|
const applyCommonOptions = (cli)=>{
|
|
@@ -525,13 +608,9 @@ const runRest = async ({ options, filters, command })=>{
|
|
|
525
608
|
handleUnexpectedExit(rstest, err);
|
|
526
609
|
};
|
|
527
610
|
try {
|
|
528
|
-
const { initCli } = await Promise.resolve()
|
|
529
|
-
initCli: init_initCli
|
|
530
|
-
}));
|
|
611
|
+
const { initCli } = await Promise.resolve(init_namespaceObject);
|
|
531
612
|
const { config, configFilePath, projects } = await initCli(options);
|
|
532
|
-
const { createRstest } = await Promise.resolve()
|
|
533
|
-
createRstest: core_createRstest
|
|
534
|
-
}));
|
|
613
|
+
const { createRstest } = await Promise.resolve(src_core_namespaceObject);
|
|
535
614
|
rstest = createRstest({
|
|
536
615
|
config,
|
|
537
616
|
configFilePath,
|
|
@@ -540,10 +619,7 @@ const runRest = async ({ options, filters, command })=>{
|
|
|
540
619
|
process.on('uncaughtException', unexpectedlyExitHandler);
|
|
541
620
|
process.on('unhandledRejection', unexpectedlyExitHandler);
|
|
542
621
|
if ('watch' === command) {
|
|
543
|
-
const { watchFilesForRestart, onBeforeRestart } = await import("./0~
|
|
544
|
-
watchFilesForRestart: mod.watchFilesForRestart,
|
|
545
|
-
onBeforeRestart: mod.onBeforeRestart
|
|
546
|
-
}));
|
|
622
|
+
const { watchFilesForRestart, onBeforeRestart } = await import("./0~restart.js");
|
|
547
623
|
onBeforeRestart(()=>{
|
|
548
624
|
process.off('uncaughtException', unexpectedlyExitHandler);
|
|
549
625
|
process.off('unhandledRejection', unexpectedlyExitHandler);
|
|
@@ -560,9 +636,9 @@ const runRest = async ({ options, filters, command })=>{
|
|
|
560
636
|
}
|
|
561
637
|
};
|
|
562
638
|
function setupCommands() {
|
|
563
|
-
const cli =
|
|
639
|
+
const cli = cac('rstest');
|
|
564
640
|
cli.help();
|
|
565
|
-
cli.version("0.9.
|
|
641
|
+
cli.version("0.9.2");
|
|
566
642
|
applyCommonOptions(cli);
|
|
567
643
|
cli.command('[...filters]', 'run tests').option('-w, --watch', 'Run tests in watch mode').action(async (filters, options)=>{
|
|
568
644
|
if (!determineAgent().isAgent) showRstest();
|
|
@@ -595,14 +671,10 @@ function setupCommands() {
|
|
|
595
671
|
});
|
|
596
672
|
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').option('--includeSuites', 'include suites in output').option('--printLocation', 'print test case location').action(async (filters, options)=>{
|
|
597
673
|
try {
|
|
598
|
-
const { initCli } = await Promise.resolve()
|
|
599
|
-
initCli: init_initCli
|
|
600
|
-
}));
|
|
674
|
+
const { initCli } = await Promise.resolve(init_namespaceObject);
|
|
601
675
|
const { config, configFilePath, projects } = await initCli(options);
|
|
602
676
|
if (options.printLocation) config.includeTaskLocation = true;
|
|
603
|
-
const { createRstest } = await Promise.resolve()
|
|
604
|
-
createRstest: core_createRstest
|
|
605
|
-
}));
|
|
677
|
+
const { createRstest } = await Promise.resolve(src_core_namespaceObject);
|
|
606
678
|
const rstest = createRstest({
|
|
607
679
|
config,
|
|
608
680
|
configFilePath,
|
|
@@ -624,10 +696,7 @@ function setupCommands() {
|
|
|
624
696
|
try {
|
|
625
697
|
let selectedProject = project;
|
|
626
698
|
if (!selectedProject) {
|
|
627
|
-
const { select, isCancel } = await import("./0~
|
|
628
|
-
select: mod.ve,
|
|
629
|
-
isCancel: mod.pD
|
|
630
|
-
}));
|
|
699
|
+
const { select, isCancel } = await import("./0~dist.js");
|
|
631
700
|
console.log();
|
|
632
701
|
const selected = await select({
|
|
633
702
|
message: 'What would you like to initialize?',
|
|
@@ -646,9 +715,7 @@ function setupCommands() {
|
|
|
646
715
|
selectedProject = selected;
|
|
647
716
|
}
|
|
648
717
|
if ('browser' === selectedProject) {
|
|
649
|
-
const { create } = await import("./0~
|
|
650
|
-
create: mod.create
|
|
651
|
-
}));
|
|
718
|
+
const { create } = await import("./0~browser~1.js");
|
|
652
719
|
await create({
|
|
653
720
|
yes: options.yes
|
|
654
721
|
});
|
|
@@ -664,342 +731,18 @@ function setupCommands() {
|
|
|
664
731
|
});
|
|
665
732
|
cli.parse();
|
|
666
733
|
}
|
|
667
|
-
const
|
|
668
|
-
MODE: "production",
|
|
669
|
-
DEV: false,
|
|
670
|
-
PROD: true,
|
|
671
|
-
BASE_URL: "/",
|
|
672
|
-
ASSET_PREFIX: "auto"
|
|
673
|
-
}, dist_o = new Proxy(dist_r, {
|
|
674
|
-
get (e, s) {
|
|
675
|
-
return dist_i()[s] ?? dist_r[s];
|
|
676
|
-
},
|
|
677
|
-
has (e, s) {
|
|
678
|
-
const E = dist_i();
|
|
679
|
-
return s in E || s in dist_r;
|
|
680
|
-
},
|
|
681
|
-
set (e, s, E) {
|
|
682
|
-
const B = dist_i(!0);
|
|
683
|
-
return B[s] = E, !0;
|
|
684
|
-
},
|
|
685
|
-
deleteProperty (e, s) {
|
|
686
|
-
if (!s) return !1;
|
|
687
|
-
const E = dist_i(!0);
|
|
688
|
-
return delete E[s], !0;
|
|
689
|
-
},
|
|
690
|
-
ownKeys () {
|
|
691
|
-
const e = dist_i(!0);
|
|
692
|
-
return Object.keys(e);
|
|
693
|
-
}
|
|
694
|
-
}), dist_t = typeof process < "u" && process.env && process.env.NODE_ENV || "", f = [
|
|
695
|
-
[
|
|
696
|
-
"APPVEYOR"
|
|
697
|
-
],
|
|
698
|
-
[
|
|
699
|
-
"AWS_AMPLIFY",
|
|
700
|
-
"AWS_APP_ID",
|
|
701
|
-
{
|
|
702
|
-
ci: !0
|
|
703
|
-
}
|
|
704
|
-
],
|
|
705
|
-
[
|
|
706
|
-
"AZURE_PIPELINES",
|
|
707
|
-
"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"
|
|
708
|
-
],
|
|
709
|
-
[
|
|
710
|
-
"AZURE_STATIC",
|
|
711
|
-
"INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"
|
|
712
|
-
],
|
|
713
|
-
[
|
|
714
|
-
"APPCIRCLE",
|
|
715
|
-
"AC_APPCIRCLE"
|
|
716
|
-
],
|
|
717
|
-
[
|
|
718
|
-
"BAMBOO",
|
|
719
|
-
"bamboo_planKey"
|
|
720
|
-
],
|
|
721
|
-
[
|
|
722
|
-
"BITBUCKET",
|
|
723
|
-
"BITBUCKET_COMMIT"
|
|
724
|
-
],
|
|
725
|
-
[
|
|
726
|
-
"BITRISE",
|
|
727
|
-
"BITRISE_IO"
|
|
728
|
-
],
|
|
729
|
-
[
|
|
730
|
-
"BUDDY",
|
|
731
|
-
"BUDDY_WORKSPACE_ID"
|
|
732
|
-
],
|
|
733
|
-
[
|
|
734
|
-
"BUILDKITE"
|
|
735
|
-
],
|
|
736
|
-
[
|
|
737
|
-
"CIRCLE",
|
|
738
|
-
"CIRCLECI"
|
|
739
|
-
],
|
|
740
|
-
[
|
|
741
|
-
"CIRRUS",
|
|
742
|
-
"CIRRUS_CI"
|
|
743
|
-
],
|
|
744
|
-
[
|
|
745
|
-
"CLOUDFLARE_PAGES",
|
|
746
|
-
"CF_PAGES",
|
|
747
|
-
{
|
|
748
|
-
ci: !0
|
|
749
|
-
}
|
|
750
|
-
],
|
|
751
|
-
[
|
|
752
|
-
"CLOUDFLARE_WORKERS",
|
|
753
|
-
"WORKERS_CI",
|
|
754
|
-
{
|
|
755
|
-
ci: !0
|
|
756
|
-
}
|
|
757
|
-
],
|
|
758
|
-
[
|
|
759
|
-
"CODEBUILD",
|
|
760
|
-
"CODEBUILD_BUILD_ARN"
|
|
761
|
-
],
|
|
762
|
-
[
|
|
763
|
-
"CODEFRESH",
|
|
764
|
-
"CF_BUILD_ID"
|
|
765
|
-
],
|
|
766
|
-
[
|
|
767
|
-
"DRONE"
|
|
768
|
-
],
|
|
769
|
-
[
|
|
770
|
-
"DRONE",
|
|
771
|
-
"DRONE_BUILD_EVENT"
|
|
772
|
-
],
|
|
773
|
-
[
|
|
774
|
-
"DSARI"
|
|
775
|
-
],
|
|
776
|
-
[
|
|
777
|
-
"GITHUB_ACTIONS"
|
|
778
|
-
],
|
|
779
|
-
[
|
|
780
|
-
"GITLAB",
|
|
781
|
-
"GITLAB_CI"
|
|
782
|
-
],
|
|
783
|
-
[
|
|
784
|
-
"GITLAB",
|
|
785
|
-
"CI_MERGE_REQUEST_ID"
|
|
786
|
-
],
|
|
787
|
-
[
|
|
788
|
-
"GOCD",
|
|
789
|
-
"GO_PIPELINE_LABEL"
|
|
790
|
-
],
|
|
791
|
-
[
|
|
792
|
-
"LAYERCI"
|
|
793
|
-
],
|
|
794
|
-
[
|
|
795
|
-
"HUDSON",
|
|
796
|
-
"HUDSON_URL"
|
|
797
|
-
],
|
|
798
|
-
[
|
|
799
|
-
"JENKINS",
|
|
800
|
-
"JENKINS_URL"
|
|
801
|
-
],
|
|
802
|
-
[
|
|
803
|
-
"MAGNUM"
|
|
804
|
-
],
|
|
805
|
-
[
|
|
806
|
-
"NETLIFY"
|
|
807
|
-
],
|
|
808
|
-
[
|
|
809
|
-
"NETLIFY",
|
|
810
|
-
"NETLIFY_LOCAL",
|
|
811
|
-
{
|
|
812
|
-
ci: !1
|
|
813
|
-
}
|
|
814
|
-
],
|
|
815
|
-
[
|
|
816
|
-
"NEVERCODE"
|
|
817
|
-
],
|
|
818
|
-
[
|
|
819
|
-
"RENDER"
|
|
820
|
-
],
|
|
821
|
-
[
|
|
822
|
-
"SAIL",
|
|
823
|
-
"SAILCI"
|
|
824
|
-
],
|
|
825
|
-
[
|
|
826
|
-
"SEMAPHORE"
|
|
827
|
-
],
|
|
828
|
-
[
|
|
829
|
-
"SCREWDRIVER"
|
|
830
|
-
],
|
|
831
|
-
[
|
|
832
|
-
"SHIPPABLE"
|
|
833
|
-
],
|
|
834
|
-
[
|
|
835
|
-
"SOLANO",
|
|
836
|
-
"TDDIUM"
|
|
837
|
-
],
|
|
838
|
-
[
|
|
839
|
-
"STRIDER"
|
|
840
|
-
],
|
|
841
|
-
[
|
|
842
|
-
"TEAMCITY",
|
|
843
|
-
"TEAMCITY_VERSION"
|
|
844
|
-
],
|
|
845
|
-
[
|
|
846
|
-
"TRAVIS"
|
|
847
|
-
],
|
|
848
|
-
[
|
|
849
|
-
"VERCEL",
|
|
850
|
-
"NOW_BUILDER"
|
|
851
|
-
],
|
|
852
|
-
[
|
|
853
|
-
"VERCEL",
|
|
854
|
-
"VERCEL",
|
|
855
|
-
{
|
|
856
|
-
ci: !1
|
|
857
|
-
}
|
|
858
|
-
],
|
|
859
|
-
[
|
|
860
|
-
"VERCEL",
|
|
861
|
-
"VERCEL_ENV",
|
|
862
|
-
{
|
|
863
|
-
ci: !1
|
|
864
|
-
}
|
|
865
|
-
],
|
|
866
|
-
[
|
|
867
|
-
"APPCENTER",
|
|
868
|
-
"APPCENTER_BUILD_ID"
|
|
869
|
-
],
|
|
870
|
-
[
|
|
871
|
-
"CODESANDBOX",
|
|
872
|
-
"CODESANDBOX_SSE",
|
|
873
|
-
{
|
|
874
|
-
ci: !1
|
|
875
|
-
}
|
|
876
|
-
],
|
|
877
|
-
[
|
|
878
|
-
"CODESANDBOX",
|
|
879
|
-
"CODESANDBOX_HOST",
|
|
880
|
-
{
|
|
881
|
-
ci: !1
|
|
882
|
-
}
|
|
883
|
-
],
|
|
884
|
-
[
|
|
885
|
-
"STACKBLITZ"
|
|
886
|
-
],
|
|
887
|
-
[
|
|
888
|
-
"STORMKIT"
|
|
889
|
-
],
|
|
890
|
-
[
|
|
891
|
-
"CLEAVR"
|
|
892
|
-
],
|
|
893
|
-
[
|
|
894
|
-
"ZEABUR"
|
|
895
|
-
],
|
|
896
|
-
[
|
|
897
|
-
"CODESPHERE",
|
|
898
|
-
"CODESPHERE_APP_ID",
|
|
899
|
-
{
|
|
900
|
-
ci: !0
|
|
901
|
-
}
|
|
902
|
-
],
|
|
903
|
-
[
|
|
904
|
-
"RAILWAY",
|
|
905
|
-
"RAILWAY_PROJECT_ID"
|
|
906
|
-
],
|
|
907
|
-
[
|
|
908
|
-
"RAILWAY",
|
|
909
|
-
"RAILWAY_SERVICE_ID"
|
|
910
|
-
],
|
|
911
|
-
[
|
|
912
|
-
"DENO-DEPLOY",
|
|
913
|
-
"DENO_DEPLOYMENT_ID"
|
|
914
|
-
],
|
|
915
|
-
[
|
|
916
|
-
"FIREBASE_APP_HOSTING",
|
|
917
|
-
"FIREBASE_APP_HOSTING",
|
|
918
|
-
{
|
|
919
|
-
ci: !0
|
|
920
|
-
}
|
|
921
|
-
]
|
|
922
|
-
];
|
|
923
|
-
function dist_b() {
|
|
924
|
-
if (globalThis.process?.env) for (const e of f){
|
|
925
|
-
const s = e[1] || e[0];
|
|
926
|
-
if (globalThis.process?.env[s]) return {
|
|
927
|
-
name: e[0].toLowerCase(),
|
|
928
|
-
...e[2]
|
|
929
|
-
};
|
|
930
|
-
}
|
|
931
|
-
return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? {
|
|
932
|
-
name: "stackblitz",
|
|
933
|
-
ci: !1
|
|
934
|
-
} : {
|
|
935
|
-
name: "",
|
|
936
|
-
ci: !1
|
|
937
|
-
};
|
|
938
|
-
}
|
|
939
|
-
const l = dist_b();
|
|
940
|
-
l.name;
|
|
941
|
-
function n(e) {
|
|
942
|
-
return e ? "false" !== e : !1;
|
|
943
|
-
}
|
|
944
|
-
const I = globalThis.process?.platform || "", T = n(dist_o.CI) || !1 !== l.ci, R = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY), A = (n(dist_o.DEBUG), "test" === dist_t || n(dist_o.TEST), n(dist_o.MINIMAL), /^win/i.test(I)), C = (/^linux/i.test(I), /^darwin/i.test(I), !n(dist_o.NO_COLOR) && (n(dist_o.FORCE_COLOR) || (R || A) && dist_o.TERM), (globalThis.process?.versions?.node || "").replace(/^v/, "") || null), W = (Number(C?.split(".")[0]), globalThis.process || Object.create(null)), dist_ = {
|
|
945
|
-
versions: {}
|
|
946
|
-
}, O = (new Proxy(W, {
|
|
947
|
-
get (e, s) {
|
|
948
|
-
if ("env" === s) return dist_o;
|
|
949
|
-
if (s in e) return e[s];
|
|
950
|
-
if (s in dist_) return dist_[s];
|
|
951
|
-
}
|
|
952
|
-
}), globalThis.process?.release?.name === "node"), c = !!globalThis.Bun || !!globalThis.process?.versions?.bun, D = !!globalThis.Deno, L = !!globalThis.fastly, S = !!globalThis.Netlify, u = !!globalThis.EdgeRuntime, N = globalThis.navigator?.userAgent === "Cloudflare-Workers", F = [
|
|
953
|
-
[
|
|
954
|
-
S,
|
|
955
|
-
"netlify"
|
|
956
|
-
],
|
|
957
|
-
[
|
|
958
|
-
u,
|
|
959
|
-
"edge-light"
|
|
960
|
-
],
|
|
961
|
-
[
|
|
962
|
-
N,
|
|
963
|
-
"workerd"
|
|
964
|
-
],
|
|
965
|
-
[
|
|
966
|
-
L,
|
|
967
|
-
"fastly"
|
|
968
|
-
],
|
|
969
|
-
[
|
|
970
|
-
D,
|
|
971
|
-
"deno"
|
|
972
|
-
],
|
|
973
|
-
[
|
|
974
|
-
c,
|
|
975
|
-
"bun"
|
|
976
|
-
],
|
|
977
|
-
[
|
|
978
|
-
O,
|
|
979
|
-
"node"
|
|
980
|
-
]
|
|
981
|
-
];
|
|
982
|
-
function G() {
|
|
983
|
-
const e = F.find((s)=>s[0]);
|
|
984
|
-
if (e) return {
|
|
985
|
-
name: e[1]
|
|
986
|
-
};
|
|
987
|
-
}
|
|
988
|
-
const P = G();
|
|
989
|
-
P?.name;
|
|
990
|
-
const external_node_fs_ = __webpack_require__("node:fs");
|
|
991
|
-
const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(external_node_fs_["default"].existsSync);
|
|
734
|
+
const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(node_fs.existsSync);
|
|
992
735
|
const resolveConfigPath = (root, customConfig)=>{
|
|
993
736
|
if (customConfig) {
|
|
994
737
|
const customConfigPath = isAbsolute(customConfig) ? customConfig : join(root, customConfig);
|
|
995
|
-
if (
|
|
738
|
+
if (node_fs.existsSync(customConfigPath)) return customConfigPath;
|
|
996
739
|
throw `Cannot find config file: ${color.dim(customConfigPath)}`;
|
|
997
740
|
}
|
|
998
741
|
const configFilePath = findConfig(join(root, DEFAULT_CONFIG_NAME));
|
|
999
742
|
if (configFilePath) return configFilePath;
|
|
1000
743
|
return null;
|
|
1001
744
|
};
|
|
1002
|
-
async function
|
|
745
|
+
async function config_loadConfig({ cwd = process.cwd(), path, envMode, configLoader }) {
|
|
1003
746
|
const configFilePath = resolveConfigPath(cwd, path);
|
|
1004
747
|
if (!configFilePath) {
|
|
1005
748
|
logger_logger.debug('no rstest config file found');
|
|
@@ -1008,7 +751,7 @@ async function loadConfig({ cwd = process.cwd(), path, envMode, configLoader })
|
|
|
1008
751
|
filePath: configFilePath
|
|
1009
752
|
};
|
|
1010
753
|
}
|
|
1011
|
-
const { content } = await
|
|
754
|
+
const { content } = await loadConfig({
|
|
1012
755
|
cwd: pathe_M_eThtNZ_dirname(configFilePath),
|
|
1013
756
|
path: configFilePath,
|
|
1014
757
|
envMode,
|
|
@@ -1029,7 +772,7 @@ async function loadConfig({ cwd = process.cwd(), path, envMode, configLoader })
|
|
|
1029
772
|
}
|
|
1030
773
|
const mergeProjectConfig = (...configs)=>mergeRstestConfig(...configs);
|
|
1031
774
|
const mergeRstestConfig = (...configs)=>configs.reduce((result, config)=>{
|
|
1032
|
-
const merged =
|
|
775
|
+
const merged = mergeRsbuildConfig(result, {
|
|
1033
776
|
...config,
|
|
1034
777
|
exclude: Array.isArray(config.exclude) ? {
|
|
1035
778
|
patterns: config.exclude,
|
|
@@ -1104,13 +847,12 @@ const createDefaultConfig = ()=>({
|
|
|
1104
847
|
enabled: false,
|
|
1105
848
|
provider: 'playwright',
|
|
1106
849
|
browser: 'chromium',
|
|
1107
|
-
headless:
|
|
850
|
+
headless: dist_m,
|
|
1108
851
|
strictPort: false
|
|
1109
852
|
},
|
|
1110
853
|
coverage: {
|
|
1111
854
|
exclude: [
|
|
1112
855
|
'**/node_modules/**',
|
|
1113
|
-
'**/dist/**',
|
|
1114
856
|
'**/test/**',
|
|
1115
857
|
'**/__tests__/**',
|
|
1116
858
|
'**/__mocks__/**',
|
|
@@ -1150,7 +892,7 @@ const withDefaultConfig = (config)=>{
|
|
|
1150
892
|
enabled: merged.browser?.enabled ?? false,
|
|
1151
893
|
provider: merged.browser?.provider ?? 'playwright',
|
|
1152
894
|
browser: merged.browser?.browser ?? 'chromium',
|
|
1153
|
-
headless: merged.browser?.headless ??
|
|
895
|
+
headless: merged.browser?.headless ?? dist_m,
|
|
1154
896
|
port: merged.browser?.port,
|
|
1155
897
|
strictPort: merged.browser?.strictPort ?? false,
|
|
1156
898
|
viewport: merged.browser?.viewport
|
|
@@ -1248,7 +990,7 @@ function mergeWithCLIOptions(config, options) {
|
|
|
1248
990
|
return config;
|
|
1249
991
|
}
|
|
1250
992
|
async function resolveConfig(options) {
|
|
1251
|
-
const { content: config, filePath: configFilePath } = await
|
|
993
|
+
const { content: config, filePath: configFilePath } = await config_loadConfig({
|
|
1252
994
|
cwd: options.cwd,
|
|
1253
995
|
path: options.config,
|
|
1254
996
|
configLoader: options.configLoader
|
|
@@ -1264,7 +1006,7 @@ async function resolveProjects({ config, root, options }) {
|
|
|
1264
1006
|
if (!config.projects) return [];
|
|
1265
1007
|
const getDefaultProjectName = (dir)=>{
|
|
1266
1008
|
const pkgJsonPath = pathe_M_eThtNZ_resolve(dir, 'package.json');
|
|
1267
|
-
const name =
|
|
1009
|
+
const name = existsSync(pkgJsonPath) ? JSON.parse(readFileSync(pkgJsonPath, 'utf-8')).name : '';
|
|
1268
1010
|
if ('string' != typeof name || !name) return basename(dir);
|
|
1269
1011
|
return name;
|
|
1270
1012
|
};
|
|
@@ -1314,14 +1056,14 @@ async function resolveProjects({ config, root, options }) {
|
|
|
1314
1056
|
if (isDynamicPattern(projectStr)) projectPatterns.push(projectStr);
|
|
1315
1057
|
else {
|
|
1316
1058
|
const absolutePath = getAbsolutePath(root, projectStr);
|
|
1317
|
-
if (!
|
|
1059
|
+
if (!existsSync(absolutePath)) throw `Can't resolve project "${p}", please make sure "${p}" is a existing file or a directory.`;
|
|
1318
1060
|
projectPaths.push(absolutePath);
|
|
1319
1061
|
}
|
|
1320
1062
|
}));
|
|
1321
1063
|
projectPaths.push(...await globProjects(projectPatterns, root));
|
|
1322
1064
|
const projects = [];
|
|
1323
1065
|
await Promise.all(projectPaths.map(async (project)=>{
|
|
1324
|
-
const isDirectory =
|
|
1066
|
+
const isDirectory = statSync(project).isDirectory();
|
|
1325
1067
|
const projectRoot = isDirectory ? project : pathe_M_eThtNZ_dirname(project);
|
|
1326
1068
|
const { config, configFilePath } = await resolveConfig({
|
|
1327
1069
|
...options,
|
|
@@ -1511,9 +1253,7 @@ const printSummaryErrorLogs = async ({ testResults, results, rootPath, unhandled
|
|
|
1511
1253
|
logger_logger.stderr('');
|
|
1512
1254
|
logger_logger.stderr(color.bold('Summary of all failing tests:'));
|
|
1513
1255
|
logger_logger.stderr('');
|
|
1514
|
-
const { printError } = await Promise.resolve()
|
|
1515
|
-
printError: error_printError
|
|
1516
|
-
}));
|
|
1256
|
+
const { printError } = await Promise.resolve(error_namespaceObject);
|
|
1517
1257
|
for (const error of unhandledErrors || []){
|
|
1518
1258
|
logger_logger.stderr(bgColor('bgRed', ' Unhandled Error '));
|
|
1519
1259
|
await printError(error, getSourcemap, rootPath);
|
|
@@ -1523,14 +1263,11 @@ const printSummaryErrorLogs = async ({ testResults, results, rootPath, unhandled
|
|
|
1523
1263
|
const nameStr = getTaskNameWithPrefix(test);
|
|
1524
1264
|
logger_logger.stderr(`${bgColor('bgRed', ' FAIL ')} ${prettyTestPath(relativePath)} ${nameStr.length ? `${color.dim(">")} ${nameStr}` : ''}`);
|
|
1525
1265
|
if (test.errors) {
|
|
1526
|
-
const { printError } = await Promise.resolve()
|
|
1527
|
-
printError: error_printError
|
|
1528
|
-
}));
|
|
1266
|
+
const { printError } = await Promise.resolve(error_namespaceObject);
|
|
1529
1267
|
for (const error of test.errors)await printError(error, getSourcemap, rootPath);
|
|
1530
1268
|
}
|
|
1531
1269
|
}
|
|
1532
1270
|
};
|
|
1533
|
-
const external_node_util_ = __webpack_require__("node:util");
|
|
1534
1271
|
const DEFAULT_RENDER_INTERVAL_MS = 1000;
|
|
1535
1272
|
const ESC = '\x1B[';
|
|
1536
1273
|
const CLEAR_LINE = `${ESC}K`;
|
|
@@ -1648,7 +1385,7 @@ class WindowRenderer {
|
|
|
1648
1385
|
function getRenderedRowCount(rows, columns) {
|
|
1649
1386
|
let count = 0;
|
|
1650
1387
|
for (const row of rows){
|
|
1651
|
-
const text =
|
|
1388
|
+
const text = stripVTControlCharacters(row);
|
|
1652
1389
|
count += Math.max(1, Math.ceil(text.length / columns));
|
|
1653
1390
|
}
|
|
1654
1391
|
return count;
|
|
@@ -1844,9 +1581,7 @@ class GithubActionsReporter {
|
|
|
1844
1581
|
...testResults.filter((i)=>'fail' === i.status)
|
|
1845
1582
|
];
|
|
1846
1583
|
if (0 === failedTests.length) return;
|
|
1847
|
-
const { parseErrorStacktrace } = await Promise.resolve()
|
|
1848
|
-
parseErrorStacktrace: error_parseErrorStacktrace
|
|
1849
|
-
}));
|
|
1584
|
+
const { parseErrorStacktrace } = await Promise.resolve(error_namespaceObject);
|
|
1850
1585
|
const logs = [];
|
|
1851
1586
|
for (const test of failedTests){
|
|
1852
1587
|
const { testPath } = test;
|
|
@@ -2196,7 +1931,6 @@ function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
|
2196
1931
|
if (-1 === index || index === segments.length) return -1;
|
|
2197
1932
|
return index;
|
|
2198
1933
|
}
|
|
2199
|
-
const external_node_path_ = __webpack_require__("node:path");
|
|
2200
1934
|
const isRelativePath = (p)=>/^\.\.?\//.test(p);
|
|
2201
1935
|
const isHttpLikeFile = (file)=>/^https?:\/\//.test(file);
|
|
2202
1936
|
const hintNotDefinedError = (message)=>{
|
|
@@ -2243,9 +1977,9 @@ async function error_printError(error, getSourcemap, rootPath) {
|
|
|
2243
1977
|
async function printCodeFrame(frame) {
|
|
2244
1978
|
const filePath = frame.file?.startsWith('file') ? new URL(frame.file) : frame.file;
|
|
2245
1979
|
if (!filePath) return;
|
|
2246
|
-
const source =
|
|
1980
|
+
const source = node_fs.existsSync(filePath) ? node_fs.readFileSync(filePath, 'utf-8') : void 0;
|
|
2247
1981
|
if (!source) return;
|
|
2248
|
-
const { codeFrameColumns } = await import("./0~
|
|
1982
|
+
const { codeFrameColumns } = await import("./0~lib.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/@babel+code-frame@7.29.0/node_modules/@babel/code-frame/lib/index.js"));
|
|
2249
1983
|
const result = codeFrameColumns(source, {
|
|
2250
1984
|
start: {
|
|
2251
1985
|
line: frame.lineNumber,
|
|
@@ -2290,7 +2024,7 @@ async function error_parseErrorStacktrace({ stack, getSourcemap, fullStack = isD
|
|
|
2290
2024
|
if (!source) return null;
|
|
2291
2025
|
return {
|
|
2292
2026
|
...frame,
|
|
2293
|
-
file: isRelativePath(source) ? (
|
|
2027
|
+
file: isRelativePath(source) ? external_node_path_resolve(frame.file, '../', source) : (()=>{
|
|
2294
2028
|
try {
|
|
2295
2029
|
return new URL(source).pathname;
|
|
2296
2030
|
} catch {
|
|
@@ -2431,7 +2165,7 @@ class JUnitReporter {
|
|
|
2431
2165
|
};
|
|
2432
2166
|
const xmlContent = this.generateJUnitXml(report);
|
|
2433
2167
|
if (this.outputPath) try {
|
|
2434
|
-
const dirname =
|
|
2168
|
+
const dirname = node_path.dirname(this.outputPath);
|
|
2435
2169
|
await this.tryMkdir(dirname);
|
|
2436
2170
|
await promises.writeFile(this.outputPath, xmlContent, 'utf-8');
|
|
2437
2171
|
logger_logger.log(`JUnit XML report written to: ${this.outputPath}`);
|
|
@@ -2900,11 +2634,11 @@ async function pathExists(path2, type) {
|
|
|
2900
2634
|
}
|
|
2901
2635
|
}
|
|
2902
2636
|
function* lookup(cwd = node_process.cwd()) {
|
|
2903
|
-
let directory =
|
|
2904
|
-
const { root } =
|
|
2637
|
+
let directory = node_path.resolve(cwd);
|
|
2638
|
+
const { root } = node_path.parse(directory);
|
|
2905
2639
|
while(directory && directory !== root){
|
|
2906
2640
|
yield directory;
|
|
2907
|
-
directory =
|
|
2641
|
+
directory = node_path.dirname(directory);
|
|
2908
2642
|
}
|
|
2909
2643
|
}
|
|
2910
2644
|
async function parsePackageJson(filepath, options) {
|
|
@@ -2919,15 +2653,15 @@ async function detect(options = {}) {
|
|
|
2919
2653
|
] } = options;
|
|
2920
2654
|
let stopDir;
|
|
2921
2655
|
if ("string" == typeof options.stopDir) {
|
|
2922
|
-
const resolved =
|
|
2656
|
+
const resolved = node_path.resolve(options.stopDir);
|
|
2923
2657
|
stopDir = (dir)=>dir === resolved;
|
|
2924
2658
|
} else stopDir = options.stopDir;
|
|
2925
2659
|
for (const directory of lookup(cwd)){
|
|
2926
2660
|
for (const strategy of strategies)switch(strategy){
|
|
2927
2661
|
case "lockfile":
|
|
2928
|
-
for (const lock of Object.keys(LOCKS))if (await pathExists(
|
|
2662
|
+
for (const lock of Object.keys(LOCKS))if (await pathExists(node_path.join(directory, lock), "file")) {
|
|
2929
2663
|
const name = LOCKS[lock];
|
|
2930
|
-
const result = await parsePackageJson(
|
|
2664
|
+
const result = await parsePackageJson(node_path.join(directory, "package.json"), options);
|
|
2931
2665
|
if (result) return result;
|
|
2932
2666
|
return {
|
|
2933
2667
|
name,
|
|
@@ -2938,14 +2672,14 @@ async function detect(options = {}) {
|
|
|
2938
2672
|
case "packageManager-field":
|
|
2939
2673
|
case "devEngines-field":
|
|
2940
2674
|
{
|
|
2941
|
-
const result = await parsePackageJson(
|
|
2675
|
+
const result = await parsePackageJson(node_path.join(directory, "package.json"), options);
|
|
2942
2676
|
if (result) return result;
|
|
2943
2677
|
break;
|
|
2944
2678
|
}
|
|
2945
2679
|
case "install-metadata":
|
|
2946
2680
|
for (const metadata of Object.keys(INSTALL_METADATA)){
|
|
2947
2681
|
const fileOrDir = metadata.endsWith("/") ? "dir" : "file";
|
|
2948
|
-
if (await pathExists(
|
|
2682
|
+
if (await pathExists(node_path.join(directory, metadata), fileOrDir)) {
|
|
2949
2683
|
const name = INSTALL_METADATA[metadata];
|
|
2950
2684
|
const agent = "yarn" === name ? isMetadataYarnClassic(metadata) ? "yarn" : "yarn@berry" : name;
|
|
2951
2685
|
return {
|
|
@@ -3340,11 +3074,11 @@ const resolveModuleRoot = (spec)=>{
|
|
|
3340
3074
|
if ('function' == typeof import.meta.resolve) {
|
|
3341
3075
|
const resolved = import.meta.resolve(`${spec}/package.json`);
|
|
3342
3076
|
const filePath = resolved.startsWith('file://') ? new URL(resolved).pathname : resolved;
|
|
3343
|
-
return (
|
|
3077
|
+
return external_node_path_dirname(filePath);
|
|
3344
3078
|
}
|
|
3345
3079
|
} catch {}
|
|
3346
3080
|
try {
|
|
3347
|
-
return (
|
|
3081
|
+
return external_node_path_dirname(md_require.resolve(`${spec}/package.json`));
|
|
3348
3082
|
} catch {
|
|
3349
3083
|
return null;
|
|
3350
3084
|
}
|
|
@@ -3384,7 +3118,7 @@ const md_parseErrorStacktrace = async ({ stack, getSourcemap, fullStack = false
|
|
|
3384
3118
|
column: frame.column || 1
|
|
3385
3119
|
});
|
|
3386
3120
|
if (!source) return null;
|
|
3387
|
-
const mappedFile = md_isRelativePath(source) ? (
|
|
3121
|
+
const mappedFile = md_isRelativePath(source) ? external_node_path_resolve(file || '', '../', source) : (()=>{
|
|
3388
3122
|
try {
|
|
3389
3123
|
return new URL(source).pathname;
|
|
3390
3124
|
} catch {
|
|
@@ -3404,8 +3138,8 @@ const md_parseErrorStacktrace = async ({ stack, getSourcemap, fullStack = false
|
|
|
3404
3138
|
return dropNodeFrames(trimLeadingNodeFrames(filteredFrames));
|
|
3405
3139
|
};
|
|
3406
3140
|
const createCodeFrame = (filePath, { linesAbove, linesBelow, line, column })=>{
|
|
3407
|
-
if (!filePath || !
|
|
3408
|
-
const source =
|
|
3141
|
+
if (!filePath || !node_fs.existsSync(filePath)) return null;
|
|
3142
|
+
const source = node_fs.readFileSync(filePath, 'utf-8');
|
|
3409
3143
|
const sourceLines = source.split(/\r?\n/);
|
|
3410
3144
|
const lineNumber = Math.max(1, line || 1);
|
|
3411
3145
|
const columnNumber = Math.max(1, column || 1);
|
|
@@ -3467,7 +3201,7 @@ class MdReporter {
|
|
|
3467
3201
|
}
|
|
3468
3202
|
renderFrontMatter(lines) {
|
|
3469
3203
|
const frontMatter = {
|
|
3470
|
-
tool: "@rstest/core@0.9.
|
|
3204
|
+
tool: "@rstest/core@0.9.2",
|
|
3471
3205
|
timestamp: new Date().toISOString()
|
|
3472
3206
|
};
|
|
3473
3207
|
if (this.options.header.env) frontMatter.runtime = {
|
|
@@ -3778,7 +3512,11 @@ class TestStateManager {
|
|
|
3778
3512
|
});
|
|
3779
3513
|
}
|
|
3780
3514
|
getCountOfFailedTests() {
|
|
3781
|
-
const testResults = Array.from(this.runningModules.values()).flatMap(({ results })=>results).concat(this.testModules.flatMap((mod)=>mod.results
|
|
3515
|
+
const testResults = Array.from(this.runningModules.values()).flatMap(({ results })=>results).concat(this.testModules.flatMap((mod)=>mod.results.length > 0 ? mod.results : [
|
|
3516
|
+
{
|
|
3517
|
+
status: mod.status
|
|
3518
|
+
}
|
|
3519
|
+
]));
|
|
3782
3520
|
return testResults.filter((t)=>'fail' === t.status).length;
|
|
3783
3521
|
}
|
|
3784
3522
|
onTestFileResult(test) {
|
|
@@ -3834,10 +3572,10 @@ class Rstest {
|
|
|
3834
3572
|
process.exit(1);
|
|
3835
3573
|
}
|
|
3836
3574
|
const snapshotManager = new SnapshotManager({
|
|
3837
|
-
updateSnapshot: rstestConfig.update ? 'all' :
|
|
3575
|
+
updateSnapshot: rstestConfig.update ? 'all' : dist_m ? 'none' : 'new'
|
|
3838
3576
|
});
|
|
3839
3577
|
this.snapshotManager = snapshotManager;
|
|
3840
|
-
this.version = "0.9.
|
|
3578
|
+
this.version = "0.9.2";
|
|
3841
3579
|
this.rootPath = rootPath;
|
|
3842
3580
|
this.originalConfig = userConfig;
|
|
3843
3581
|
this.normalizedConfig = rstestConfig;
|
|
@@ -3855,7 +3593,7 @@ class Rstest {
|
|
|
3855
3593
|
if (config.source.tsconfigPath) config.source.tsconfigPath = getAbsolutePath(config.root, config.source.tsconfigPath);
|
|
3856
3594
|
else {
|
|
3857
3595
|
const tsconfigPath = join(config.root, TS_CONFIG_FILE);
|
|
3858
|
-
if (
|
|
3596
|
+
if (existsSync(tsconfigPath)) config.source.tsconfigPath = tsconfigPath;
|
|
3859
3597
|
}
|
|
3860
3598
|
return {
|
|
3861
3599
|
configFilePath: project.configFilePath,
|
|
@@ -3948,15 +3686,11 @@ function core_createRstest({ config, projects, configFilePath }, command, fileFi
|
|
|
3948
3686
|
projects
|
|
3949
3687
|
}, config);
|
|
3950
3688
|
const runTests = async ()=>{
|
|
3951
|
-
const { runTests } = await import("./0~
|
|
3952
|
-
runTests: mod.runTests
|
|
3953
|
-
}));
|
|
3689
|
+
const { runTests } = await import("./0~runTests.js");
|
|
3954
3690
|
await runTests(context);
|
|
3955
3691
|
};
|
|
3956
3692
|
const listTests = async (options)=>{
|
|
3957
|
-
const { listTests } = await import("./0~
|
|
3958
|
-
listTests: mod.listTests
|
|
3959
|
-
}));
|
|
3693
|
+
const { listTests } = await import("./0~listTests.js");
|
|
3960
3694
|
return listTests(context, options);
|
|
3961
3695
|
};
|
|
3962
3696
|
return {
|
|
@@ -3971,4 +3705,4 @@ function defineConfig(config) {
|
|
|
3971
3705
|
function defineProject(config) {
|
|
3972
3706
|
return config;
|
|
3973
3707
|
}
|
|
3974
|
-
export {
|
|
3708
|
+
export { config_loadConfig as loadConfig, core_createRstest as createRstest, defineConfig, defineProject, detect, error_parseErrorStacktrace as parseErrorStacktrace, error_printError as printError, formatStack, init_initCli as initCli, mergeProjectConfig, mergeRstestConfig, resolveCommand, runCLI, runRest };
|