@rstest/core 0.8.4 → 0.9.0
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/{0~9348.js → 0~1240.js} +41 -41
- package/dist/0~1472.js +2 -2
- package/dist/0~2173.js +84 -71
- package/dist/{0~3919.js → 0~262.js} +31 -30
- package/dist/0~3062.js +1 -1
- package/dist/0~3346.js +1 -1
- package/dist/0~6923.js +1 -1
- package/dist/0~7882.js +23 -22
- package/dist/0~89.js +32 -29
- package/dist/0~9634.js +5 -5
- package/dist/1294.js +2 -1
- package/dist/3160.js +3 -48
- package/dist/{9869.js → 4597.js} +33 -44
- package/dist/6151.js +108 -31
- package/dist/9131.js +30 -15
- package/dist/browser-runtime/389.js +144 -92
- package/dist/browser-runtime/index.d.ts +40 -10
- package/dist/browser.d.ts +53 -10
- package/dist/index.d.ts +41 -79
- package/dist/mockRuntimeCode.js +15 -4
- package/dist/worker.d.ts +13 -1521
- package/dist/worker.js +14 -34
- package/package.json +14 -13
|
@@ -94,11 +94,11 @@ var W = {
|
|
|
94
94
|
return i;
|
|
95
95
|
}, u.slice = function(F, s, i) {
|
|
96
96
|
textLen = u.length(F), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
97
|
-
for(var D = "",
|
|
97
|
+
for(var D = "", C = 0, n = t(F), E = 0; E < n.length; E++){
|
|
98
98
|
var a = n[E], o = u.length(a);
|
|
99
|
-
if (
|
|
99
|
+
if (C >= s - (2 == o ? 1 : 0)) if (C + o <= i) D += a;
|
|
100
100
|
else break;
|
|
101
|
-
|
|
101
|
+
C += o;
|
|
102
102
|
}
|
|
103
103
|
return D;
|
|
104
104
|
};
|
|
@@ -133,7 +133,7 @@ function dist_p(e, u = {}) {
|
|
|
133
133
|
}
|
|
134
134
|
return F;
|
|
135
135
|
}
|
|
136
|
-
const dist_w = 10, dist_N = (e = 0)=>(u)=>`\x1B[${u + e}m`, dist_I = (e = 0)=>(u)=>`\x1B[${38 + e};5;${u}m`, dist_R = (e = 0)=>(u, t, F)=>`\x1B[${38 + e};2;${u};${t};${F}m`,
|
|
136
|
+
const dist_w = 10, dist_N = (e = 0)=>(u)=>`\x1B[${u + e}m`, dist_I = (e = 0)=>(u)=>`\x1B[${38 + e};5;${u}m`, dist_R = (e = 0)=>(u, t, F)=>`\x1B[${38 + e};2;${u};${t};${F}m`, dist_r = {
|
|
137
137
|
modifier: {
|
|
138
138
|
reset: [
|
|
139
139
|
0,
|
|
@@ -321,28 +321,28 @@ const dist_w = 10, dist_N = (e = 0)=>(u)=>`\x1B[${u + e}m`, dist_I = (e = 0)=>(u
|
|
|
321
321
|
]
|
|
322
322
|
}
|
|
323
323
|
};
|
|
324
|
-
Object.keys(
|
|
325
|
-
const iD = Object.keys(
|
|
324
|
+
Object.keys(dist_r.modifier);
|
|
325
|
+
const iD = Object.keys(dist_r.color), CD = Object.keys(dist_r.bgColor);
|
|
326
326
|
[
|
|
327
327
|
...iD,
|
|
328
|
-
...
|
|
328
|
+
...CD
|
|
329
329
|
];
|
|
330
|
-
function
|
|
330
|
+
function rD() {
|
|
331
331
|
const e = new Map;
|
|
332
|
-
for (const [u, t] of Object.entries(
|
|
333
|
-
for (const [F, s] of Object.entries(t))
|
|
332
|
+
for (const [u, t] of Object.entries(dist_r)){
|
|
333
|
+
for (const [F, s] of Object.entries(t))dist_r[F] = {
|
|
334
334
|
open: `\x1B[${s[0]}m`,
|
|
335
335
|
close: `\x1B[${s[1]}m`
|
|
336
|
-
}, t[F] =
|
|
337
|
-
Object.defineProperty(
|
|
336
|
+
}, t[F] = dist_r[F], e.set(s[0], s[1]);
|
|
337
|
+
Object.defineProperty(dist_r, u, {
|
|
338
338
|
value: t,
|
|
339
339
|
enumerable: !1
|
|
340
340
|
});
|
|
341
341
|
}
|
|
342
|
-
return Object.defineProperty(
|
|
342
|
+
return Object.defineProperty(dist_r, "codes", {
|
|
343
343
|
value: e,
|
|
344
344
|
enumerable: !1
|
|
345
|
-
}),
|
|
345
|
+
}), dist_r.color.close = "\x1B[39m", dist_r.bgColor.close = "\x1B[49m", dist_r.color.ansi = dist_N(), dist_r.color.ansi256 = dist_I(), dist_r.color.ansi16m = dist_R(), dist_r.bgColor.ansi = dist_N(dist_w), dist_r.bgColor.ansi256 = dist_I(dist_w), dist_r.bgColor.ansi16m = dist_R(dist_w), Object.defineProperties(dist_r, {
|
|
346
346
|
rgbToAnsi256: {
|
|
347
347
|
value: (u, t, F)=>u === t && t === F ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F / 255 * 5),
|
|
348
348
|
enumerable: !1
|
|
@@ -369,7 +369,7 @@ function CD() {
|
|
|
369
369
|
enumerable: !1
|
|
370
370
|
},
|
|
371
371
|
hexToAnsi256: {
|
|
372
|
-
value: (u)=>
|
|
372
|
+
value: (u)=>dist_r.rgbToAnsi256(...dist_r.hexToRgb(u)),
|
|
373
373
|
enumerable: !1
|
|
374
374
|
},
|
|
375
375
|
ansi256ToAnsi: {
|
|
@@ -380,8 +380,8 @@ function CD() {
|
|
|
380
380
|
if (u >= 232) t = ((u - 232) * 10 + 8) / 255, F = t, s = t;
|
|
381
381
|
else {
|
|
382
382
|
u -= 16;
|
|
383
|
-
const
|
|
384
|
-
t = Math.floor(u / 36) / 5, F = Math.floor(
|
|
383
|
+
const C = u % 36;
|
|
384
|
+
t = Math.floor(u / 36) / 5, F = Math.floor(C / 6) / 5, s = C % 6 / 5;
|
|
385
385
|
}
|
|
386
386
|
const i = 2 * Math.max(t, F, s);
|
|
387
387
|
if (0 === i) return 30;
|
|
@@ -391,16 +391,16 @@ function CD() {
|
|
|
391
391
|
enumerable: !1
|
|
392
392
|
},
|
|
393
393
|
rgbToAnsi: {
|
|
394
|
-
value: (u, t, F)=>
|
|
394
|
+
value: (u, t, F)=>dist_r.ansi256ToAnsi(dist_r.rgbToAnsi256(u, t, F)),
|
|
395
395
|
enumerable: !1
|
|
396
396
|
},
|
|
397
397
|
hexToAnsi: {
|
|
398
|
-
value: (u)=>
|
|
398
|
+
value: (u)=>dist_r.ansi256ToAnsi(dist_r.hexToAnsi256(u)),
|
|
399
399
|
enumerable: !1
|
|
400
400
|
}
|
|
401
|
-
}),
|
|
401
|
+
}), dist_r;
|
|
402
402
|
}
|
|
403
|
-
const ED =
|
|
403
|
+
const ED = rD(), d = new Set([
|
|
404
404
|
"\x1B",
|
|
405
405
|
"\x9B"
|
|
406
406
|
]), oD = 39, y = "\x07", V = "[", nD = "]", G = "m", _ = `${nD}8;;`, dist_z = (e)=>`${d.values().next().value}${V}${e}${G}`, K = (e)=>`${d.values().next().value}${_}${e}${y}`, aD = (e)=>e.split(" ").map((u)=>dist_p(u)), k = (e, u, t)=>{
|
|
@@ -408,13 +408,13 @@ const ED = CD(), d = new Set([
|
|
|
408
408
|
...u
|
|
409
409
|
];
|
|
410
410
|
let s = !1, i = !1, D = dist_p(P(e[e.length - 1]));
|
|
411
|
-
for (const [
|
|
411
|
+
for (const [C, n] of F.entries()){
|
|
412
412
|
const E = dist_p(n);
|
|
413
|
-
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = !0, i = F.slice(
|
|
413
|
+
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = !0, i = F.slice(C + 1).join("").startsWith(_)), s) {
|
|
414
414
|
i ? n === y && (s = !1, i = !1) : n === G && (s = !1);
|
|
415
415
|
continue;
|
|
416
416
|
}
|
|
417
|
-
D += E, D === t &&
|
|
417
|
+
D += E, D === t && C < F.length - 1 && (e.push(""), D = 0);
|
|
418
418
|
}
|
|
419
419
|
!D && e[e.length - 1].length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
420
420
|
}, hD = (e)=>{
|
|
@@ -426,33 +426,33 @@ const ED = CD(), d = new Set([
|
|
|
426
426
|
if (!1 !== t.trim && "" === e.trim()) return "";
|
|
427
427
|
let F = "", s, i;
|
|
428
428
|
const D = aD(e);
|
|
429
|
-
let
|
|
429
|
+
let C = [
|
|
430
430
|
""
|
|
431
431
|
];
|
|
432
432
|
for (const [E, a] of e.split(" ").entries()){
|
|
433
|
-
!1 !== t.trim && (
|
|
434
|
-
let o = dist_p(
|
|
435
|
-
if (0 !== E && (o >= u && (!1 === t.wordWrap || !1 === t.trim) && (
|
|
433
|
+
!1 !== t.trim && (C[C.length - 1] = C[C.length - 1].trimStart());
|
|
434
|
+
let o = dist_p(C[C.length - 1]);
|
|
435
|
+
if (0 !== E && (o >= u && (!1 === t.wordWrap || !1 === t.trim) && (C.push(""), o = 0), (o > 0 || !1 === t.trim) && (C[C.length - 1] += " ", o++)), t.hard && D[E] > u) {
|
|
436
436
|
const c = u - o, f = 1 + Math.floor((D[E] - c - 1) / u);
|
|
437
|
-
Math.floor((D[E] - 1) / u) < f &&
|
|
437
|
+
Math.floor((D[E] - 1) / u) < f && C.push(""), k(C, a, u);
|
|
438
438
|
continue;
|
|
439
439
|
}
|
|
440
440
|
if (o + D[E] > u && o > 0 && D[E] > 0) {
|
|
441
441
|
if (!1 === t.wordWrap && o < u) {
|
|
442
|
-
k(
|
|
442
|
+
k(C, a, u);
|
|
443
443
|
continue;
|
|
444
444
|
}
|
|
445
|
-
|
|
445
|
+
C.push("");
|
|
446
446
|
}
|
|
447
447
|
if (o + D[E] > u && !1 === t.wordWrap) {
|
|
448
|
-
k(
|
|
448
|
+
k(C, a, u);
|
|
449
449
|
continue;
|
|
450
450
|
}
|
|
451
|
-
|
|
451
|
+
C[C.length - 1] += a;
|
|
452
452
|
}
|
|
453
|
-
!1 !== t.trim && (
|
|
453
|
+
!1 !== t.trim && (C = C.map((E)=>hD(E)));
|
|
454
454
|
const n = [
|
|
455
|
-
...
|
|
455
|
+
...C.join(`
|
|
456
456
|
`)
|
|
457
457
|
];
|
|
458
458
|
for (const [E, a] of n.entries()){
|
|
@@ -544,18 +544,18 @@ function fD({ input: e = stdin, output: u = stdout, overwrite: t = !0, hideCurso
|
|
|
544
544
|
tabSize: 1
|
|
545
545
|
});
|
|
546
546
|
emitKeypressEvents(e, s), e.isTTY && e.setRawMode(!0);
|
|
547
|
-
const i = (D, { name:
|
|
547
|
+
const i = (D, { name: C, sequence: n })=>{
|
|
548
548
|
const E = String(D);
|
|
549
549
|
if (dist_$([
|
|
550
550
|
E,
|
|
551
|
-
|
|
551
|
+
C,
|
|
552
552
|
n
|
|
553
553
|
], "cancel")) {
|
|
554
554
|
F && u.write(src.cursor.show), process.exit(0);
|
|
555
555
|
return;
|
|
556
556
|
}
|
|
557
557
|
if (!t) return;
|
|
558
|
-
const a = "return" ===
|
|
558
|
+
const a = "return" === C ? 0 : -1, o = "return" === C ? -1 : 0;
|
|
559
559
|
moveCursor(u, a, o, ()=>{
|
|
560
560
|
clearLine(u, 1, ()=>{
|
|
561
561
|
e.once("keypress", i);
|
|
@@ -575,8 +575,8 @@ var gD = Object.defineProperty, vD = (e, u, t)=>u in e ? gD(e, u, {
|
|
|
575
575
|
class x {
|
|
576
576
|
constructor(u, t = !0){
|
|
577
577
|
dist_h(this, "input"), dist_h(this, "output"), dist_h(this, "_abortSignal"), dist_h(this, "rl"), dist_h(this, "opts"), dist_h(this, "_render"), dist_h(this, "_track", !1), dist_h(this, "_prevFrame", ""), dist_h(this, "_subscribers", new Map), dist_h(this, "_cursor", 0), dist_h(this, "state", "initial"), dist_h(this, "error", ""), dist_h(this, "value");
|
|
578
|
-
const { input: F = stdin, output: s = stdout, render: i, signal: D, ...
|
|
579
|
-
this.opts =
|
|
578
|
+
const { input: F = stdin, output: s = stdout, render: i, signal: D, ...C } = u;
|
|
579
|
+
this.opts = C, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = t, this._abortSignal = D, this.input = F, this.output = s;
|
|
580
580
|
}
|
|
581
581
|
unsubscribe() {
|
|
582
582
|
this._subscribers.clear();
|
|
@@ -630,7 +630,7 @@ class x {
|
|
|
630
630
|
}
|
|
631
631
|
onKeypress(u, t) {
|
|
632
632
|
if ("error" === this.state && (this.state = "active"), t?.name && (!this._track && dist_B.aliases.has(t.name) && this.emit("cursor", dist_B.aliases.get(t.name)), dist_B.actions.has(t.name) && this.emit("cursor", t.name)), u && ("y" === u.toLowerCase() || "n" === u.toLowerCase()) && this.emit("confirm", "y" === u.toLowerCase()), " " === u && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), t?.name === "return") {
|
|
633
|
-
if (
|
|
633
|
+
if (this.opts.validate) {
|
|
634
634
|
const F = this.opts.validate(this.value);
|
|
635
635
|
F && (this.error = F instanceof Error ? F.message : F, this.state = "error", this.rl?.write(this.value));
|
|
636
636
|
}
|
package/dist/0~1472.js
CHANGED
|
@@ -4,7 +4,7 @@ import { pathToFileURL } from "./6198.js";
|
|
|
4
4
|
import "./1157.js";
|
|
5
5
|
import { logger as logger_logger, color } from "./3160.js";
|
|
6
6
|
async function loadBrowserModule(options = {}) {
|
|
7
|
-
const coreVersion = "0.
|
|
7
|
+
const coreVersion = "0.9.0";
|
|
8
8
|
const { projectRoots = [] } = options;
|
|
9
9
|
let browserModule;
|
|
10
10
|
let browserVersion;
|
|
@@ -18,7 +18,7 @@ async function loadBrowserModule(options = {}) {
|
|
|
18
18
|
];
|
|
19
19
|
for (const base of uniqueBases)try {
|
|
20
20
|
const userRequire = createRequire(base);
|
|
21
|
-
const browserPath = userRequire.resolve('@rstest/browser');
|
|
21
|
+
const browserPath = userRequire.resolve('@rstest/browser/internal');
|
|
22
22
|
const browserPkgPath = userRequire.resolve('@rstest/browser/package.json');
|
|
23
23
|
browserModule = await import(pathToFileURL(browserPath).href);
|
|
24
24
|
const browserPkg = userRequire(browserPkgPath);
|
package/dist/0~2173.js
CHANGED
|
@@ -21,7 +21,7 @@ async function setupCliShortcuts({ closeServer, runAll, updateSnapshot, runFaile
|
|
|
21
21
|
process.stdout.write('\r\x1b[2K');
|
|
22
22
|
} catch {}
|
|
23
23
|
};
|
|
24
|
-
const promptInput =
|
|
24
|
+
const promptInput = (promptText, onComplete)=>{
|
|
25
25
|
if (isPrompting) return;
|
|
26
26
|
isPrompting = true;
|
|
27
27
|
let buffer = '';
|
|
@@ -83,9 +83,9 @@ async function setupCliShortcuts({ closeServer, runAll, updateSnapshot, runFaile
|
|
|
83
83
|
{
|
|
84
84
|
key: 't',
|
|
85
85
|
description: `${color.bold('t')} ${color.dim('filter by a test name regex pattern')}`,
|
|
86
|
-
action:
|
|
86
|
+
action: ()=>{
|
|
87
87
|
clearCurrentInputLine();
|
|
88
|
-
|
|
88
|
+
promptInput('Enter test name pattern (empty to clear): ', async (pattern)=>{
|
|
89
89
|
await runWithTestNamePattern(pattern);
|
|
90
90
|
});
|
|
91
91
|
}
|
|
@@ -93,9 +93,9 @@ async function setupCliShortcuts({ closeServer, runAll, updateSnapshot, runFaile
|
|
|
93
93
|
{
|
|
94
94
|
key: 'p',
|
|
95
95
|
description: `${color.bold('p')} ${color.dim('filter by a filename regex pattern')}`,
|
|
96
|
-
action:
|
|
96
|
+
action: ()=>{
|
|
97
97
|
clearCurrentInputLine();
|
|
98
|
-
|
|
98
|
+
promptInput('Enter file name pattern (empty to clear): ', async (input)=>{
|
|
99
99
|
const filters = input ? input.split(/\s+/).filter(Boolean) : void 0;
|
|
100
100
|
await runWithFileFilters(filters);
|
|
101
101
|
});
|
|
@@ -214,7 +214,7 @@ async function runTests(context) {
|
|
|
214
214
|
skipOnTestRunEnd: shouldUnifyReporter,
|
|
215
215
|
shardedEntries: shard ? browserEntries : void 0
|
|
216
216
|
});
|
|
217
|
-
browserResultPromise.catch(()=>
|
|
217
|
+
browserResultPromise.catch(()=>void 0);
|
|
218
218
|
}
|
|
219
219
|
if (!hasNodeTestsToRun) {
|
|
220
220
|
if (browserResultPromise) await browserResultPromise;
|
|
@@ -326,73 +326,86 @@ async function runTests(context) {
|
|
|
326
326
|
const buildTime = testStart - buildStart;
|
|
327
327
|
const testTime = Date.now() - testStart;
|
|
328
328
|
const browserResult = browserResultPromise ? await browserResultPromise : void 0;
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
329
|
+
const browserResolveSourcemap = browserResult?.resolveSourcemap;
|
|
330
|
+
const browserClose = browserResult?.close;
|
|
331
|
+
try {
|
|
332
|
+
const nodeResourceByAssetName = new Map();
|
|
333
|
+
for (const item of returns)for (const assetName of item.assetNames)nodeResourceByAssetName.set(assetName, item.getSourceMaps);
|
|
334
|
+
const getSourcemap = async (sourcePath)=>{
|
|
335
|
+
if (browserResolveSourcemap) {
|
|
336
|
+
const resolved = await browserResolveSourcemap(sourcePath);
|
|
337
|
+
if (resolved.handled) return resolved.sourcemap;
|
|
338
|
+
}
|
|
339
|
+
const getSourceMaps = nodeResourceByAssetName.get(sourcePath);
|
|
340
|
+
const sourceMap = (await getSourceMaps?.([
|
|
341
|
+
sourcePath
|
|
342
|
+
]))?.[sourcePath];
|
|
343
|
+
return sourceMap ? JSON.parse(sourceMap) : null;
|
|
344
|
+
};
|
|
345
|
+
const duration = shouldUnifyReporter && browserResult ? {
|
|
346
|
+
totalTime: testTime + buildTime + browserResult.duration.totalTime,
|
|
347
|
+
buildTime: buildTime + browserResult.duration.buildTime,
|
|
348
|
+
testTime: testTime + browserResult.duration.testTime
|
|
349
|
+
} : {
|
|
350
|
+
totalTime: testTime + buildTime,
|
|
351
|
+
buildTime,
|
|
352
|
+
testTime
|
|
353
|
+
};
|
|
354
|
+
const results = returns.flatMap((r)=>r.results);
|
|
355
|
+
const testResults = returns.flatMap((r)=>r.testResults);
|
|
356
|
+
const errors = returns.flatMap((r)=>r.errors || []);
|
|
357
|
+
if (shouldUnifyReporter && browserResult?.results) results.push(...browserResult.results);
|
|
358
|
+
if (shouldUnifyReporter && browserResult?.testResults) testResults.push(...browserResult.testResults);
|
|
359
|
+
if (shouldUnifyReporter && browserResult?.unhandledErrors) errors.push(...browserResult.unhandledErrors);
|
|
360
|
+
context.updateReporterResultState(results, testResults, currentDeletedEntries);
|
|
361
|
+
const nodeHasFailure = results.some((r)=>'fail' === r.status) || errors.length;
|
|
362
|
+
const browserHasFailure = shouldUnifyReporter && browserResult?.hasFailure;
|
|
363
|
+
if (0 === results.length && !errors.length) {
|
|
364
|
+
if ('watch' === command) if ('on-demand' === mode) logger_logger.log(color.yellow('No test files need re-run.'));
|
|
365
|
+
else logger_logger.log(color.yellow('No test files found.'));
|
|
366
|
+
else {
|
|
367
|
+
const code = context.normalizedConfig.passWithNoTests ? 0 : 1;
|
|
368
|
+
const message = `No test files found, exiting with code ${code}.`;
|
|
369
|
+
if (0 === code) logger_logger.log(color.yellow(message));
|
|
370
|
+
else logger_logger.error(color.red(message));
|
|
371
|
+
process.exitCode = code;
|
|
372
|
+
}
|
|
373
|
+
if ('all' === mode) {
|
|
374
|
+
if (context.fileFilters?.length) logger_logger.log(color.gray('filter: '), context.fileFilters.join(color.gray(', ')));
|
|
375
|
+
allProjects.forEach((p)=>{
|
|
376
|
+
if (allProjects.length > 1) {
|
|
377
|
+
logger_logger.log('');
|
|
378
|
+
logger_logger.log(color.gray('project:'), p.name);
|
|
379
|
+
}
|
|
380
|
+
logger_logger.log(color.gray('root:'), p.rootPath);
|
|
381
|
+
logger_logger.log(color.gray('include:'), p.normalizedConfig.include.join(color.gray(', ')));
|
|
382
|
+
logger_logger.log(color.gray('exclude:'), p.normalizedConfig.exclude.patterns.join(color.gray(', ')));
|
|
383
|
+
});
|
|
384
|
+
}
|
|
356
385
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
386
|
+
const isFailure = nodeHasFailure || browserHasFailure;
|
|
387
|
+
if (isFailure) process.exitCode = 1;
|
|
388
|
+
for (const reporter of reporters)await reporter.onTestRunEnd?.({
|
|
389
|
+
results: context.reporterResults.results,
|
|
390
|
+
testResults: context.reporterResults.testResults,
|
|
391
|
+
unhandledErrors: errors,
|
|
392
|
+
snapshotSummary: snapshotManager.summary,
|
|
393
|
+
duration,
|
|
394
|
+
getSourcemap,
|
|
395
|
+
filterRerunTestPaths: currentEntries.length ? currentEntries.map((e)=>e.testPath) : void 0
|
|
396
|
+
});
|
|
397
|
+
if (coverageProvider && (!isFailure || coverage.reportOnFailure)) {
|
|
398
|
+
const { generateCoverage } = await import("./0~4403.js").then((mod)=>({
|
|
399
|
+
generateCoverage: mod.generateCoverage
|
|
400
|
+
}));
|
|
401
|
+
await generateCoverage(context, results, coverageProvider);
|
|
368
402
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
unhandledErrors: errors,
|
|
376
|
-
snapshotSummary: snapshotManager.summary,
|
|
377
|
-
duration,
|
|
378
|
-
getSourcemap: async (name)=>{
|
|
379
|
-
const resource = returns.find((r)=>r.assetNames.includes(name));
|
|
380
|
-
const sourceMap = (await resource?.getSourceMaps([
|
|
381
|
-
name
|
|
382
|
-
]))?.[name];
|
|
383
|
-
return sourceMap ? JSON.parse(sourceMap) : null;
|
|
384
|
-
},
|
|
385
|
-
filterRerunTestPaths: currentEntries.length ? currentEntries.map((e)=>e.testPath) : void 0
|
|
386
|
-
});
|
|
387
|
-
if (coverageProvider && (!isFailure || coverage.reportOnFailure)) {
|
|
388
|
-
const { generateCoverage } = await import("./0~4403.js").then((mod)=>({
|
|
389
|
-
generateCoverage: mod.generateCoverage
|
|
390
|
-
}));
|
|
391
|
-
await generateCoverage(context, results, coverageProvider);
|
|
392
|
-
}
|
|
393
|
-
if (isFailure) {
|
|
394
|
-
const bail = context.normalizedConfig.bail;
|
|
395
|
-
if (bail && context.stateManager.getCountOfFailedTests() >= bail) logger_logger.log(color.yellow(`Test run aborted due to reaching the bail limit of ${bail} failed test(s).`));
|
|
403
|
+
if (isFailure) {
|
|
404
|
+
const bail = context.normalizedConfig.bail;
|
|
405
|
+
if (bail && context.stateManager.getCountOfFailedTests() >= bail) logger_logger.log(color.yellow(`Test run aborted due to reaching the bail limit of ${bail} failed test(s).`));
|
|
406
|
+
}
|
|
407
|
+
} finally{
|
|
408
|
+
await browserClose?.();
|
|
396
409
|
}
|
|
397
410
|
};
|
|
398
411
|
if ('watch' === command) {
|
|
@@ -24,7 +24,7 @@ __webpack_require__.add({
|
|
|
24
24
|
return token;
|
|
25
25
|
};
|
|
26
26
|
},
|
|
27
|
-
"../../node_modules/.pnpm/@babel+code-frame@7.
|
|
27
|
+
"../../node_modules/.pnpm/@babel+code-frame@7.29.0/node_modules/@babel/code-frame/lib/index.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
28
28
|
var picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
29
29
|
var jsTokens = __webpack_require__("../../node_modules/.pnpm/js-tokens@4.0.0/node_modules/js-tokens/index.js");
|
|
30
30
|
var helperValidatorIdentifier = __webpack_require__("../../node_modules/.pnpm/@babel+helper-validator-identifier@7.28.5/node_modules/@babel/helper-validator-identifier/lib/index.js");
|
|
@@ -65,29 +65,29 @@ __webpack_require__.add({
|
|
|
65
65
|
const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
|
|
66
66
|
const BRACKET = /^[()[\]{}]$/;
|
|
67
67
|
let tokenize;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
68
|
+
const JSX_TAG = /^[a-z][\w-]*$/i;
|
|
69
|
+
const getTokenType = function(token, offset, text) {
|
|
70
|
+
if ("name" === token.type) {
|
|
71
|
+
const tokenValue = token.value;
|
|
72
|
+
if (helperValidatorIdentifier.isKeyword(tokenValue) || helperValidatorIdentifier.isStrictReservedWord(tokenValue, true) || sometimesKeywords.has(tokenValue)) return "keyword";
|
|
73
|
+
if (JSX_TAG.test(tokenValue) && ("<" === text[offset - 1] || "</" === text.slice(offset - 2, offset))) return "jsxIdentifier";
|
|
74
|
+
const firstChar = String.fromCodePoint(tokenValue.codePointAt(0));
|
|
75
|
+
if (firstChar !== firstChar.toLowerCase()) return "capitalized";
|
|
76
|
+
}
|
|
77
|
+
if ("punctuator" === token.type && BRACKET.test(token.value)) return "bracket";
|
|
78
|
+
if ("invalid" === token.type && ("@" === token.value || "#" === token.value)) return "punctuator";
|
|
79
|
+
return token.type;
|
|
80
|
+
};
|
|
81
|
+
tokenize = function*(text) {
|
|
82
|
+
let match;
|
|
83
|
+
while(match = jsTokens.default.exec(text)){
|
|
84
|
+
const token = jsTokens.matchToToken(match);
|
|
85
|
+
yield {
|
|
86
|
+
type: getTokenType(token, match.index, text),
|
|
87
|
+
value: token.value
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
91
|
function highlight(text) {
|
|
92
92
|
if ("" === text) return "";
|
|
93
93
|
const defs = getDefs(true);
|
|
@@ -97,16 +97,16 @@ __webpack_require__.add({
|
|
|
97
97
|
return highlighted;
|
|
98
98
|
}
|
|
99
99
|
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
100
|
-
function getMarkerLines(loc, source, opts) {
|
|
100
|
+
function getMarkerLines(loc, source, opts, startLineBaseZero) {
|
|
101
101
|
const startLoc = Object.assign({
|
|
102
102
|
column: 0,
|
|
103
103
|
line: -1
|
|
104
104
|
}, loc.start);
|
|
105
105
|
const endLoc = Object.assign({}, startLoc, loc.end);
|
|
106
106
|
const { linesAbove = 2, linesBelow = 3 } = opts || {};
|
|
107
|
-
const startLine = startLoc.line;
|
|
107
|
+
const startLine = startLoc.line - startLineBaseZero;
|
|
108
108
|
const startColumn = startLoc.column;
|
|
109
|
-
const endLine = endLoc.line;
|
|
109
|
+
const endLine = endLoc.line - startLineBaseZero;
|
|
110
110
|
const endColumn = endLoc.column;
|
|
111
111
|
let start = Math.max(startLine - (linesAbove + 1), 0);
|
|
112
112
|
let end = Math.min(source.length, endLine + linesBelow);
|
|
@@ -152,15 +152,16 @@ __webpack_require__.add({
|
|
|
152
152
|
}
|
|
153
153
|
function codeFrameColumns(rawLines, loc, opts = {}) {
|
|
154
154
|
const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;
|
|
155
|
+
const startLineBaseZero = (opts.startLine || 1) - 1;
|
|
155
156
|
const defs = getDefs(shouldHighlight);
|
|
156
157
|
const lines = rawLines.split(NEWLINE);
|
|
157
|
-
const { start, end, markerLines } = getMarkerLines(loc, lines, opts);
|
|
158
|
+
const { start, end, markerLines } = getMarkerLines(loc, lines, opts, startLineBaseZero);
|
|
158
159
|
const hasColumns = loc.start && "number" == typeof loc.start.column;
|
|
159
|
-
const numberMaxWidth = String(end).length;
|
|
160
|
+
const numberMaxWidth = String(end + startLineBaseZero).length;
|
|
160
161
|
const highlightedLines = shouldHighlight ? highlight(rawLines) : rawLines;
|
|
161
162
|
let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index)=>{
|
|
162
163
|
const number = start + 1 + index;
|
|
163
|
-
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
|
164
|
+
const paddedNumber = ` ${number + startLineBaseZero}`.slice(-numberMaxWidth);
|
|
164
165
|
const gutter = ` ${paddedNumber} |`;
|
|
165
166
|
const hasMarker = markerLines[number];
|
|
166
167
|
const lastMarkerLine = !markerLines[number + 1];
|
package/dist/0~3062.js
CHANGED
|
@@ -262,7 +262,7 @@ function getWindowKeys(global, win, additionalKeys = []) {
|
|
|
262
262
|
}));
|
|
263
263
|
}
|
|
264
264
|
function isClassLike(name) {
|
|
265
|
-
return name[0]
|
|
265
|
+
return name[0] && name.startsWith(name[0].toUpperCase());
|
|
266
266
|
}
|
|
267
267
|
function installGlobal(global, win, options = {}) {
|
|
268
268
|
const { bindFunctions = true } = options || {};
|
package/dist/0~3346.js
CHANGED
package/dist/0~6923.js
CHANGED
|
@@ -88,7 +88,7 @@ const asModule = async (something, context, unlinked)=>{
|
|
|
88
88
|
context
|
|
89
89
|
});
|
|
90
90
|
if (unlinked) return syntheticModule;
|
|
91
|
-
await syntheticModule.link(()=>
|
|
91
|
+
await syntheticModule.link(()=>void 0);
|
|
92
92
|
await syntheticModule.evaluate();
|
|
93
93
|
return syntheticModule;
|
|
94
94
|
};
|
package/dist/0~7882.js
CHANGED
|
@@ -2,7 +2,7 @@ import "node:module";
|
|
|
2
2
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
3
|
import { determineAgent, color } from "./3160.js";
|
|
4
4
|
import { detect, resolveCommand } from "./9131.js";
|
|
5
|
-
import { Ie, Me, ye, M, dist_Y, Se, ve, pD, xe } from "./0~
|
|
5
|
+
import { Ie, Me, ye, M, dist_Y, Se, ve, pD, xe } from "./0~1240.js";
|
|
6
6
|
import "./1157.js";
|
|
7
7
|
const external_node_fs_ = __webpack_require__("node:fs");
|
|
8
8
|
const external_node_path_ = __webpack_require__("node:path");
|
|
@@ -164,18 +164,19 @@ export default function Counter({ initial = 0 }) {
|
|
|
164
164
|
function getReactTestTemplate(lang) {
|
|
165
165
|
const componentExt = 'ts' === lang ? 'tsx' : 'jsx';
|
|
166
166
|
return `import { expect, test } from '@rstest/core';
|
|
167
|
-
import {
|
|
168
|
-
import
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
import { page } from '@rstest/browser';
|
|
168
|
+
import { render } from '@rstest/browser-react';
|
|
169
|
+
import Counter from './Counter.${componentExt}';
|
|
170
|
+
|
|
171
|
+
test('increments count on button click', async () => {
|
|
172
|
+
await render(<Counter initial={5} />);
|
|
172
173
|
|
|
173
|
-
await expect.element(
|
|
174
|
+
await expect.element(page.getByText('Count: 5')).toBeVisible();
|
|
174
175
|
|
|
175
|
-
await
|
|
176
|
-
await expect.element(
|
|
177
|
-
});
|
|
178
|
-
`;
|
|
176
|
+
await page.getByRole('button', { name: 'Increment' }).click();
|
|
177
|
+
await expect.element(page.getByText('Count: 6')).toBeVisible();
|
|
178
|
+
});
|
|
179
|
+
`;
|
|
179
180
|
}
|
|
180
181
|
function getVanillaComponentTemplate(lang) {
|
|
181
182
|
if ('ts' === lang) return `export function createCounter(initial = 0): HTMLElement {
|
|
@@ -237,15 +238,15 @@ function getVanillaTestTemplate(lang) {
|
|
|
237
238
|
import { page } from '@rstest/browser';
|
|
238
239
|
import { createCounter } from './Counter.${ext}';
|
|
239
240
|
|
|
240
|
-
test('increments count on button click', async () => {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
});
|
|
248
|
-
`;
|
|
241
|
+
test('increments count on button click', async () => {
|
|
242
|
+
document.body.appendChild(createCounter(5));
|
|
243
|
+
|
|
244
|
+
await expect.element(page.getByText('Count: 5')).toBeVisible();
|
|
245
|
+
|
|
246
|
+
await page.getByRole('button', { name: 'Increment' }).click();
|
|
247
|
+
await expect.element(page.getByText('Count: 6')).toBeVisible();
|
|
248
|
+
});
|
|
249
|
+
`;
|
|
249
250
|
}
|
|
250
251
|
function getDependenciesWithVersions(framework, provider, rstestVersion) {
|
|
251
252
|
const deps = {
|
|
@@ -372,7 +373,7 @@ async function createInteractive(cwd, projectInfo, isAgent) {
|
|
|
372
373
|
}
|
|
373
374
|
const provider = providerSelection;
|
|
374
375
|
const preview = computeFilePreview(cwd, projectInfo);
|
|
375
|
-
const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.
|
|
376
|
+
const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.9.0");
|
|
376
377
|
const depsList = Object.entries(deps).map(([name, version])=>`${name}@${version}`).join(', ');
|
|
377
378
|
const previewLines = [
|
|
378
379
|
`${color.cyan('+')} Create ${preview.configFile}`,
|
|
@@ -450,7 +451,7 @@ async function generateFiles(cwd, projectInfo, provider) {
|
|
|
450
451
|
updatePackageJsonScripts(cwd, {
|
|
451
452
|
'test:browser': 'rstest --config=rstest.browser.config.ts'
|
|
452
453
|
});
|
|
453
|
-
const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.
|
|
454
|
+
const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.9.0");
|
|
454
455
|
updatePackageJsonDevDeps(cwd, deps);
|
|
455
456
|
return createdFiles;
|
|
456
457
|
}
|