monocart-coverage-reports 2.8.4 → 2.8.5

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
@@ -506,7 +506,7 @@ const coverageOptions = {
506
506
  sourceFilter: "**/src/**"
507
507
  };
508
508
  ```
509
- Supports multiple patterns:
509
+ Support multiple patterns:
510
510
  ```js
511
511
  const coverageOptions = {
512
512
  entryFilter: {
@@ -1062,8 +1062,8 @@ const coverageOptions = {
1062
1062
  - Node.js 20+
1063
1063
  - VSCode (extensions: eslint/stylelint/vue)
1064
1064
  ```sh
1065
- npm install starfall-cli -g
1066
1065
  npm install
1066
+ npx playwright install --with-deps
1067
1067
 
1068
1068
  npm run build
1069
1069
  npm run test
@@ -1082,4 +1082,5 @@ npm run eol
1082
1082
  - [Coverage Gutters](https://github.com/ryanluker/vscode-coverage-gutters) - Display test coverage generated by lcov or xml in VSCode editor.
1083
1083
 
1084
1084
  ## Thanks
1085
- - Special thanks to [@edumserrano](https://github.com/edumserrano)
1085
+ - [@bcoe](https://github.com/bcoe)
1086
+ - [@edumserrano](https://github.com/edumserrano)
package/README.zh-Hans.md CHANGED
@@ -1066,8 +1066,8 @@ const coverageOptions = {
1066
1066
  - Node.js 20+
1067
1067
  - VSCode (extensions: eslint/stylelint/vue)
1068
1068
  ```sh
1069
- npm install starfall-cli -g
1070
1069
  npm install
1070
+ npx playwright install --with-deps
1071
1071
 
1072
1072
  npm run build
1073
1073
  npm run test
@@ -1086,4 +1086,5 @@ npm run eol
1086
1086
  - [Coverage Gutters](https://github.com/ryanluker/vscode-coverage-gutters) - Display test coverage generated by lcov or xml in VSCode editor.
1087
1087
 
1088
1088
  ## Thanks
1089
- - Special thanks to [@edumserrano](https://github.com/edumserrano)
1089
+ - [@bcoe](https://github.com/bcoe)
1090
+ - [@edumserrano](https://github.com/edumserrano)
@@ -63,9 +63,14 @@ const resolveSourcesContent = (data, url) => {
63
63
 
64
64
  const { sources, sourcesContent } = data;
65
65
 
66
- let failed = false;
66
+ // sources [1,2,3]
67
+ // sourcesContent could be [null, null, "content"]
68
+ // some of contents could be missed
69
+
70
+ let hasSourceContent = false;
67
71
  sources.forEach((file, i) => {
68
72
  if (typeof sourcesContent[i] === 'string') {
73
+ hasSourceContent = true;
69
74
  return;
70
75
  }
71
76
 
@@ -79,16 +84,18 @@ const resolveSourcesContent = (data, url) => {
79
84
  const content = Util.readFileSync(path.resolve(sourcePath));
80
85
  if (typeof content === 'string') {
81
86
  sourcesContent[i] = content;
87
+ hasSourceContent = true;
82
88
  return;
83
89
  }
84
90
  }
85
91
 
86
- Util.logDebug(EC.red(`failed to load source content ${file}`));
87
- failed = true;
92
+ sourcesContent[i] = '';
93
+ Util.logDebug(EC.red(`failed to load source content: ${file}`));
94
+
88
95
  });
89
96
 
90
97
 
91
- if (!failed) {
98
+ if (hasSourceContent) {
92
99
  return data;
93
100
  }
94
101
  };
@@ -389,6 +389,13 @@ const checkOriginalRangeCode = (range, state, startEndMap, type) => {
389
389
  return false;
390
390
  }
391
391
 
392
+ // do not check text for `bytes`
393
+ // it could be `} ` uncovered in `try { } catch`
394
+ // instead, use `dedupeCountRanges` to accumulate count
395
+ if (type === 'bytes') {
396
+ return true;
397
+ }
398
+
392
399
  // invalid original code
393
400
  // Matches any character that is not a word character from the basic Latin alphabet.
394
401
  // Equivalent to [^A-Za-z0-9_]
@@ -400,12 +407,6 @@ const checkOriginalRangeCode = (range, state, startEndMap, type) => {
400
407
 
401
408
  // type: bytes, functions, branches, statements
402
409
 
403
- // do not check repeated range for `bytes`
404
- // instead, use `dedupeCountRanges` to accumulate count
405
- if (type === 'bytes') {
406
- return true;
407
- }
408
-
409
410
  // check repeated range
410
411
  const key = `${start}_${end}`;
411
412
  if (startEndMap.has(key)) {
package/lib/index.d.ts CHANGED
@@ -128,7 +128,7 @@ declare namespace MCR {
128
128
  path: string;
129
129
  type: "v8" | "istanbul";
130
130
  data: any;
131
- } | undefined;
131
+ };
132
132
 
133
133
 
134
134
  export interface MetricsSummary {
@@ -204,7 +204,7 @@ declare namespace MCR {
204
204
  watermarks: Watermarks;
205
205
  summary: CoverageSummary;
206
206
  files: CoverageFile[];
207
- } | undefined;
207
+ };
208
208
 
209
209
  export type LoggingType = "off" | "error" | "info" | "debug";
210
210
  export interface CoverageReportOptions {
@@ -329,7 +329,7 @@ declare namespace MCR {
329
329
  onEntry?: (entry: V8CoverageEntry) => Promise<void>;
330
330
 
331
331
  /** {function} onEnd hook */
332
- onEnd?: (coverageResults: CoverageResults) => Promise<void>;
332
+ onEnd?: (coverageResults: CoverageResults | undefined) => Promise<void>;
333
333
 
334
334
  [key: string]: any;
335
335
  }
@@ -357,7 +357,7 @@ declare namespace MCR {
357
357
  /** add coverage data
358
358
  *
359
359
  * @param coverageData {array} V8 format, {object} Istanbul format */
360
- add: (coverageData: any[] | any) => Promise<AddedResults>;
360
+ add: (coverageData: any[] | any) => Promise<AddedResults | undefined>;
361
361
 
362
362
  /**
363
363
  * add V8 coverage from a dir
@@ -366,7 +366,7 @@ declare namespace MCR {
366
366
  addFromDir: (dir: string) => Promise<void>;
367
367
 
368
368
  /** generate report */
369
- generate: () => Promise<CoverageResults>;
369
+ generate: () => Promise<CoverageResults | undefined>;
370
370
 
371
371
  /** check if cache exists */
372
372
  hasCache: () => boolean;