monocart-coverage-reports 2.11.2 → 2.11.4

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/README.md CHANGED
@@ -966,6 +966,14 @@ When `logging` is `debug`, the raw report data will be preserved in `[outputDir]
966
966
 
967
967
  ![](./assets/debug-sourcemap.png)
968
968
 
969
+ - Generate additional source and sourcemap files to cache or raw dir
970
+ ```js
971
+ const coverageOptions = {
972
+ logging: 'debug',
973
+ sourceMap: true
974
+ };
975
+ ```
976
+
969
977
  - Show time logs with env `MCR_LOG_TIME`
970
978
  ```js
971
979
  process.env.MCR_LOG_TIME = true
package/README.zh-Hans.md CHANGED
@@ -969,6 +969,14 @@ const coverageOptions = {
969
969
 
970
970
  ![](./assets/debug-sourcemap.png)
971
971
 
972
+ - 生成额外的source和sourcemap文件到cache或raw文件夹
973
+ ```js
974
+ const coverageOptions = {
975
+ logging: 'debug',
976
+ sourceMap: true
977
+ };
978
+ ```
979
+
972
980
  - 使用环境变量`MCR_LOG_TIME`显示时间日志
973
981
  ```js
974
982
  process.env.MCR_LOG_TIME = true
package/lib/cli.js CHANGED
@@ -118,10 +118,21 @@ const initNodeV8CoverageDir = (coverageOptions) => {
118
118
  return nodeV8CoverageDir;
119
119
  };
120
120
 
121
+ const mergeCoverage = async (cliOptions) => {
122
+ const coverageReport = MCR(cliOptions);
123
+ await coverageReport.loadConfig(cliOptions.config);
124
+ coverageReport.cleanCache();
125
+ await coverageReport.generate();
126
+ };
127
+
121
128
  const executeCommand = async (command, cliOptions) => {
122
129
 
123
130
  Util.logInfo(`Execute: ${EC.cyan(command)}`);
124
131
 
132
+ if (command === 'merge') {
133
+ return mergeCoverage(cliOptions);
134
+ }
135
+
125
136
  // before load config
126
137
  await initNodeOptions(cliOptions);
127
138
 
@@ -7,7 +7,7 @@ const { pathToFileURL, fileURLToPath } = require('url');
7
7
  const { normalizeSourcePath, getSourcePathReplacer } = require('../utils/source-path.js');
8
8
 
9
9
  // const EC = require('eight-colors');
10
- const { minimatch, convertSourceMap } = require('../packages/monocart-coverage-vendor.js');
10
+ const { convertSourceMap } = require('../packages/monocart-coverage-vendor.js');
11
11
 
12
12
  // ========================================================================================================
13
13
 
@@ -37,7 +37,7 @@ const resolveAllFilter = (input) => {
37
37
  input = obj;
38
38
  } else {
39
39
  return (filePath) => {
40
- return minimatch(filePath, input);
40
+ return Util.betterMinimatch(filePath, input);
41
41
  };
42
42
  }
43
43
  }
@@ -47,7 +47,7 @@ const resolveAllFilter = (input) => {
47
47
  const patterns = Object.keys(input);
48
48
  return (filePath) => {
49
49
  for (const pattern of patterns) {
50
- if (minimatch(filePath, pattern)) {
50
+ if (Util.betterMinimatch(filePath, pattern)) {
51
51
  return input[pattern];
52
52
  }
53
53
  }