monocart-coverage-reports 2.7.2 → 2.7.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
@@ -42,6 +42,7 @@
42
42
  - [CodeceptJS](#codeceptjs)
43
43
  - [WebdriverIO](#webdriverio)
44
44
  - [Storybook Test Runner](#storybook-test-runner)
45
+ - [TestCafe](#testcafe)
45
46
  - [Codecov](#codecov)
46
47
  - [Coveralls](#coveralls)
47
48
  - [Sonar Cloud](#sonar-cloud)
@@ -312,20 +313,26 @@ Options:
312
313
  --inline inline html for v8 report
313
314
  --assetsPath <path> assets path if not inline
314
315
  --lcov generate lcov.info file
316
+ --import <module> preload module at startup
317
+ --require <module> preload module at startup
315
318
  -h, --help display help for command
316
319
  ```
317
320
 
318
321
  - Loading config file by priority:
319
- - custom config file with `-c` or `--config`
322
+ - Custom config file with `-c` or `--config`
320
323
  - `mcr.config.js`
321
324
  - `mcr.config.cjs`
322
325
  - `mcr.config.mjs`
323
326
  - `mcr.config.json` - json format
327
+ - `mcr.config.ts` (requires preloading the ts execution module)
324
328
  - `.mcrrc.js`
325
329
  - `.mcrrc` - json format
326
- - `mcr.config.ts` (requires preloading the typescript module)
327
330
 
328
331
  - Working with `tsx`, see [mcr-tsx](https://github.com/cenfun/mcr-tsx)
332
+ ```sh
333
+ npx mcr --import tsx tsx ./src/example.ts
334
+ ```
335
+
329
336
  - Working with `ts-node`, see [mcr-ts-node](https://github.com/cenfun/mcr-ts-node)
330
337
 
331
338
  ## Compare Reports
@@ -823,6 +830,9 @@ const coverageOptions = {
823
830
  ### [Storybook Test Runner](https://github.com/storybookjs/test-runner)
824
831
  - [storybook-monocart-coverage](https://github.com/cenfun/storybook-monocart-coverage) - Storybook V8 Coverage Example
825
832
 
833
+ ### [TestCafe](https://github.com/DevExpress/testcafe)
834
+ - [testcafe-reporter-coverage](https://github.com/cenfun/testcafe-reporter-coverage) - A TestCafe custom reporter for coverage reports
835
+
826
836
  ### [Codecov](https://codecov.com/)
827
837
  [![codecov](https://codecov.io/gh/cenfun/monocart-coverage-reports/graph/badge.svg?token=H0LW7UKYU3)](https://codecov.io/gh/cenfun/monocart-coverage-reports)
828
838
  - Supports native `codecov` built-in report ([specification](https://docs.codecov.com/docs/codecov-custom-coverage-format))
package/lib/cli.js CHANGED
@@ -152,7 +152,7 @@ const executeCommand = async (command, cliOptions) => {
152
152
  };
153
153
 
154
154
  process.on('uncaughtException', function(err) {
155
- Util.logError(`ERROR: ${err.message || err}`);
155
+ Util.logError(`Process uncaughtException: ${err.message || err}`);
156
156
  });
157
157
 
158
158
  program
@@ -128,6 +128,17 @@ const saveSourceFile = async (filePath, data) => {
128
128
 
129
129
  };
130
130
 
131
+ const getInlineSourceMap = (content) => {
132
+ let smc;
133
+ try {
134
+ smc = convertSourceMap.fromSource(content);
135
+ } catch (e) {
136
+ // ignore "//# sourceMappingURL=" in a string
137
+ // console.log(e);
138
+ }
139
+ return smc;
140
+ };
141
+
131
142
  const collectSourceMaps = async (v8list, options) => {
132
143
 
133
144
  const smList = [];
@@ -166,7 +177,7 @@ const collectSourceMaps = async (v8list, options) => {
166
177
  // check sourceMap only for js
167
178
  if (type === 'js' && !sourceData.sourceMap) {
168
179
  // from inline sync
169
- const smc = convertSourceMap.fromSource(source);
180
+ const smc = getInlineSourceMap(source);
170
181
  if (smc) {
171
182
  sourceData.sourceMap = resolveSourceMap(smc.sourcemap, url);
172
183
  smList.push({
@@ -1405,7 +1405,7 @@ const convertV8List = (v8list, options) => {
1405
1405
  // console.log([item.id]);
1406
1406
 
1407
1407
  const {
1408
- type, source, sourcePath
1408
+ type, source, fake, sourcePath
1409
1409
  } = item;
1410
1410
 
1411
1411
  // for source file, type could be ts or vue as extname, but js = true
@@ -1454,6 +1454,7 @@ const convertV8List = (v8list, options) => {
1454
1454
  js,
1455
1455
  type,
1456
1456
  source,
1457
+ fake,
1457
1458
  sourcePath,
1458
1459
  sourceMap,
1459
1460
  locator,