@rstest/core 0.3.4 → 0.4.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/LICENSE.md CHANGED
@@ -656,18 +656,6 @@ Licensed under MIT license in the repository at git@github.com:colorjs/color-nam
656
656
  >
657
657
  > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
658
658
 
659
- ### fdir
660
-
661
- Licensed under MIT license in the repository at git+https://github.com/thecodrr/fdir.git.
662
-
663
- > Copyright 2023 Abdullah Atta
664
- >
665
- > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
666
- >
667
- > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
668
- >
669
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
670
-
671
659
  ### has-flag
672
660
 
673
661
  Licensed under MIT license.
@@ -737,7 +725,7 @@ Licensed under MIT license.
737
725
 
738
726
  ### magic-string
739
727
 
740
- Licensed under MIT license.
728
+ Licensed under MIT license in the repository at https://github.com/rich-harris/magic-string.git.
741
729
 
742
730
  > Copyright 2018 Rich Harris
743
731
  >
@@ -1,8 +1,8 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
- export const __webpack_id__ = "465";
3
+ export const __webpack_id__ = "120";
4
4
  export const __webpack_ids__ = [
5
- "465"
5
+ "120"
6
6
  ];
7
7
  export const __webpack_modules__ = {
8
8
  "../../node_modules/.pnpm/stacktrace-parser@0.1.11/node_modules/stacktrace-parser/dist/stack-trace-parser.esm.js": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
@@ -98,15 +98,15 @@ export const __webpack_modules__ = {
98
98
  };
99
99
  }
100
100
  },
101
- "../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.30/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
101
+ "../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
102
102
  __webpack_require__.d(__webpack_exports__, {
103
103
  YX: ()=>TraceMap,
104
104
  sP: ()=>originalPositionFor
105
105
  });
106
- const comma = ','.charCodeAt(0);
107
- const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
108
- const intToChar = new Uint8Array(64);
109
- const charToInt = new Uint8Array(128);
106
+ var comma = ",".charCodeAt(0);
107
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
108
+ var intToChar = new Uint8Array(64);
109
+ var charToInt = new Uint8Array(128);
110
110
  for(let i = 0; i < chars.length; i++){
111
111
  const c = chars.charCodeAt(i);
112
112
  intToChar[i] = c;
@@ -132,7 +132,7 @@ export const __webpack_modules__ = {
132
132
  return reader.peek() !== comma;
133
133
  }
134
134
  typeof TextDecoder;
135
- class StringReader {
135
+ var StringReader = class {
136
136
  constructor(buffer){
137
137
  this.pos = 0;
138
138
  this.buffer = buffer;
@@ -148,7 +148,7 @@ export const __webpack_modules__ = {
148
148
  const idx = buffer.indexOf(char, pos);
149
149
  return -1 === idx ? buffer.length : idx;
150
150
  }
151
- }
151
+ };
152
152
  function decode(mappings) {
153
153
  const { length } = mappings;
154
154
  const reader = new StringReader(mappings);
@@ -159,7 +159,7 @@ export const __webpack_modules__ = {
159
159
  let sourceColumn = 0;
160
160
  let namesIndex = 0;
161
161
  do {
162
- const semi = reader.indexOf(';');
162
+ const semi = reader.indexOf(";");
163
163
  const line = [];
164
164
  let sorted = true;
165
165
  let lastCol = 0;
@@ -571,7 +571,7 @@ export const __webpack_modules__ = {
571
571
  summary.total += result.added + result.matched + result.unmatched + result.updated;
572
572
  }
573
573
  },
574
- "../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
574
+ "../../node_modules/.pnpm/strip-ansi@7.1.2/node_modules/strip-ansi/index.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
575
575
  __webpack_require__.d(__webpack_exports__, {
576
576
  A: ()=>stripAnsi
577
577
  });
@@ -11,7 +11,7 @@ export const __webpack_modules__ = {
11
11
  });
12
12
  var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:fs");
13
13
  var pathe__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("pathe");
14
- var tinyglobby__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/tinyglobby@0.2.14/node_modules/tinyglobby/dist/index.mjs");
14
+ var tinyglobby__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/tinyglobby@0.2.15/node_modules/tinyglobby/dist/index.mjs");
15
15
  var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./src/config.ts");
16
16
  var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/index.ts");
17
17
  async function resolveConfig(options) {
@@ -43,6 +43,10 @@ export const __webpack_modules__ = {
43
43
  ];
44
44
  for (const key of keys)if (void 0 !== options[key]) config[key] = options[key];
45
45
  if (options.reporter) config.reporters = (0, _utils__WEBPACK_IMPORTED_MODULE_3__.bg)(options.reporter);
46
+ if (void 0 !== options.coverage) {
47
+ config.coverage ??= {};
48
+ config.coverage.enabled = options.coverage;
49
+ }
46
50
  if (options.exclude) config.exclude = (0, _utils__WEBPACK_IMPORTED_MODULE_3__.bg)(options.exclude);
47
51
  if (options.include) config.include = (0, _utils__WEBPACK_IMPORTED_MODULE_3__.bg)(options.include);
48
52
  return {
@@ -9,6 +9,7 @@ export const __webpack_modules__ = {
9
9
  __webpack_require__.d(__webpack_exports__, {
10
10
  runTests: ()=>runTests
11
11
  });
12
+ var coverage = __webpack_require__("./src/coverage/index.ts");
12
13
  var src_pool = __webpack_require__("./src/pool/index.ts");
13
14
  var utils = __webpack_require__("./src/utils/index.ts");
14
15
  const isCliShortcutsEnabled = ()=>(0, utils.Un)('stdin');
@@ -198,6 +199,8 @@ export const __webpack_modules__ = {
198
199
  context,
199
200
  recommendWorkerCount
200
201
  });
202
+ const coverageProvider = context.normalizedConfig.coverage.enabled ? await (0, coverage.e)(context.normalizedConfig.coverage || {}, context.rootPath) : null;
203
+ if (coverageProvider) utils.vF.log(` ${utils.yW.gray('Coverage enabled with')} %s\n`, utils.yW.yellow(context.normalizedConfig.coverage.provider));
201
204
  const run = async ({ fileFilters, mode = 'all' } = {})=>{
202
205
  let testStart;
203
206
  const buildStart = Date.now();
@@ -271,6 +274,23 @@ export const __webpack_modules__ = {
271
274
  getSourcemap: (name)=>sourceMaps[name] || null,
272
275
  filterRerunTestPaths: currentEntries.length ? currentEntries.map((e)=>e.testPath) : void 0
273
276
  });
277
+ if (coverageProvider) try {
278
+ const finalCoverageMap = coverageProvider.createCoverageMap();
279
+ for (const result of results)if (result.coverage) finalCoverageMap.merge(result.coverage);
280
+ await coverageProvider.generateReports(finalCoverageMap, context.normalizedConfig.coverage);
281
+ if (context.normalizedConfig.coverage.thresholds) {
282
+ const { checkThresholds } = await __webpack_require__.e("691").then(__webpack_require__.bind(__webpack_require__, "./src/coverage/checkThresholds.ts"));
283
+ const thresholdResult = checkThresholds(finalCoverageMap, context.normalizedConfig.coverage.thresholds);
284
+ if (!thresholdResult.success) {
285
+ process.exitCode = 1;
286
+ utils.vF.log('');
287
+ utils.vF.log(thresholdResult.message);
288
+ }
289
+ }
290
+ coverageProvider.cleanup();
291
+ } catch (error) {
292
+ utils.vF.error('Failed to generate coverage reports:', error);
293
+ }
274
294
  };
275
295
  if ('watch' === command) {
276
296
  const enableCliShortcuts = isCliShortcutsEnabled();
@@ -365,5 +385,44 @@ export const __webpack_modules__ = {
365
385
  await closeServer();
366
386
  }
367
387
  }
388
+ },
389
+ "./src/coverage/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
390
+ __webpack_require__.d(__webpack_exports__, {
391
+ e: ()=>createCoverageProvider,
392
+ loadCoverageProvider: ()=>loadCoverageProvider
393
+ });
394
+ var node_module__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:module");
395
+ var node_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("node:url");
396
+ const CoverageProviderMap = {
397
+ istanbul: '@rstest/coverage-istanbul'
398
+ };
399
+ const loadCoverageProvider = async (options, root)=>{
400
+ const rootPath = (0, node_url__WEBPACK_IMPORTED_MODULE_1__.pathToFileURL)(root).toString();
401
+ const moduleName = CoverageProviderMap[options.provider || 'istanbul'];
402
+ if (!moduleName) throw new Error(`Unknown coverage provider: ${options.provider}`);
403
+ try {
404
+ const require = (0, node_module__WEBPACK_IMPORTED_MODULE_0__.createRequire)(rootPath);
405
+ const modulePath = require.resolve(moduleName, {
406
+ paths: [
407
+ rootPath
408
+ ]
409
+ });
410
+ const { pluginCoverage, CoverageProvider } = await import((0, node_url__WEBPACK_IMPORTED_MODULE_1__.pathToFileURL)(modulePath).toString());
411
+ return {
412
+ pluginCoverage,
413
+ CoverageProvider
414
+ };
415
+ } catch (error) {
416
+ throw new Error(`Failed to load coverage provider module: ${moduleName} in ${root}. Make sure it is installed.\nOriginal error: ${error.message}`);
417
+ }
418
+ };
419
+ async function createCoverageProvider(options, root) {
420
+ if (!options.enabled) return null;
421
+ if (!options.provider || CoverageProviderMap[options.provider]) {
422
+ const { CoverageProvider } = await loadCoverageProvider(options, root);
423
+ return new CoverageProvider(options);
424
+ }
425
+ throw new Error(`Unknown coverage provider: ${options.provider}`);
426
+ }
368
427
  }
369
428
  };
package/dist/0~414.js ADDED
@@ -0,0 +1,16 @@
1
+ import 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import * as __WEBPACK_EXTERNAL_MODULE_fs_promises_400951f8__ from "fs/promises";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_node_stream_444d1c2b__ from "node:stream";
5
+ export const __webpack_id__ = "414";
6
+ export const __webpack_ids__ = [
7
+ "414"
8
+ ];
9
+ export const __webpack_modules__ = {
10
+ "fs/promises": function(module) {
11
+ module.exports = __WEBPACK_EXTERNAL_MODULE_fs_promises_400951f8__;
12
+ },
13
+ "node:stream": function(module) {
14
+ module.exports = __WEBPACK_EXTERNAL_MODULE_node_stream_444d1c2b__;
15
+ }
16
+ };
@@ -1,18 +1,19 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
- export const __webpack_id__ = "607";
3
+ import { AssertionError, strict } from "node:assert";
4
+ import { Console } from "node:console";
5
+ import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
6
+ export const __webpack_id__ = "493";
4
7
  export const __webpack_ids__ = [
5
- "607"
8
+ "493"
6
9
  ];
7
10
  export const __webpack_modules__ = {
8
11
  "./src/runtime/worker/console.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9
12
  __webpack_require__.d(__webpack_exports__, {
10
13
  createCustomConsole: ()=>createCustomConsole
11
14
  });
12
- var node_assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:assert");
13
- var node_console__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("node:console");
14
- var node_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("node:util");
15
- var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/index.ts");
15
+ var external_node_util_ = __webpack_require__("node:util");
16
+ var utils = __webpack_require__("./src/utils/index.ts");
16
17
  const RealDate = Date;
17
18
  function createCustomConsole({ rpc, testPath, printConsoleTrace }) {
18
19
  const getConsoleTrace = ()=>{
@@ -23,21 +24,21 @@ export const __webpack_modules__ = {
23
24
  Error.stackTraceLimit = limit;
24
25
  return trace;
25
26
  };
26
- class CustomConsole extends node_console__WEBPACK_IMPORTED_MODULE_1__.Console {
27
+ class CustomConsole extends Console {
27
28
  _counters = {};
28
29
  _timers = {};
29
30
  _groupDepth = 0;
30
- Console = node_console__WEBPACK_IMPORTED_MODULE_1__.Console;
31
+ Console = Console;
31
32
  getPrettyName(type) {
32
33
  switch(type){
33
34
  case 'error':
34
- return _utils__WEBPACK_IMPORTED_MODULE_3__.yW.red(type);
35
+ return utils.yW.red(type);
35
36
  case 'warn':
36
- return _utils__WEBPACK_IMPORTED_MODULE_3__.yW.yellow(type);
37
+ return utils.yW.yellow(type);
37
38
  case 'info':
38
- return _utils__WEBPACK_IMPORTED_MODULE_3__.yW.cyan(type);
39
+ return utils.yW.cyan(type);
39
40
  default:
40
- return _utils__WEBPACK_IMPORTED_MODULE_3__.yW.gray(type);
41
+ return utils.yW.gray(type);
41
42
  }
42
43
  }
43
44
  _log(name, message, type = 'stdout') {
@@ -51,48 +52,48 @@ export const __webpack_modules__ = {
51
52
  }
52
53
  assert(value, message) {
53
54
  try {
54
- (0, node_assert__WEBPACK_IMPORTED_MODULE_0__.strict)(value, message);
55
+ strict(value, message);
55
56
  } catch (error) {
56
- if (!(error instanceof node_assert__WEBPACK_IMPORTED_MODULE_0__.AssertionError)) throw error;
57
+ if (!(error instanceof AssertionError)) throw error;
57
58
  this._log('assert', error.toString().replaceAll(/:\n\n.*\n/gs, ''), 'stderr');
58
59
  }
59
60
  }
60
61
  count(label = 'default') {
61
62
  if (!this._counters[label]) this._counters[label] = 0;
62
- this._log('count', (0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(`${label}: ${++this._counters[label]}`));
63
+ this._log('count', (0, external_node_util_.format)(`${label}: ${++this._counters[label]}`));
63
64
  }
64
65
  countReset(label = 'default') {
65
66
  this._counters[label] = 0;
66
67
  }
67
68
  debug(firstArg, ...args) {
68
- this._log('debug', (0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(firstArg, ...args));
69
+ this._log('debug', (0, external_node_util_.format)(firstArg, ...args));
69
70
  }
70
71
  dir(firstArg, options = {}) {
71
- const representation = (0, node_util__WEBPACK_IMPORTED_MODULE_2__.inspect)(firstArg, options);
72
- this._log('dir', (0, node_util__WEBPACK_IMPORTED_MODULE_2__.formatWithOptions)(options, representation));
72
+ const representation = (0, external_node_util_.inspect)(firstArg, options);
73
+ this._log('dir', (0, external_node_util_.formatWithOptions)(options, representation));
73
74
  }
74
75
  dirxml(firstArg, ...args) {
75
- this._log('dirxml', (0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(firstArg, ...args));
76
+ this._log('dirxml', (0, external_node_util_.format)(firstArg, ...args));
76
77
  }
77
78
  error(firstArg, ...args) {
78
- this._log('error', (0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(firstArg, ...args), 'stderr');
79
+ this._log('error', (0, external_node_util_.format)(firstArg, ...args), 'stderr');
79
80
  }
80
81
  group(title, ...args) {
81
82
  this._groupDepth++;
82
- if (null != title || args.length > 0) this._log('group', _utils__WEBPACK_IMPORTED_MODULE_3__.yW.bold((0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(title, ...args)));
83
+ if (null != title || args.length > 0) this._log('group', utils.yW.bold((0, external_node_util_.format)(title, ...args)));
83
84
  }
84
85
  groupCollapsed(title, ...args) {
85
86
  this._groupDepth++;
86
- if (null != title || args.length > 0) this._log('groupCollapsed', _utils__WEBPACK_IMPORTED_MODULE_3__.yW.bold((0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(title, ...args)));
87
+ if (null != title || args.length > 0) this._log('groupCollapsed', utils.yW.bold((0, external_node_util_.format)(title, ...args)));
87
88
  }
88
89
  groupEnd() {
89
90
  if (this._groupDepth > 0) this._groupDepth--;
90
91
  }
91
92
  info(firstArg, ...args) {
92
- this._log('info', (0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(firstArg, ...args));
93
+ this._log('info', (0, external_node_util_.format)(firstArg, ...args));
93
94
  }
94
95
  log(firstArg, ...args) {
95
- this._log('log', (0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(firstArg, ...args));
96
+ this._log('log', (0, external_node_util_.format)(firstArg, ...args));
96
97
  }
97
98
  time(label = 'default') {
98
99
  if (null != this._timers[label]) return;
@@ -103,7 +104,7 @@ export const __webpack_modules__ = {
103
104
  if (null != startTime) {
104
105
  const endTime = RealDate.now();
105
106
  const time = endTime - startTime.getTime();
106
- this._log('time', (0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(`${label}: ${(0, _utils__WEBPACK_IMPORTED_MODULE_3__.kV)(time)}`));
107
+ this._log('time', (0, external_node_util_.format)(`${label}: ${(0, utils.kV)(time)}`));
107
108
  delete this._timers[label];
108
109
  }
109
110
  }
@@ -112,11 +113,11 @@ export const __webpack_modules__ = {
112
113
  if (null != startTime) {
113
114
  const endTime = new RealDate();
114
115
  const time = endTime.getTime() - startTime.getTime();
115
- this._log('time', (0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(`${label}: ${(0, _utils__WEBPACK_IMPORTED_MODULE_3__.kV)(time)}`, ...data));
116
+ this._log('time', (0, external_node_util_.format)(`${label}: ${(0, utils.kV)(time)}`, ...data));
116
117
  }
117
118
  }
118
119
  warn(firstArg, ...args) {
119
- this._log('warn', (0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(firstArg, ...args), 'stderr');
120
+ this._log('warn', (0, external_node_util_.format)(firstArg, ...args), 'stderr');
120
121
  }
121
122
  getBuffer() {}
122
123
  }
@@ -139,5 +140,8 @@ export const __webpack_modules__ = {
139
140
  __webpack_require__("node:fs/promises");
140
141
  __webpack_require__("node:module");
141
142
  __webpack_require__("pathe");
143
+ },
144
+ "node:fs/promises": function(module) {
145
+ module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__;
142
146
  }
143
147
  };
package/dist/0~603.js ADDED
@@ -0,0 +1,47 @@
1
+ import 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ export const __webpack_id__ = "603";
4
+ export const __webpack_ids__ = [
5
+ "603"
6
+ ];
7
+ export const __webpack_modules__ = {
8
+ "./src/coverage/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9
+ __webpack_require__.d(__webpack_exports__, {
10
+ e: ()=>createCoverageProvider,
11
+ loadCoverageProvider: ()=>loadCoverageProvider
12
+ });
13
+ var node_module__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:module");
14
+ var node_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("node:url");
15
+ const CoverageProviderMap = {
16
+ istanbul: '@rstest/coverage-istanbul'
17
+ };
18
+ const loadCoverageProvider = async (options, root)=>{
19
+ const rootPath = (0, node_url__WEBPACK_IMPORTED_MODULE_1__.pathToFileURL)(root).toString();
20
+ const moduleName = CoverageProviderMap[options.provider || 'istanbul'];
21
+ if (!moduleName) throw new Error(`Unknown coverage provider: ${options.provider}`);
22
+ try {
23
+ const require = (0, node_module__WEBPACK_IMPORTED_MODULE_0__.createRequire)(rootPath);
24
+ const modulePath = require.resolve(moduleName, {
25
+ paths: [
26
+ rootPath
27
+ ]
28
+ });
29
+ const { pluginCoverage, CoverageProvider } = await import((0, node_url__WEBPACK_IMPORTED_MODULE_1__.pathToFileURL)(modulePath).toString());
30
+ return {
31
+ pluginCoverage,
32
+ CoverageProvider
33
+ };
34
+ } catch (error) {
35
+ throw new Error(`Failed to load coverage provider module: ${moduleName} in ${root}. Make sure it is installed.\nOriginal error: ${error.message}`);
36
+ }
37
+ };
38
+ async function createCoverageProvider(options, root) {
39
+ if (!options.enabled) return null;
40
+ if (!options.provider || CoverageProviderMap[options.provider]) {
41
+ const { CoverageProvider } = await loadCoverageProvider(options, root);
42
+ return new CoverageProvider(options);
43
+ }
44
+ throw new Error(`Unknown coverage provider: ${options.provider}`);
45
+ }
46
+ }
47
+ };
@@ -1,4 +1,4 @@
1
- /*! For license information please see 655.js.LICENSE.txt */
1
+ /*! For license information please see 0~655.js.LICENSE.txt */
2
2
  import 'module';
3
3
  /*#__PURE__*/ import.meta.url;
4
4
  export const __webpack_id__ = "655";
@@ -1541,7 +1541,7 @@ export const __webpack_modules__ = {
1541
1541
  const string = `${options.stylize(helpers_truncate(array[i], options.truncate), 'number')}${i === array.length - 1 ? '' : ', '}`;
1542
1542
  options.truncate -= string.length;
1543
1543
  if (array[i] !== array.length && options.truncate <= 3) {
1544
- output += `${truncator}(${array.length - array[i] + 1})`;
1544
+ output += `…(${array.length - array[i] + 1})`;
1545
1545
  break;
1546
1546
  }
1547
1547
  output += string;
@@ -1598,7 +1598,7 @@ export const __webpack_modules__ = {
1598
1598
  }
1599
1599
  function inspectBigInt(number, options) {
1600
1600
  let nums = helpers_truncate(number.toString(), options.truncate - 1);
1601
- if (nums !== truncator) nums += 'n';
1601
+ if ("…" !== nums) nums += 'n';
1602
1602
  return options.stylize(nums, 'bigint');
1603
1603
  }
1604
1604
  function inspectRegExp(value, options) {
@@ -1754,7 +1754,7 @@ export const __webpack_modules__ = {
1754
1754
  options.truncate -= propertyContents.length;
1755
1755
  const truncate = options.truncate;
1756
1756
  let children = inspectNodeCollection(element.children, options);
1757
- if (children && children.length > truncate) children = `${truncator}(${element.children.length})`;
1757
+ if (children && children.length > truncate) children = `…(${element.children.length})`;
1758
1758
  return `${head}${propertyContents}${headClose}${children}${tail}`;
1759
1759
  }
1760
1760
  const symbolsSupported = 'function' == typeof Symbol && 'function' == typeof Symbol.for;
@@ -7301,7 +7301,7 @@ ${printReceived(actual)}`
7301
7301
  return line + 1;
7302
7302
  }
7303
7303
  async function saveInlineSnapshots(environment, snapshots) {
7304
- const MagicString = (await __webpack_require__.e("755").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.mjs"))).default;
7304
+ const MagicString = (await __webpack_require__.e("873").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/magic-string@0.30.19/node_modules/magic-string/dist/magic-string.es.mjs"))).default;
7305
7305
  const files = new Set(snapshots.map((i)=>i.file));
7306
7306
  await Promise.all(Array.from(files).map(async (file)=>{
7307
7307
  const snaps = snapshots.filter((i)=>i.file === file);
@@ -1,8 +1,10 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
- export const __webpack_id__ = "263";
3
+ import { isCI } from "std-env";
4
+ import { stripVTControlCharacters } from "node:util";
5
+ export const __webpack_id__ = "669";
4
6
  export const __webpack_ids__ = [
5
- "263"
7
+ "669"
6
8
  ];
7
9
  export const __webpack_modules__ = {
8
10
  "./src/core/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
@@ -12,11 +14,9 @@ export const __webpack_modules__ = {
12
14
  var external_node_fs_ = __webpack_require__("node:fs");
13
15
  var manager = __webpack_require__("../../node_modules/.pnpm/@vitest+snapshot@3.2.4/node_modules/@vitest/snapshot/dist/manager.js");
14
16
  var external_pathe_ = __webpack_require__("pathe");
15
- var external_std_env_ = __webpack_require__("std-env");
16
17
  var src_config = __webpack_require__("./src/config.ts");
17
18
  var stack_trace_parser_esm = __webpack_require__("../../node_modules/.pnpm/stacktrace-parser@0.1.11/node_modules/stacktrace-parser/dist/stack-trace-parser.esm.js");
18
19
  var utils = __webpack_require__("./src/utils/index.ts");
19
- var external_node_util_ = __webpack_require__("node:util");
20
20
  const DEFAULT_RENDER_INTERVAL_MS = 1000;
21
21
  const ESC = '\x1B[';
22
22
  const CLEAR_LINE = `${ESC}K`;
@@ -129,7 +129,7 @@ export const __webpack_modules__ = {
129
129
  function getRenderedRowCount(rows, columns) {
130
130
  let count = 0;
131
131
  for (const row of rows){
132
- const text = (0, external_node_util_.stripVTControlCharacters)(row);
132
+ const text = stripVTControlCharacters(row);
133
133
  count += Math.max(1, Math.ceil(text.length / columns));
134
134
  }
135
135
  return count;
@@ -192,7 +192,7 @@ export const __webpack_modules__ = {
192
192
  if (snapshots.updated) summary.push(utils.yW.bold(utils.yW.green(`${snapshots.updated} updated `)));
193
193
  if (snapshots.filesRemoved) if (snapshots.didUpdate) summary.push(utils.yW.bold(utils.yW.green(`${snapshots.filesRemoved} files removed `)));
194
194
  else summary.push(utils.yW.bold(utils.yW.yellow(`${snapshots.filesRemoved} files obsolete `)));
195
- const POINTER = "\u279C";
195
+ const POINTER = '➜';
196
196
  if (snapshots.filesRemovedList?.length) {
197
197
  const [head, ...tail] = snapshots.filesRemovedList;
198
198
  summary.push(`${utils.yW.gray(POINTER)} ${(0, utils.XJ)(rootDir, head)}`);
@@ -239,8 +239,8 @@ export const __webpack_modules__ = {
239
239
  }
240
240
  };
241
241
  const statusStr = {
242
- fail: "\u2717",
243
- pass: "\u2713",
242
+ fail: '✗',
243
+ pass: '✓',
244
244
  todo: '-',
245
245
  skip: '-'
246
246
  };
@@ -276,7 +276,7 @@ export const __webpack_modules__ = {
276
276
  this.rootPath = rootPath;
277
277
  this.config = config;
278
278
  this.options = options;
279
- if (!external_std_env_.isCI) this.statusRenderer = new StatusRenderer(rootPath);
279
+ if (!isCI) this.statusRenderer = new StatusRenderer(rootPath);
280
280
  }
281
281
  onTestFileStart(test) {
282
282
  this.statusRenderer?.addRunningModule(test.testPath);
@@ -389,7 +389,7 @@ export const __webpack_modules__ = {
389
389
  return s.replace(/%/g, '%25').replace(/\r/g, '%0D').replace(/\n/g, '%0A').replace(/:/g, '%3A').replace(/,/g, '%2C');
390
390
  }
391
391
  var promises_ = __webpack_require__("node:fs/promises");
392
- var strip_ansi = __webpack_require__("../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js");
392
+ var strip_ansi = __webpack_require__("../../node_modules/.pnpm/strip-ansi@7.1.2/node_modules/strip-ansi/index.js");
393
393
  var utils_error = __webpack_require__("./src/utils/error.ts");
394
394
  class JUnitReporter {
395
395
  rootPath;
@@ -551,11 +551,11 @@ export const __webpack_modules__ = {
551
551
  config: rstestConfig
552
552
  }) : [];
553
553
  const snapshotManager = new manager.CW({
554
- updateSnapshot: rstestConfig.update ? 'all' : external_std_env_.isCI ? 'none' : 'new'
554
+ updateSnapshot: rstestConfig.update ? 'all' : isCI ? 'none' : 'new'
555
555
  });
556
556
  this.reporters = reporters;
557
557
  this.snapshotManager = snapshotManager;
558
- this.version = "0.3.4";
558
+ this.version = "0.4.0";
559
559
  this.rootPath = rootPath;
560
560
  this.originalConfig = userConfig;
561
561
  this.normalizedConfig = rstestConfig;
@@ -563,6 +563,7 @@ export const __webpack_modules__ = {
563
563
  const config = (0, src_config.wX)(project.config);
564
564
  config.isolate = rstestConfig.isolate;
565
565
  config.source ??= {};
566
+ config.coverage = rstestConfig.coverage;
566
567
  if (!config.source.tsconfigPath) {
567
568
  const tsconfigPath = (0, external_pathe_.join)(config.root, utils.WB);
568
569
  if ((0, external_node_fs_.existsSync)(tsconfigPath)) config.source.tsconfigPath = tsconfigPath;
@@ -636,14 +637,14 @@ export const __webpack_modules__ = {
636
637
  }, config);
637
638
  const runTests = async ()=>{
638
639
  const { runTests } = await Promise.all([
639
- __webpack_require__.e("985"),
640
+ __webpack_require__.e("938"),
640
641
  __webpack_require__.e("33")
641
642
  ]).then(__webpack_require__.bind(__webpack_require__, "./src/core/runTests.ts"));
642
643
  await runTests(context);
643
644
  };
644
645
  const listTests = async (options)=>{
645
646
  const { listTests } = await Promise.all([
646
- __webpack_require__.e("985"),
647
+ __webpack_require__.e("938"),
647
648
  __webpack_require__.e("971")
648
649
  ]).then(__webpack_require__.bind(__webpack_require__, "./src/core/listTests.ts"));
649
650
  await listTests(context, options);
@@ -662,7 +663,7 @@ export const __webpack_modules__ = {
662
663
  printError: ()=>printError
663
664
  });
664
665
  var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:fs");
665
- var _jridgewell_trace_mapping__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.30/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs");
666
+ var _jridgewell_trace_mapping__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs");
666
667
  var stacktrace_parser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/stacktrace-parser@0.1.11/node_modules/stacktrace-parser/dist/stack-trace-parser.esm.js");
667
668
  var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/index.ts");
668
669
  async function printError(error, getSourcemap, rootPath) {
package/dist/0~691.js ADDED
@@ -0,0 +1,38 @@
1
+ import 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ export const __webpack_id__ = "691";
4
+ export const __webpack_ids__ = [
5
+ "691"
6
+ ];
7
+ export const __webpack_modules__ = {
8
+ "./src/coverage/checkThresholds.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9
+ __webpack_require__.d(__webpack_exports__, {
10
+ checkThresholds: ()=>checkThresholds
11
+ });
12
+ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/utils/index.ts");
13
+ function checkThresholds(coverageMap, thresholds) {
14
+ if (!thresholds) return {
15
+ success: true,
16
+ message: ''
17
+ };
18
+ const summary = coverageMap.getCoverageSummary();
19
+ const failedThresholds = [];
20
+ const check = (name, type, actual, expected)=>{
21
+ if (void 0 !== expected) {
22
+ if (expected < 0) {
23
+ const uncovered = actual.total - actual.covered;
24
+ if (uncovered > -expected) failedThresholds.push(`${_utils__WEBPACK_IMPORTED_MODULE_0__.yW.red('Error')}: Uncovered ${name} ${_utils__WEBPACK_IMPORTED_MODULE_0__.yW.red(`${uncovered}`)} exceeds maximum ${type} threshold allowed ${_utils__WEBPACK_IMPORTED_MODULE_0__.yW.yellow(`${-expected}`)}`);
25
+ } else if (actual.pct < expected) failedThresholds.push(`${_utils__WEBPACK_IMPORTED_MODULE_0__.yW.red('Error')}: Coverage for ${name} ${_utils__WEBPACK_IMPORTED_MODULE_0__.yW.red(`${actual.pct}%`)} does not meet ${type} threshold ${_utils__WEBPACK_IMPORTED_MODULE_0__.yW.yellow(`${expected}%`)}`);
26
+ }
27
+ };
28
+ check('statements', 'global', summary.statements, thresholds.statements);
29
+ check('functions', 'global', summary.functions, thresholds.functions);
30
+ check('branches', 'global', summary.branches, thresholds.branches);
31
+ check('lines', 'global', summary.lines, thresholds.lines);
32
+ return {
33
+ success: 0 === failedThresholds.length,
34
+ message: failedThresholds.join('\n')
35
+ };
36
+ }
37
+ }
38
+ };
package/dist/0~836.js ADDED
@@ -0,0 +1,26 @@
1
+ import 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ export const __webpack_id__ = "836";
4
+ export const __webpack_ids__ = [
5
+ "836"
6
+ ];
7
+ export const __webpack_modules__ = {
8
+ "./src/coverage/plugin.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9
+ __webpack_require__.d(__webpack_exports__, {
10
+ pluginCoverageCore: ()=>pluginCoverageCore
11
+ });
12
+ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:fs");
13
+ const pluginCoverageCore = (coverageOptions)=>({
14
+ name: 'rstest:coverage-core',
15
+ setup: (api)=>{
16
+ api.onBeforeDevCompile(({ isFirstCompile })=>{
17
+ if (isFirstCompile && coverageOptions.clean) {
18
+ if (node_fs__WEBPACK_IMPORTED_MODULE_0__["default"].existsSync(coverageOptions.reportsDirectory)) node_fs__WEBPACK_IMPORTED_MODULE_0__["default"].rmSync(coverageOptions.reportsDirectory, {
19
+ recursive: true
20
+ });
21
+ }
22
+ });
23
+ }
24
+ });
25
+ }
26
+ };