@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.
@@ -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 = "", r = 0, n = t(F), E = 0; E < n.length; E++){
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 (r >= s - (2 == o ? 1 : 0)) if (r + o <= i) D += a;
99
+ if (C >= s - (2 == o ? 1 : 0)) if (C + o <= i) D += a;
100
100
  else break;
101
- r += o;
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`, C = {
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(C.modifier);
325
- const iD = Object.keys(C.color), rD = Object.keys(C.bgColor);
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
- ...rD
328
+ ...CD
329
329
  ];
330
- function CD() {
330
+ function rD() {
331
331
  const e = new Map;
332
- for (const [u, t] of Object.entries(C)){
333
- for (const [F, s] of Object.entries(t))C[F] = {
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] = C[F], e.set(s[0], s[1]);
337
- Object.defineProperty(C, u, {
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(C, "codes", {
342
+ return Object.defineProperty(dist_r, "codes", {
343
343
  value: e,
344
344
  enumerable: !1
345
- }), C.color.close = "\x1B[39m", C.bgColor.close = "\x1B[49m", C.color.ansi = dist_N(), C.color.ansi256 = dist_I(), C.color.ansi16m = dist_R(), C.bgColor.ansi = dist_N(dist_w), C.bgColor.ansi256 = dist_I(dist_w), C.bgColor.ansi16m = dist_R(dist_w), Object.defineProperties(C, {
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)=>C.rgbToAnsi256(...C.hexToRgb(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 r = u % 36;
384
- t = Math.floor(u / 36) / 5, F = Math.floor(r / 6) / 5, s = r % 6 / 5;
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)=>C.ansi256ToAnsi(C.rgbToAnsi256(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)=>C.ansi256ToAnsi(C.hexToAnsi256(u)),
398
+ value: (u)=>dist_r.ansi256ToAnsi(dist_r.hexToAnsi256(u)),
399
399
  enumerable: !1
400
400
  }
401
- }), C;
401
+ }), dist_r;
402
402
  }
403
- const ED = CD(), d = new Set([
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 [r, n] of F.entries()){
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(r + 1).join("").startsWith(_)), s) {
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 && r < F.length - 1 && (e.push(""), D = 0);
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 r = [
429
+ let C = [
430
430
  ""
431
431
  ];
432
432
  for (const [E, a] of e.split(" ").entries()){
433
- !1 !== t.trim && (r[r.length - 1] = r[r.length - 1].trimStart());
434
- let o = dist_p(r[r.length - 1]);
435
- if (0 !== E && (o >= u && (!1 === t.wordWrap || !1 === t.trim) && (r.push(""), o = 0), (o > 0 || !1 === t.trim) && (r[r.length - 1] += " ", o++)), t.hard && D[E] > u) {
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 && r.push(""), k(r, a, u);
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(r, a, u);
442
+ k(C, a, u);
443
443
  continue;
444
444
  }
445
- r.push("");
445
+ C.push("");
446
446
  }
447
447
  if (o + D[E] > u && !1 === t.wordWrap) {
448
- k(r, a, u);
448
+ k(C, a, u);
449
449
  continue;
450
450
  }
451
- r[r.length - 1] += a;
451
+ C[C.length - 1] += a;
452
452
  }
453
- !1 !== t.trim && (r = r.map((E)=>hD(E)));
453
+ !1 !== t.trim && (C = C.map((E)=>hD(E)));
454
454
  const n = [
455
- ...r.join(`
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: r, sequence: n })=>{
547
+ const i = (D, { name: C, sequence: n })=>{
548
548
  const E = String(D);
549
549
  if (dist_$([
550
550
  E,
551
- r,
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" === r ? 0 : -1, o = "return" === r ? -1 : 0;
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, ...r } = u;
579
- this.opts = r, 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;
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 (!this.value && this.opts.placeholder && (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder)), this.opts.validate) {
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.8.4";
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 = async (promptText, onComplete)=>{
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: async ()=>{
86
+ action: ()=>{
87
87
  clearCurrentInputLine();
88
- await promptInput('Enter test name pattern (empty to clear): ', async (pattern)=>{
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: async ()=>{
96
+ action: ()=>{
97
97
  clearCurrentInputLine();
98
- await promptInput('Enter file name pattern (empty to clear): ', async (input)=>{
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 duration = shouldUnifyReporter && browserResult ? {
330
- totalTime: testTime + buildTime + browserResult.duration.totalTime,
331
- buildTime: buildTime + browserResult.duration.buildTime,
332
- testTime: testTime + browserResult.duration.testTime
333
- } : {
334
- totalTime: testTime + buildTime,
335
- buildTime,
336
- testTime
337
- };
338
- const results = returns.flatMap((r)=>r.results);
339
- const testResults = returns.flatMap((r)=>r.testResults);
340
- const errors = returns.flatMap((r)=>r.errors || []);
341
- if (shouldUnifyReporter && browserResult?.results) results.push(...browserResult.results);
342
- if (shouldUnifyReporter && browserResult?.testResults) testResults.push(...browserResult.testResults);
343
- if (shouldUnifyReporter && browserResult?.unhandledErrors) errors.push(...browserResult.unhandledErrors);
344
- context.updateReporterResultState(results, testResults, currentDeletedEntries);
345
- const nodeHasFailure = results.some((r)=>'fail' === r.status) || errors.length;
346
- const browserHasFailure = shouldUnifyReporter && browserResult?.hasFailure;
347
- if (0 === results.length && !errors.length) {
348
- if ('watch' === command) if ('on-demand' === mode) logger_logger.log(color.yellow('No test files need re-run.'));
349
- else logger_logger.log(color.yellow('No test files found.'));
350
- else {
351
- const code = context.normalizedConfig.passWithNoTests ? 0 : 1;
352
- const message = `No test files found, exiting with code ${code}.`;
353
- if (0 === code) logger_logger.log(color.yellow(message));
354
- else logger_logger.error(color.red(message));
355
- process.exitCode = code;
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
- if ('all' === mode) {
358
- if (context.fileFilters?.length) logger_logger.log(color.gray('filter: '), context.fileFilters.join(color.gray(', ')));
359
- allProjects.forEach((p)=>{
360
- if (allProjects.length > 1) {
361
- logger_logger.log('');
362
- logger_logger.log(color.gray('project:'), p.name);
363
- }
364
- logger_logger.log(color.gray('root:'), p.rootPath);
365
- logger_logger.log(color.gray('include:'), p.normalizedConfig.include.join(color.gray(', ')));
366
- logger_logger.log(color.gray('exclude:'), p.normalizedConfig.exclude.patterns.join(color.gray(', ')));
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
- const isFailure = nodeHasFailure || browserHasFailure;
371
- if (isFailure) process.exitCode = 1;
372
- for (const reporter of reporters)await reporter.onTestRunEnd?.({
373
- results: context.reporterResults.results,
374
- testResults: context.reporterResults.testResults,
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.1/node_modules/@babel/code-frame/lib/index.js" (__unused_rspack_module, exports, __webpack_require__) {
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
- const JSX_TAG = /^[a-z][\w-]*$/i;
70
- const getTokenType = function(token, offset, text) {
71
- if ("name" === token.type) {
72
- if (helperValidatorIdentifier.isKeyword(token.value) || helperValidatorIdentifier.isStrictReservedWord(token.value, true) || sometimesKeywords.has(token.value)) return "keyword";
73
- if (JSX_TAG.test(token.value) && ("<" === text[offset - 1] || "</" === text.slice(offset - 2, offset))) return "jsxIdentifier";
74
- if (token.value[0] !== token.value[0].toLowerCase()) return "capitalized";
75
- }
76
- if ("punctuator" === token.type && BRACKET.test(token.value)) return "bracket";
77
- if ("invalid" === token.type && ("@" === token.value || "#" === token.value)) return "punctuator";
78
- return token.type;
79
- };
80
- tokenize = function*(text) {
81
- let match;
82
- while(match = jsTokens.default.exec(text)){
83
- const token = jsTokens.matchToToken(match);
84
- yield {
85
- type: getTokenType(token, match.index, text),
86
- value: token.value
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] === name[0]?.toUpperCase();
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
@@ -36,7 +36,7 @@ const asModule = async (something, defaultExport, context, unlinked)=>{
36
36
  context
37
37
  });
38
38
  if (unlinked) return m;
39
- await m.link(()=>{});
39
+ await m.link(()=>void 0);
40
40
  if (m.instantiate) m.instantiate();
41
41
  await m.evaluate();
42
42
  return m;
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~9348.js";
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 { render } from '@rstest/browser-react';
168
- import Counter from './Counter.${componentExt}';
169
-
170
- test('increments count on button click', async () => {
171
- const screen = await render(<Counter initial={5} />);
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(screen.getByText('Count: 5')).toBeInTheDocument();
174
+ await expect.element(page.getByText('Count: 5')).toBeVisible();
174
175
 
175
- await screen.getByRole('button', { name: 'Increment' }).click();
176
- await expect.element(screen.getByText('Count: 6')).toBeInTheDocument();
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
- document.body.appendChild(createCounter(5));
242
-
243
- await expect.element(page.getByText('Count: 5')).toBeInTheDocument();
244
-
245
- await page.getByRole('button', { name: 'Increment' }).click();
246
- await expect.element(page.getByText('Count: 6')).toBeInTheDocument();
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.8.4");
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.8.4");
454
+ const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.9.0");
454
455
  updatePackageJsonDevDeps(cwd, deps);
455
456
  return createdFiles;
456
457
  }