@rstest/core 0.9.0 → 0.9.1
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~130.js +0 -1
- package/dist/0~1472.js +1 -1
- package/dist/0~2173.js +20 -3
- package/dist/0~5835.js +18 -5
- package/dist/0~6588.js +1 -1
- package/dist/0~6923.js +11 -3
- package/dist/0~7583.js +3 -3
- package/dist/0~7882.js +18 -18
- package/dist/0~89.js +31 -11
- package/dist/0~9634.js +1 -1
- package/dist/0~9744.js +1014 -0
- package/dist/1157.js +1 -1
- package/dist/1294.js +1 -1
- package/dist/3160.js +16 -21
- package/dist/487.js +1 -1
- package/dist/6151.js +3013 -22
- package/dist/9131.js +154 -91
- package/dist/browser-runtime/389.js +3022 -38
- package/dist/index.d.ts +3 -0
- package/dist/mockRuntimeCode.js +15 -9
- package/dist/worker.js +4 -1
- package/package.json +7 -5
- package/dist/0~1240.js +0 -951
- package/dist/0~1981.js +0 -2
- package/dist/721.js +0 -8
package/dist/9131.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
|
-
import { EventEmitter } from "events";
|
|
4
3
|
import { basename, isTTY, dirname as pathe_M_eThtNZ_dirname, resolve as pathe_M_eThtNZ_resolve, node_process, relative, getAbsolutePath, join, bgColor, formatRootStr, determineAgent, logger as logger_logger, castArray, prettyTime, isDebug, color, isAbsolute, getTaskNameWithPrefix, normalize, formatError } from "./3160.js";
|
|
5
|
-
import "./721.js";
|
|
6
4
|
import { isDynamicPattern, glob, DEFAULT_CONFIG_NAME, prettyTestPath, globalApis, promises, TEMP_RSTEST_OUTPUT_DIR_GLOB, formatTestPath, filterProjects, DEFAULT_CONFIG_EXTENSIONS, TS_CONFIG_FILE } from "./1157.js";
|
|
7
5
|
import { rsbuild as __rspack_external__rsbuild_core_1b356efc } from "./4484.js";
|
|
8
6
|
import { posix } from "./7011.js";
|
|
@@ -15,13 +13,13 @@ function toArr(any) {
|
|
|
15
13
|
];
|
|
16
14
|
}
|
|
17
15
|
function toVal(out, key, val, opts) {
|
|
18
|
-
var x, old = out[key], nxt = ~opts.string.indexOf(key) ? null == val || true === val ?
|
|
16
|
+
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
17
|
out[key] = null == old ? nxt : Array.isArray(old) ? old.concat(nxt) : [
|
|
20
18
|
old,
|
|
21
19
|
nxt
|
|
22
20
|
];
|
|
23
21
|
}
|
|
24
|
-
function
|
|
22
|
+
function lib_default(args, opts) {
|
|
25
23
|
args = args || [];
|
|
26
24
|
opts = opts || {};
|
|
27
25
|
var k, arr, arg, name, val, out = {
|
|
@@ -57,26 +55,26 @@ function mri2(args, opts) {
|
|
|
57
55
|
const keys = strict ? Object.keys(opts.alias) : [];
|
|
58
56
|
for(i = 0; i < len; i++){
|
|
59
57
|
arg = args[i];
|
|
60
|
-
if (
|
|
58
|
+
if ("--" === arg) {
|
|
61
59
|
out._ = out._.concat(args.slice(++i));
|
|
62
60
|
break;
|
|
63
61
|
}
|
|
64
62
|
for(j = 0; j < arg.length && 45 === arg.charCodeAt(j); j++);
|
|
65
63
|
if (0 === j) out._.push(arg);
|
|
66
|
-
else if (
|
|
64
|
+
else if ("no-" === arg.substring(j, j + 3)) {
|
|
67
65
|
name = arg.substring(j + 3);
|
|
68
66
|
if (strict && !~keys.indexOf(name)) return opts.unknown(arg);
|
|
69
67
|
out[name] = false;
|
|
70
68
|
} else {
|
|
71
69
|
for(idx = j + 1; idx < arg.length && 61 !== arg.charCodeAt(idx); idx++);
|
|
72
70
|
name = arg.substring(j, idx);
|
|
73
|
-
val = arg.substring(++idx) || i + 1 === len || 45 === (
|
|
71
|
+
val = arg.substring(++idx) || i + 1 === len || 45 === ("" + args[i + 1]).charCodeAt(0) || args[++i];
|
|
74
72
|
arr = 2 === j ? [
|
|
75
73
|
name
|
|
76
74
|
] : name;
|
|
77
75
|
for(idx = 0; idx < arr.length; idx++){
|
|
78
76
|
name = arr[idx];
|
|
79
|
-
if (strict && !~keys.indexOf(name)) return opts.unknown(
|
|
77
|
+
if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
|
|
80
78
|
toVal(out, name, idx + 1 < arr.length || val, opts);
|
|
81
79
|
}
|
|
82
80
|
}
|
|
@@ -90,8 +88,10 @@ function mri2(args, opts) {
|
|
|
90
88
|
}
|
|
91
89
|
return out;
|
|
92
90
|
}
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
function removeBrackets(v) {
|
|
92
|
+
return v.replace(/[<[].+/, "").trim();
|
|
93
|
+
}
|
|
94
|
+
function findAllBrackets(v) {
|
|
95
95
|
const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
|
|
96
96
|
const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
|
|
97
97
|
const res = [];
|
|
@@ -113,8 +113,8 @@ const findAllBrackets = (v)=>{
|
|
|
113
113
|
let squareMatch;
|
|
114
114
|
while(squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v))res.push(parse(squareMatch));
|
|
115
115
|
return res;
|
|
116
|
-
}
|
|
117
|
-
|
|
116
|
+
}
|
|
117
|
+
function getMriOptions(options) {
|
|
118
118
|
const result = {
|
|
119
119
|
alias: {},
|
|
120
120
|
boolean: []
|
|
@@ -122,53 +122,74 @@ const getMriOptions = (options)=>{
|
|
|
122
122
|
for (const [index, option] of options.entries()){
|
|
123
123
|
if (option.names.length > 1) result.alias[option.names[0]] = option.names.slice(1);
|
|
124
124
|
if (option.isBoolean) if (option.negated) {
|
|
125
|
-
|
|
126
|
-
if (!hasStringTypeOption) result.boolean.push(option.names[0]);
|
|
125
|
+
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
126
|
} else result.boolean.push(option.names[0]);
|
|
128
127
|
}
|
|
129
128
|
return result;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
129
|
+
}
|
|
130
|
+
function findLongest(arr) {
|
|
131
|
+
return arr.sort((a, b)=>a.length > b.length ? -1 : 1)[0];
|
|
132
|
+
}
|
|
133
|
+
function padRight(str, length) {
|
|
134
|
+
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
|
|
135
|
+
}
|
|
136
|
+
function camelcase(input) {
|
|
137
|
+
return input.replaceAll(/([a-z])-([a-z])/g, (_, p1, p2)=>p1 + p2.toUpperCase());
|
|
138
|
+
}
|
|
139
|
+
function setDotProp(obj, keys, val) {
|
|
140
|
+
let current = obj;
|
|
141
|
+
for(let i = 0; i < keys.length; i++){
|
|
142
|
+
const key = keys[i];
|
|
143
|
+
if (i === keys.length - 1) {
|
|
144
|
+
current[key] = val;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (null == current[key]) {
|
|
148
|
+
const nextKeyIsArrayIndex = +keys[i + 1] > -1;
|
|
149
|
+
current[key] = nextKeyIsArrayIndex ? [] : {};
|
|
150
|
+
}
|
|
151
|
+
current = current[key];
|
|
142
152
|
}
|
|
143
|
-
}
|
|
144
|
-
|
|
153
|
+
}
|
|
154
|
+
function setByType(obj, transforms) {
|
|
145
155
|
for (const key of Object.keys(transforms)){
|
|
146
156
|
const transform = transforms[key];
|
|
147
157
|
if (transform.shouldTransform) {
|
|
148
|
-
obj[key] =
|
|
158
|
+
obj[key] = [
|
|
159
|
+
obj[key]
|
|
160
|
+
].flat();
|
|
149
161
|
if ("function" == typeof transform.transformFunction) obj[key] = obj[key].map(transform.transformFunction);
|
|
150
162
|
}
|
|
151
163
|
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const m = /([
|
|
164
|
+
}
|
|
165
|
+
function getFileName(input) {
|
|
166
|
+
const m = /([^\\/]+)$/.exec(input);
|
|
155
167
|
return m ? m[1] : "";
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
168
|
+
}
|
|
169
|
+
function camelcaseOptionName(name) {
|
|
170
|
+
return name.split(".").map((v, i)=>0 === i ? camelcase(v) : v).join(".");
|
|
171
|
+
}
|
|
172
|
+
var CACError = class extends Error {
|
|
159
173
|
constructor(message){
|
|
160
174
|
super(message);
|
|
161
|
-
this.name =
|
|
162
|
-
if ("function"
|
|
163
|
-
else this.stack = new Error(message).stack;
|
|
175
|
+
this.name = "CACError";
|
|
176
|
+
if ("function" != typeof Error.captureStackTrace) this.stack = new Error(message).stack;
|
|
164
177
|
}
|
|
165
|
-
}
|
|
166
|
-
|
|
178
|
+
};
|
|
179
|
+
var Option = class {
|
|
180
|
+
rawName;
|
|
181
|
+
description;
|
|
182
|
+
name;
|
|
183
|
+
names;
|
|
184
|
+
isBoolean;
|
|
185
|
+
required;
|
|
186
|
+
config;
|
|
187
|
+
negated;
|
|
167
188
|
constructor(rawName, description, config){
|
|
168
189
|
this.rawName = rawName;
|
|
169
190
|
this.description = description;
|
|
170
191
|
this.config = Object.assign({}, config);
|
|
171
|
-
rawName = rawName.
|
|
192
|
+
rawName = rawName.replaceAll(".*", "");
|
|
172
193
|
this.negated = false;
|
|
173
194
|
this.names = removeBrackets(rawName).split(",").map((v)=>{
|
|
174
195
|
let name = v.trim().replace(/^-{1,2}/, "");
|
|
@@ -178,16 +199,36 @@ class Option {
|
|
|
178
199
|
}
|
|
179
200
|
return camelcaseOptionName(name);
|
|
180
201
|
}).sort((a, b)=>a.length > b.length ? 1 : -1);
|
|
181
|
-
this.name = this.names
|
|
202
|
+
this.name = this.names.at(-1);
|
|
182
203
|
if (this.negated && null == this.config.default) this.config.default = true;
|
|
183
204
|
if (rawName.includes("<")) this.required = true;
|
|
184
205
|
else if (rawName.includes("[")) this.required = false;
|
|
185
206
|
else this.isBoolean = true;
|
|
186
207
|
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
208
|
+
};
|
|
209
|
+
let runtimeProcessArgs;
|
|
210
|
+
let runtimeInfo;
|
|
211
|
+
if ("u" > typeof process) {
|
|
212
|
+
let runtimeName;
|
|
213
|
+
runtimeName = "u" > typeof Deno && "string" == typeof Deno.version?.deno ? "deno" : "u" > typeof Bun && "string" == typeof Bun.version ? "bun" : "node";
|
|
214
|
+
runtimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`;
|
|
215
|
+
runtimeProcessArgs = process.argv;
|
|
216
|
+
} else runtimeInfo = "u" < typeof navigator ? "unknown" : `${navigator.platform} ${navigator.userAgent}`;
|
|
217
|
+
var Command = class {
|
|
218
|
+
rawName;
|
|
219
|
+
description;
|
|
220
|
+
config;
|
|
221
|
+
cli;
|
|
222
|
+
options;
|
|
223
|
+
aliasNames;
|
|
224
|
+
name;
|
|
225
|
+
args;
|
|
226
|
+
commandAction;
|
|
227
|
+
usageText;
|
|
228
|
+
versionNumber;
|
|
229
|
+
examples;
|
|
230
|
+
helpCallback;
|
|
231
|
+
globalCommand;
|
|
191
232
|
constructor(rawName, description, config = {}, cli){
|
|
192
233
|
this.rawName = rawName;
|
|
193
234
|
this.description = description;
|
|
@@ -258,14 +299,12 @@ class Command {
|
|
|
258
299
|
title: "Usage",
|
|
259
300
|
body: ` $ ${name} ${this.usageText || this.rawName}`
|
|
260
301
|
});
|
|
261
|
-
|
|
262
|
-
if (showCommands) {
|
|
302
|
+
if ((this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0) {
|
|
263
303
|
const longestCommandName = findLongest(commands.map((command)=>command.rawName));
|
|
264
304
|
sections.push({
|
|
265
305
|
title: "Commands",
|
|
266
306
|
body: commands.map((command)=>` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`).join("\n")
|
|
267
|
-
}
|
|
268
|
-
sections.push({
|
|
307
|
+
}, {
|
|
269
308
|
title: "For more info, run any command with the `--help` flag",
|
|
270
309
|
body: commands.map((command)=>` $ ${name}${"" === command.name ? "" : ` ${command.name}`} --help`).join("\n")
|
|
271
310
|
});
|
|
@@ -290,13 +329,12 @@ class Command {
|
|
|
290
329
|
}).join("\n")
|
|
291
330
|
});
|
|
292
331
|
if (helpCallback) sections = helpCallback(sections) || sections;
|
|
293
|
-
console.
|
|
294
|
-
${section.body}` : section.body).join("\n\n"));
|
|
332
|
+
console.info(sections.map((section)=>section.title ? `${section.title}:\n${section.body}` : section.body).join("\n\n"));
|
|
295
333
|
}
|
|
296
334
|
outputVersion() {
|
|
297
335
|
const { name } = this.cli;
|
|
298
336
|
const { versionNumber } = this.cli.globalCommand;
|
|
299
|
-
if (versionNumber) console.
|
|
337
|
+
if (versionNumber) console.info(`${name}/${versionNumber} ${runtimeInfo}`);
|
|
300
338
|
}
|
|
301
339
|
checkRequiredArgs() {
|
|
302
340
|
const minimalArgsCount = this.args.filter((arg)=>arg.required).length;
|
|
@@ -322,14 +360,27 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
322
360
|
}
|
|
323
361
|
}
|
|
324
362
|
}
|
|
325
|
-
|
|
326
|
-
|
|
363
|
+
checkUnusedArgs() {
|
|
364
|
+
const maximumArgsCount = this.args.some((arg)=>arg.variadic) ? 1 / 0 : this.args.length;
|
|
365
|
+
if (maximumArgsCount < this.cli.args.length) throw new CACError(`Unused args: ${this.cli.args.slice(maximumArgsCount).map((arg)=>`\`${arg}\``).join(", ")}`);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
var GlobalCommand = class extends Command {
|
|
327
369
|
constructor(cli){
|
|
328
370
|
super("@@global@@", "", {}, cli);
|
|
329
371
|
}
|
|
330
|
-
}
|
|
331
|
-
var
|
|
332
|
-
|
|
372
|
+
};
|
|
373
|
+
var CAC = class extends EventTarget {
|
|
374
|
+
name;
|
|
375
|
+
commands;
|
|
376
|
+
globalCommand;
|
|
377
|
+
matchedCommand;
|
|
378
|
+
matchedCommandName;
|
|
379
|
+
rawArgs;
|
|
380
|
+
args;
|
|
381
|
+
options;
|
|
382
|
+
showHelpOnExit;
|
|
383
|
+
showVersionOnExit;
|
|
333
384
|
constructor(name = ""){
|
|
334
385
|
super();
|
|
335
386
|
this.name = name;
|
|
@@ -387,7 +438,11 @@ class CAC extends EventEmitter {
|
|
|
387
438
|
this.matchedCommand = void 0;
|
|
388
439
|
this.matchedCommandName = void 0;
|
|
389
440
|
}
|
|
390
|
-
parse(argv
|
|
441
|
+
parse(argv, { run = true } = {}) {
|
|
442
|
+
if (!argv) {
|
|
443
|
+
if (!runtimeProcessArgs) throw new Error("No argv provided and runtime process argv is not available.");
|
|
444
|
+
argv = runtimeProcessArgs;
|
|
445
|
+
}
|
|
391
446
|
this.rawArgs = argv;
|
|
392
447
|
if (!this.name) this.name = argv[1] ? getFileName(argv[1]) : "cli";
|
|
393
448
|
let shouldParse = true;
|
|
@@ -396,19 +451,24 @@ class CAC extends EventEmitter {
|
|
|
396
451
|
const commandName = parsed.args[0];
|
|
397
452
|
if (command.isMatched(commandName)) {
|
|
398
453
|
shouldParse = false;
|
|
399
|
-
const parsedInfo =
|
|
454
|
+
const parsedInfo = {
|
|
455
|
+
...parsed,
|
|
400
456
|
args: parsed.args.slice(1)
|
|
401
|
-
}
|
|
457
|
+
};
|
|
402
458
|
this.setParsedInfo(parsedInfo, command, commandName);
|
|
403
|
-
this.
|
|
459
|
+
this.dispatchEvent(new CustomEvent(`command:${commandName}`, {
|
|
460
|
+
detail: command
|
|
461
|
+
}));
|
|
404
462
|
}
|
|
405
463
|
}
|
|
406
464
|
if (shouldParse) {
|
|
407
|
-
for (const command of this.commands)if (
|
|
465
|
+
for (const command of this.commands)if (command.isDefaultCommand) {
|
|
408
466
|
shouldParse = false;
|
|
409
467
|
const parsed = this.mri(argv.slice(2), command);
|
|
410
468
|
this.setParsedInfo(parsed, command);
|
|
411
|
-
this.
|
|
469
|
+
this.dispatchEvent(new CustomEvent("command:!", {
|
|
470
|
+
detail: command
|
|
471
|
+
}));
|
|
412
472
|
}
|
|
413
473
|
}
|
|
414
474
|
if (shouldParse) {
|
|
@@ -430,7 +490,9 @@ class CAC extends EventEmitter {
|
|
|
430
490
|
options: this.options
|
|
431
491
|
};
|
|
432
492
|
if (run) this.runMatchedCommand();
|
|
433
|
-
if (!this.matchedCommand && this.args[0]) this.
|
|
493
|
+
if (!this.matchedCommand && this.args[0]) this.dispatchEvent(new CustomEvent("command:*", {
|
|
494
|
+
detail: this.args[0]
|
|
495
|
+
}));
|
|
434
496
|
return parsedArgv;
|
|
435
497
|
}
|
|
436
498
|
mri(argv, command) {
|
|
@@ -441,12 +503,13 @@ class CAC extends EventEmitter {
|
|
|
441
503
|
const mriOptions = getMriOptions(cliOptions);
|
|
442
504
|
let argsAfterDoubleDashes = [];
|
|
443
505
|
const doubleDashesIndex = argv.indexOf("--");
|
|
444
|
-
if (
|
|
506
|
+
if (-1 !== doubleDashesIndex) {
|
|
445
507
|
argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
|
|
446
508
|
argv = argv.slice(0, doubleDashesIndex);
|
|
447
509
|
}
|
|
448
|
-
let parsed =
|
|
449
|
-
parsed = Object.keys(parsed).reduce((res, name)=>
|
|
510
|
+
let parsed = lib_default(argv, mriOptions);
|
|
511
|
+
parsed = Object.keys(parsed).reduce((res, name)=>({
|
|
512
|
+
...res,
|
|
450
513
|
[camelcaseOptionName(name)]: parsed[name]
|
|
451
514
|
}), {
|
|
452
515
|
_: []
|
|
@@ -456,20 +519,17 @@ class CAC extends EventEmitter {
|
|
|
456
519
|
"--": argsAfterDoubleDashes
|
|
457
520
|
};
|
|
458
521
|
const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
|
|
459
|
-
|
|
522
|
+
const transforms = Object.create(null);
|
|
460
523
|
for (const cliOption of cliOptions){
|
|
461
524
|
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
|
-
}
|
|
525
|
+
if (Array.isArray(cliOption.config.type) && void 0 === transforms[cliOption.name]) {
|
|
526
|
+
transforms[cliOption.name] = Object.create(null);
|
|
527
|
+
transforms[cliOption.name].shouldTransform = true;
|
|
528
|
+
transforms[cliOption.name].transformFunction = cliOption.config.type[0];
|
|
468
529
|
}
|
|
469
530
|
}
|
|
470
531
|
for (const key of Object.keys(parsed))if ("_" !== key) {
|
|
471
|
-
|
|
472
|
-
setDotProp(options, keys, parsed[key]);
|
|
532
|
+
setDotProp(options, key.split("."), parsed[key]);
|
|
473
533
|
setByType(options, transforms);
|
|
474
534
|
}
|
|
475
535
|
return {
|
|
@@ -483,6 +543,7 @@ class CAC extends EventEmitter {
|
|
|
483
543
|
command.checkUnknownOptions();
|
|
484
544
|
command.checkOptionValue();
|
|
485
545
|
command.checkRequiredArgs();
|
|
546
|
+
command.checkUnusedArgs();
|
|
486
547
|
const actionArgs = [];
|
|
487
548
|
command.args.forEach((arg, index)=>{
|
|
488
549
|
if (arg.variadic) actionArgs.push(args.slice(index));
|
|
@@ -491,9 +552,8 @@ class CAC extends EventEmitter {
|
|
|
491
552
|
actionArgs.push(options);
|
|
492
553
|
return command.commandAction.apply(this, actionArgs);
|
|
493
554
|
}
|
|
494
|
-
}
|
|
555
|
+
};
|
|
495
556
|
const cac = (name = "")=>new CAC(name);
|
|
496
|
-
const dist = cac;
|
|
497
557
|
function initNodeEnv() {
|
|
498
558
|
if (!process.env.NODE_ENV) process.env.NODE_ENV = 'test';
|
|
499
559
|
}
|
|
@@ -504,7 +564,7 @@ function prepareCli() {
|
|
|
504
564
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) logger_logger.log();
|
|
505
565
|
}
|
|
506
566
|
function showRstest() {
|
|
507
|
-
logger_logger.greet(" Rstest v0.9.
|
|
567
|
+
logger_logger.greet(" Rstest v0.9.1");
|
|
508
568
|
logger_logger.log('');
|
|
509
569
|
}
|
|
510
570
|
const applyCommonOptions = (cli)=>{
|
|
@@ -560,9 +620,9 @@ const runRest = async ({ options, filters, command })=>{
|
|
|
560
620
|
}
|
|
561
621
|
};
|
|
562
622
|
function setupCommands() {
|
|
563
|
-
const cli =
|
|
623
|
+
const cli = cac('rstest');
|
|
564
624
|
cli.help();
|
|
565
|
-
cli.version("0.9.
|
|
625
|
+
cli.version("0.9.1");
|
|
566
626
|
applyCommonOptions(cli);
|
|
567
627
|
cli.command('[...filters]', 'run tests').option('-w, --watch', 'Run tests in watch mode').action(async (filters, options)=>{
|
|
568
628
|
if (!determineAgent().isAgent) showRstest();
|
|
@@ -624,9 +684,9 @@ function setupCommands() {
|
|
|
624
684
|
try {
|
|
625
685
|
let selectedProject = project;
|
|
626
686
|
if (!selectedProject) {
|
|
627
|
-
const { select, isCancel } = await import("./0~
|
|
628
|
-
select: mod.
|
|
629
|
-
isCancel: mod.
|
|
687
|
+
const { select, isCancel } = await import("./0~9744.js").then((mod)=>({
|
|
688
|
+
select: mod.Jt,
|
|
689
|
+
isCancel: mod.Ct
|
|
630
690
|
}));
|
|
631
691
|
console.log();
|
|
632
692
|
const selected = await select({
|
|
@@ -1110,7 +1170,6 @@ const createDefaultConfig = ()=>({
|
|
|
1110
1170
|
coverage: {
|
|
1111
1171
|
exclude: [
|
|
1112
1172
|
'**/node_modules/**',
|
|
1113
|
-
'**/dist/**',
|
|
1114
1173
|
'**/test/**',
|
|
1115
1174
|
'**/__tests__/**',
|
|
1116
1175
|
'**/__mocks__/**',
|
|
@@ -2196,7 +2255,7 @@ function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
|
2196
2255
|
if (-1 === index || index === segments.length) return -1;
|
|
2197
2256
|
return index;
|
|
2198
2257
|
}
|
|
2199
|
-
const external_node_path_ = __webpack_require__("
|
|
2258
|
+
const external_node_path_ = __webpack_require__("path");
|
|
2200
2259
|
const isRelativePath = (p)=>/^\.\.?\//.test(p);
|
|
2201
2260
|
const isHttpLikeFile = (file)=>/^https?:\/\//.test(file);
|
|
2202
2261
|
const hintNotDefinedError = (message)=>{
|
|
@@ -3467,7 +3526,7 @@ class MdReporter {
|
|
|
3467
3526
|
}
|
|
3468
3527
|
renderFrontMatter(lines) {
|
|
3469
3528
|
const frontMatter = {
|
|
3470
|
-
tool: "@rstest/core@0.9.
|
|
3529
|
+
tool: "@rstest/core@0.9.1",
|
|
3471
3530
|
timestamp: new Date().toISOString()
|
|
3472
3531
|
};
|
|
3473
3532
|
if (this.options.header.env) frontMatter.runtime = {
|
|
@@ -3778,7 +3837,11 @@ class TestStateManager {
|
|
|
3778
3837
|
});
|
|
3779
3838
|
}
|
|
3780
3839
|
getCountOfFailedTests() {
|
|
3781
|
-
const testResults = Array.from(this.runningModules.values()).flatMap(({ results })=>results).concat(this.testModules.flatMap((mod)=>mod.results
|
|
3840
|
+
const testResults = Array.from(this.runningModules.values()).flatMap(({ results })=>results).concat(this.testModules.flatMap((mod)=>mod.results.length > 0 ? mod.results : [
|
|
3841
|
+
{
|
|
3842
|
+
status: mod.status
|
|
3843
|
+
}
|
|
3844
|
+
]));
|
|
3782
3845
|
return testResults.filter((t)=>'fail' === t.status).length;
|
|
3783
3846
|
}
|
|
3784
3847
|
onTestFileResult(test) {
|
|
@@ -3837,7 +3900,7 @@ class Rstest {
|
|
|
3837
3900
|
updateSnapshot: rstestConfig.update ? 'all' : T ? 'none' : 'new'
|
|
3838
3901
|
});
|
|
3839
3902
|
this.snapshotManager = snapshotManager;
|
|
3840
|
-
this.version = "0.9.
|
|
3903
|
+
this.version = "0.9.1";
|
|
3841
3904
|
this.rootPath = rootPath;
|
|
3842
3905
|
this.originalConfig = userConfig;
|
|
3843
3906
|
this.normalizedConfig = rstestConfig;
|
|
@@ -3971,4 +4034,4 @@ function defineConfig(config) {
|
|
|
3971
4034
|
function defineProject(config) {
|
|
3972
4035
|
return config;
|
|
3973
4036
|
}
|
|
3974
|
-
export {
|
|
4037
|
+
export { core_createRstest as createRstest, defineConfig, defineProject, detect, error_printError, init_initCli as initCli, loadConfig, mergeProjectConfig, mergeRstestConfig, resolveCommand, runCLI, runRest };
|