@rstest/core 0.4.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md CHANGED
@@ -578,6 +578,32 @@ Licensed under MIT license.
578
578
  > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
579
579
  > SOFTWARE.
580
580
 
581
+ ### chai
582
+
583
+ Licensed under MIT license in the repository at https://github.com/chaijs/chai.
584
+
585
+ > MIT License
586
+ >
587
+ > Copyright (c) 2017 Chai.js Assertion Library
588
+ >
589
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
590
+ > of this software and associated documentation files (the "Software"), to deal
591
+ > in the Software without restriction, including without limitation the rights
592
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
593
+ > copies of the Software, and to permit persons to whom the Software is
594
+ > furnished to do so, subject to the following conditions:
595
+ >
596
+ > The above copyright notice and this permission notice shall be included in all
597
+ > copies or substantial portions of the Software.
598
+ >
599
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
600
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
601
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
602
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
603
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
604
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
605
+ > SOFTWARE.
606
+
581
607
  ### chalk
582
608
 
583
609
  Licensed under MIT license.
@@ -735,6 +761,81 @@ Licensed under MIT license in the repository at https://github.com/rich-harris/m
735
761
  >
736
762
  > 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.
737
763
 
764
+ ### pathe
765
+
766
+ Licensed under MIT license.
767
+
768
+ > MIT License
769
+ >
770
+ > Copyright (c) Pooya Parsa <pooya@pi0.io> - Daniel Roe <daniel@roe.dev>
771
+ >
772
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
773
+ > of this software and associated documentation files (the "Software"), to deal
774
+ > in the Software without restriction, including without limitation the rights
775
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
776
+ > copies of the Software, and to permit persons to whom the Software is
777
+ > furnished to do so, subject to the following conditions:
778
+ >
779
+ > The above copyright notice and this permission notice shall be included in all
780
+ > copies or substantial portions of the Software.
781
+ >
782
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
783
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
784
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
785
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
786
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
787
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
788
+ > SOFTWARE.
789
+ >
790
+ > ---
791
+ >
792
+ > Copyright Joyent, Inc. and other Node contributors.
793
+ >
794
+ > Permission is hereby granted, free of charge, to any person obtaining a
795
+ > copy of this software and associated documentation files (the
796
+ > "Software"), to deal in the Software without restriction, including
797
+ > without limitation the rights to use, copy, modify, merge, publish,
798
+ > distribute, sublicense, and/or sell copies of the Software, and to permit
799
+ > persons to whom the Software is furnished to do so, subject to the
800
+ > following conditions:
801
+ >
802
+ > The above copyright notice and this permission notice shall be included
803
+ > in all copies or substantial portions of the Software.
804
+ >
805
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
806
+ > OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
807
+ > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
808
+ > NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
809
+ > DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
810
+ > OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
811
+ > USE OR OTHER DEALINGS IN THE SOFTWARE.
812
+ >
813
+ > ---
814
+ >
815
+ > Bundled zeptomatch (https://github.com/fabiospampinato/zeptomatch)
816
+ >
817
+ > The MIT License (MIT)
818
+ >
819
+ > Copyright (c) 2023-present Fabio Spampinato
820
+ >
821
+ > Permission is hereby granted, free of charge, to any person obtaining a
822
+ > copy of this software and associated documentation files (the "Software"),
823
+ > to deal in the Software without restriction, including without limitation
824
+ > the rights to use, copy, modify, merge, publish, distribute, sublicense,
825
+ > and/or sell copies of the Software, and to permit persons to whom the
826
+ > Software is furnished to do so, subject to the following conditions:
827
+ >
828
+ > The above copyright notice and this permission notice shall be included in
829
+ > all copies or substantial portions of the Software.
830
+ >
831
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
832
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
833
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
834
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
835
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
836
+ > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
837
+ > DEALINGS IN THE SOFTWARE.
838
+
738
839
  ### picocolors
739
840
 
740
841
  Licensed under ISC license.
@@ -916,6 +1017,32 @@ Licensed under MIT license in the repository at git+https://github.com/errwischt
916
1017
  > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
917
1018
  > SOFTWARE.
918
1019
 
1020
+ ### std-env
1021
+
1022
+ Licensed under MIT license.
1023
+
1024
+ > MIT License
1025
+ >
1026
+ > Copyright (c) Pooya Parsa <pooya@pi0.io>
1027
+ >
1028
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
1029
+ > of this software and associated documentation files (the "Software"), to deal
1030
+ > in the Software without restriction, including without limitation the rights
1031
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1032
+ > copies of the Software, and to permit persons to whom the Software is
1033
+ > furnished to do so, subject to the following conditions:
1034
+ >
1035
+ > The above copyright notice and this permission notice shall be included in all
1036
+ > copies or substantial portions of the Software.
1037
+ >
1038
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1039
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1040
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1041
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1042
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1043
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1044
+ > SOFTWARE.
1045
+
919
1046
  ### strip-ansi
920
1047
 
921
1048
  Licensed under MIT license.
package/dist/0~204.js ADDED
@@ -0,0 +1,83 @@
1
+ import 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ export const __webpack_id__ = "204";
4
+ export const __webpack_ids__ = [
5
+ "204"
6
+ ];
7
+ export const __webpack_modules__ = {
8
+ "./src/coverage/generate.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9
+ __webpack_require__.d(__webpack_exports__, {
10
+ generateCoverage: ()=>generateCoverage
11
+ });
12
+ var pathe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs");
13
+ var tinyglobby__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/tinyglobby@0.2.15/node_modules/tinyglobby/dist/index.mjs");
14
+ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/utils/index.ts");
15
+ const getIncludedFiles = async (coverage, rootPath)=>{
16
+ const ignoredPatterns = coverage.exclude?.filter((item)=>(0, tinyglobby__WEBPACK_IMPORTED_MODULE_1__.ey)(item) || item.startsWith(rootPath) || item.startsWith('./'));
17
+ const allFiles = await (0, tinyglobby__WEBPACK_IMPORTED_MODULE_1__.glob)(coverage.include, {
18
+ cwd: rootPath,
19
+ absolute: true,
20
+ onlyFiles: true,
21
+ ignore: ignoredPatterns,
22
+ dot: true,
23
+ expandDirectories: false
24
+ });
25
+ if (ignoredPatterns?.length !== coverage.exclude?.length) {
26
+ const excludes = coverage.exclude.filter((item)=>!(0, tinyglobby__WEBPACK_IMPORTED_MODULE_1__.ey)(item) && !item.startsWith(rootPath) && !item.startsWith('./'));
27
+ return allFiles.filter((file)=>!excludes.some((exclude)=>file.includes(exclude)));
28
+ }
29
+ return allFiles;
30
+ };
31
+ async function generateCoverage(context, results, coverageProvider) {
32
+ const { rootPath, normalizedConfig: { coverage }, projects } = context;
33
+ try {
34
+ const finalCoverageMap = coverageProvider.createCoverageMap();
35
+ for (const result of results)if (result.coverage) finalCoverageMap.merge(result.coverage);
36
+ if (coverage.include?.length) {
37
+ const coveredFiles = finalCoverageMap.files();
38
+ let isTimeout = false;
39
+ const timeoutId = setTimeout(()=>{
40
+ isTimeout = true;
41
+ _utils__WEBPACK_IMPORTED_MODULE_0__.vF.info('Generating coverage for untested files...');
42
+ }, 1000);
43
+ const allFiles = (await Promise.all(projects.map(async (p)=>{
44
+ const includedFiles = await getIncludedFiles(coverage, p.rootPath);
45
+ const uncoveredFiles = includedFiles.filter((file)=>!coveredFiles.includes((0, pathe__WEBPACK_IMPORTED_MODULE_2__.n)(file)));
46
+ if (uncoveredFiles.length) await generateCoverageForUntestedFiles(p.environmentName, uncoveredFiles, finalCoverageMap, coverageProvider);
47
+ return includedFiles;
48
+ }))).flat();
49
+ clearTimeout(timeoutId);
50
+ if (isTimeout) _utils__WEBPACK_IMPORTED_MODULE_0__.vF.info('Coverage for untested files generated.');
51
+ finalCoverageMap.filter((file)=>allFiles.includes((0, pathe__WEBPACK_IMPORTED_MODULE_2__.n)(file)));
52
+ }
53
+ await coverageProvider.generateReports(finalCoverageMap, coverage);
54
+ if (coverage.thresholds) {
55
+ const { checkThresholds } = await __webpack_require__.e("691").then(__webpack_require__.bind(__webpack_require__, "./src/coverage/checkThresholds.ts"));
56
+ const thresholdResult = checkThresholds({
57
+ coverageMap: finalCoverageMap,
58
+ coverageProvider,
59
+ rootPath,
60
+ thresholds: coverage.thresholds
61
+ });
62
+ if (!thresholdResult.success) {
63
+ _utils__WEBPACK_IMPORTED_MODULE_0__.vF.log('');
64
+ _utils__WEBPACK_IMPORTED_MODULE_0__.vF.log(thresholdResult.message);
65
+ process.exitCode = 1;
66
+ }
67
+ }
68
+ } catch (error) {
69
+ _utils__WEBPACK_IMPORTED_MODULE_0__.vF.error('Failed to generate coverage reports:', error);
70
+ }
71
+ }
72
+ async function generateCoverageForUntestedFiles(environmentName, uncoveredFiles, coverageMap, coverageProvider) {
73
+ if (!coverageProvider.generateCoverageForUntestedFiles) return void _utils__WEBPACK_IMPORTED_MODULE_0__.vF.warn('Current coverage provider does not support generating coverage for untested files.');
74
+ const coverages = await coverageProvider.generateCoverageForUntestedFiles({
75
+ environmentName,
76
+ files: uncoveredFiles
77
+ });
78
+ coverages.forEach((coverageData)=>{
79
+ coverageMap.addFileCoverage(coverageData);
80
+ });
81
+ }
82
+ }
83
+ };
package/dist/0~223.js CHANGED
@@ -9,13 +9,13 @@ export const __webpack_modules__ = {
9
9
  __webpack_require__.d(__webpack_exports__, {
10
10
  initCli: ()=>initCli
11
11
  });
12
- var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("fs");
13
- var pathe__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("pathe");
12
+ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:fs");
13
+ var pathe__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs");
14
14
  var tinyglobby__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/tinyglobby@0.2.15/node_modules/tinyglobby/dist/index.mjs");
15
- var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./src/config.ts");
16
- var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/index.ts");
15
+ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/config.ts");
16
+ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./src/utils/index.ts");
17
17
  async function resolveConfig(options) {
18
- const { content: config, filePath: configFilePath } = await (0, _config__WEBPACK_IMPORTED_MODULE_2__.Z9)({
18
+ const { content: config, filePath: configFilePath } = await (0, _config__WEBPACK_IMPORTED_MODULE_1__.Z9)({
19
19
  cwd: options.root,
20
20
  path: options.config,
21
21
  configLoader: options.configLoader
@@ -42,13 +42,13 @@ export const __webpack_modules__ = {
42
42
  'testEnvironment'
43
43
  ];
44
44
  for (const key of keys)if (void 0 !== options[key]) config[key] = options[key];
45
- if (options.reporter) config.reporters = (0, _utils__WEBPACK_IMPORTED_MODULE_3__.bg)(options.reporter);
45
+ if (options.reporter) config.reporters = (0, _utils__WEBPACK_IMPORTED_MODULE_2__.bg)(options.reporter);
46
46
  if (void 0 !== options.coverage) {
47
47
  config.coverage ??= {};
48
48
  config.coverage.enabled = options.coverage;
49
49
  }
50
- if (options.exclude) config.exclude = (0, _utils__WEBPACK_IMPORTED_MODULE_3__.bg)(options.exclude);
51
- if (options.include) config.include = (0, _utils__WEBPACK_IMPORTED_MODULE_3__.bg)(options.include);
50
+ if (options.exclude) config.exclude = (0, _utils__WEBPACK_IMPORTED_MODULE_2__.bg)(options.exclude);
51
+ if (options.include) config.include = (0, _utils__WEBPACK_IMPORTED_MODULE_2__.bg)(options.include);
52
52
  return {
53
53
  config,
54
54
  configFilePath: configFilePath ?? void 0
@@ -57,9 +57,9 @@ export const __webpack_modules__ = {
57
57
  async function resolveProjects({ config, root, options }) {
58
58
  if (!config.projects) return [];
59
59
  const getDefaultProjectName = (dir)=>{
60
- const pkgJsonPath = (0, pathe__WEBPACK_IMPORTED_MODULE_1__.resolve)(dir, 'package.json');
60
+ const pkgJsonPath = (0, pathe__WEBPACK_IMPORTED_MODULE_3__.r)(dir, 'package.json');
61
61
  const name = (0, node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync)(pkgJsonPath) ? JSON.parse((0, node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync)(pkgJsonPath, 'utf-8')).name : '';
62
- if ('string' != typeof name || !name) return (0, pathe__WEBPACK_IMPORTED_MODULE_1__.basename)(dir);
62
+ if ('string' != typeof name || !name) return (0, pathe__WEBPACK_IMPORTED_MODULE_3__.c)(dir);
63
63
  return name;
64
64
  };
65
65
  const globProjects = async (patterns)=>{
@@ -76,10 +76,9 @@ export const __webpack_modules__ = {
76
76
  };
77
77
  return (0, tinyglobby__WEBPACK_IMPORTED_MODULE_4__.glob)(patterns, globOptions);
78
78
  };
79
- const formatRootStr = (rootStr)=>rootStr.replace('<rootDir>', root);
80
79
  const { projectPaths, projectPatterns, projectConfigs } = (config.projects || []).reduce((total, p)=>{
81
80
  if ('object' == typeof p) {
82
- const projectRoot = p.root ? formatRootStr(p.root) : root;
81
+ const projectRoot = p.root ? (0, _utils__WEBPACK_IMPORTED_MODULE_2__.tS)(p.root, root) : root;
83
82
  total.projectConfigs.push({
84
83
  config: {
85
84
  root: projectRoot,
@@ -90,10 +89,10 @@ export const __webpack_modules__ = {
90
89
  });
91
90
  return total;
92
91
  }
93
- const projectStr = formatRootStr(p);
92
+ const projectStr = (0, _utils__WEBPACK_IMPORTED_MODULE_2__.tS)(p, root);
94
93
  if ((0, tinyglobby__WEBPACK_IMPORTED_MODULE_4__.ey)(projectStr)) total.projectPatterns.push(projectStr);
95
94
  else {
96
- const absolutePath = (0, _utils__WEBPACK_IMPORTED_MODULE_3__.FI)(root, projectStr);
95
+ const absolutePath = (0, _utils__WEBPACK_IMPORTED_MODULE_2__.FI)(root, projectStr);
97
96
  if (!(0, node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync)(absolutePath)) throw `Can't resolve project "${p}", please make sure "${p}" is a existing file or a directory.`;
98
97
  total.projectPaths.push(absolutePath);
99
98
  }
@@ -109,19 +108,19 @@ export const __webpack_modules__ = {
109
108
  const { config, configFilePath } = await resolveConfig({
110
109
  ...options,
111
110
  config: isDirectory ? void 0 : project,
112
- root: isDirectory ? project : (0, pathe__WEBPACK_IMPORTED_MODULE_1__.dirname)(project)
111
+ root: isDirectory ? project : (0, pathe__WEBPACK_IMPORTED_MODULE_3__.d)(project)
113
112
  });
114
113
  config.name ??= getDefaultProjectName(project);
115
- if (config.projects?.length && config.root !== root) _utils__WEBPACK_IMPORTED_MODULE_3__.vF.warn(`Projects cannot have nested projects, the "projects" field in project "${config.name}" will be ignored.`);
114
+ if (config.projects?.length && config.root !== root) _utils__WEBPACK_IMPORTED_MODULE_2__.vF.warn(`Projects cannot have nested projects, the "projects" field in project "${config.name}" will be ignored.`);
116
115
  return {
117
116
  config,
118
117
  configFilePath
119
118
  };
120
- })).then((projects)=>(0, _utils__WEBPACK_IMPORTED_MODULE_3__.zz)(projects.concat(projectConfigs), options));
119
+ })).then((projects)=>(0, _utils__WEBPACK_IMPORTED_MODULE_2__.zz)(projects.concat(projectConfigs), options));
121
120
  if (!projects.length) {
122
121
  let errorMsg = `No projects found, please make sure you have at least one valid project.
123
- ${_utils__WEBPACK_IMPORTED_MODULE_3__.yW.gray('projects:')} ${JSON.stringify(config.projects, null, 2)}`;
124
- if (options.project) errorMsg += `\n${_utils__WEBPACK_IMPORTED_MODULE_3__.yW.gray('projectName filter:')} ${JSON.stringify(options.project, null, 2)}`;
122
+ ${_utils__WEBPACK_IMPORTED_MODULE_2__.yW.gray('projects:')} ${JSON.stringify(config.projects, null, 2)}`;
123
+ if (options.project) errorMsg += `\n${_utils__WEBPACK_IMPORTED_MODULE_2__.yW.gray('projectName filter:')} ${JSON.stringify(options.project, null, 2)}`;
125
124
  throw errorMsg;
126
125
  }
127
126
  const names = new Set();
@@ -139,7 +138,7 @@ ${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')
139
138
  }
140
139
  async function initCli(options) {
141
140
  const cwd = process.cwd();
142
- const root = options.root ? (0, _utils__WEBPACK_IMPORTED_MODULE_3__.FI)(cwd, options.root) : cwd;
141
+ const root = options.root ? (0, _utils__WEBPACK_IMPORTED_MODULE_2__.FI)(cwd, options.root) : cwd;
143
142
  const { config, configFilePath } = await resolveConfig({
144
143
  ...options,
145
144
  root
package/dist/0~33.js CHANGED
@@ -9,7 +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
+ var src_coverage = __webpack_require__("./src/coverage/index.ts");
13
13
  var src_pool = __webpack_require__("./src/pool/index.ts");
14
14
  var utils = __webpack_require__("./src/utils/index.ts");
15
15
  const isCliShortcutsEnabled = ()=>(0, utils.Un)('stdin');
@@ -155,13 +155,13 @@ export const __webpack_modules__ = {
155
155
  }
156
156
  var rsbuild = __webpack_require__("./src/core/rsbuild.ts");
157
157
  async function runTests(context) {
158
- const { rootPath, reporters, projects, snapshotManager, command } = context;
158
+ const { rootPath, reporters, projects, snapshotManager, command, normalizedConfig: { coverage } } = context;
159
159
  const entriesCache = new Map();
160
160
  const globTestSourceEntries = async (name)=>{
161
161
  const { include, exclude, includeSource, root } = projects.find((p)=>p.environmentName === name).normalizedConfig;
162
162
  const entries = await (0, utils.tG)({
163
163
  include,
164
- exclude,
164
+ exclude: exclude.patterns,
165
165
  includeSource,
166
166
  rootPath,
167
167
  projectRoot: root,
@@ -199,8 +199,8 @@ export const __webpack_modules__ = {
199
199
  context,
200
200
  recommendWorkerCount
201
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));
202
+ const coverageProvider = coverage.enabled ? await (0, src_coverage.e)(coverage, context.rootPath) : null;
203
+ if (coverageProvider) utils.vF.log(` ${utils.yW.gray('Coverage enabled with')} %s\n`, utils.yW.yellow(coverage.provider));
204
204
  const run = async ({ fileFilters, mode = 'all' } = {})=>{
205
205
  let testStart;
206
206
  const buildStart = Date.now();
@@ -261,11 +261,12 @@ export const __webpack_modules__ = {
261
261
  utils.vF.log(utils.yW.gray('project:'), p.name);
262
262
  }
263
263
  utils.vF.log(utils.yW.gray('include:'), p.normalizedConfig.include.join(utils.yW.gray(', ')));
264
- utils.vF.log(utils.yW.gray('exclude:'), p.normalizedConfig.exclude.join(utils.yW.gray(', ')));
264
+ utils.vF.log(utils.yW.gray('exclude:'), p.normalizedConfig.exclude.patterns.join(utils.yW.gray(', ')));
265
265
  });
266
266
  }
267
267
  }
268
- if (results.some((r)=>'fail' === r.status)) process.exitCode = 1;
268
+ const isFailure = results.some((r)=>'fail' === r.status);
269
+ if (isFailure) process.exitCode = 1;
269
270
  for (const reporter of reporters)await reporter.onTestRunEnd?.({
270
271
  results: context.reporterResults.results,
271
272
  testResults: context.reporterResults.testResults,
@@ -274,22 +275,9 @@ export const __webpack_modules__ = {
274
275
  getSourcemap: (name)=>sourceMaps[name] || null,
275
276
  filterRerunTestPaths: currentEntries.length ? currentEntries.map((e)=>e.testPath) : void 0
276
277
  });
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);
278
+ if (coverageProvider && (!isFailure || coverage.reportOnFailure)) {
279
+ const { generateCoverage } = await __webpack_require__.e("204").then(__webpack_require__.bind(__webpack_require__, "./src/coverage/generate.ts"));
280
+ await generateCoverage(context, results, coverageProvider);
293
281
  }
294
282
  };
295
283
  if ('watch' === command) {