monocart-reporter 1.6.36 → 1.7.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/README.md CHANGED
@@ -34,6 +34,7 @@
34
34
  - [Compare Istanbul, V8 and V8 to Istanbul](#compare-istanbul-v8-and-v8-to-istanbul)
35
35
  - [Global Coverage Report](#global-coverage-report) for Component Testing
36
36
  * [Attach Network Report](#attach-network-report)
37
+ * [Global State Management](#global-state-management)
37
38
  * [Merge Shard Reports](#merge-shard-reports)
38
39
  * [onEnd hook](#onend-hook)
39
40
  - [Send Email](#send-email)
@@ -628,18 +629,17 @@ Attach a code coverage report with API `attachCoverageReport(data, testInfo, opt
628
629
  - `data` There are two supported data inputs `Istanbul` (Object) or `V8` (Array)
629
630
  - `testInfo` see [TestInfo](https://playwright.dev/docs/api/class-testinfo)
630
631
  - `options` (Object)
631
- - Istanbul only:
632
- - `watermarks` (Object) Istanbul watermarks, see [here](https://github.com/istanbuljs/istanbuljs/tree/master/packages/istanbul-lib-report)
633
- - `lcov` (Boolean) Whether to create `lcov.info`
634
- - `sourcePath` (Function) source path handler, return a new source path
635
- - V8 only:
636
- - `toIstanbul` (Boolean) Whether to convert to Istanbul report
637
- - `watermarks` (Array) Defaults to `[50, 80]`
632
+ - `title` (String) report title.
633
+ - `toIstanbul` (Boolean) Whether to convert to Istanbul report from V8 list.
638
634
  - `entryFilter` (Function) A filter function to execute for each element in the V8 list.
639
635
  - `unpackSourceMap` (Boolean) Whether to unpack all sources from the source map if a related source map file is found.
640
636
  - `excludeDistFile` (Boolean) Whether to exclude the dist file (usually minified) if the sources are successfully unpacked from the source map.
641
637
  - `sourceFilter` (Function) A filter function to execute for each element in the sources which unpacked from the source map.
638
+ - `watermarks` (Object) Istanbul watermarks, see [here](https://github.com/istanbuljs/istanbuljs/tree/master/packages/istanbul-lib-report) | (Array) V8 watermarks, Defaults to `[50, 80]`.
639
+ - `lcov` (Boolean) Whether to create `lcov.info`. Istanbul only.
640
+ - `sourcePath` (Function) source path handler, return a new source path. Istanbul only.
642
641
  - `inline` (Boolean) Whether inline all scripts to the single HTML file.
642
+ - `debug` (Boolean) The temporary artifacts will not be removed.
643
643
 
644
644
  (see example: [report-coverage.spec.js](https://github.com/cenfun/monocart-reporter/blob/main/tests/report-coverage/report-coverage.spec.js))
645
645
 
@@ -762,7 +762,6 @@ Attach a network report with API `attachNetworkReport(har, testInfo)`. Arguments
762
762
  Generate HAR with `recordHar` option in browser.newContext() (see example: [report-network.spec.js](https://github.com/cenfun/monocart-reporter/blob/main/tests/report-network/report-network.spec.js) preview [report](https://cenfun.github.io/monocart-reporter/network-1a18723ee59b36867898/index.html))
763
763
 
764
764
  ```js
765
- // CommonJS
766
765
  const fs = require('fs');
767
766
  const path = require('path');
768
767
  const { test } = require('@playwright/test');
@@ -828,6 +827,94 @@ test('finally, attach HAR', async () => {
828
827
  ```
829
828
  Preview [Network HTML Report](https://cenfun.github.io/monocart-reporter/network-38e613e8d93547bdb27f/index.html)
830
829
 
830
+
831
+ ## Global State Management
832
+ When tests are executed in [isolation](https://playwright.dev/docs/browser-contexts) mode, the reporter and each test may run in a different process, they cannot share data with each other. we can start a local WebSocket server to serve the global data, and read/write the global data with `useState` API from a test.
833
+ - setup global state
834
+ ```js
835
+ module.exports = {
836
+ reporter: [
837
+ ['list'],
838
+ ['monocart-reporter', {
839
+ name: "My Test Report",
840
+ outputFile: './test-results/report.html',
841
+ state: {
842
+ data: {
843
+ count: 0
844
+ },
845
+ server: {
846
+ // port: 8130
847
+ },
848
+ onClose: (data, config) => {
849
+ // save state data to global metadata
850
+ Object.assign(config.metadata, data);
851
+ }
852
+ }
853
+ }]
854
+ ]
855
+ };
856
+ ```
857
+ - get/set/remove global data
858
+ ```js
859
+ const { test } = require('@playwright/test');
860
+ const { useState } = require('monocart-reporter');
861
+ test('state test', async ({ browserName }) => {
862
+ const state = useState({
863
+ // port: 8130
864
+ });
865
+
866
+ const count = await state.get('count');
867
+ console.log('count', count);
868
+
869
+ await state.set('count', count + 1);
870
+
871
+ await state.set({
872
+ browser: browserName,
873
+ someKey: 'some value'
874
+ });
875
+
876
+ const [browser, someKey] = await state.get('browser', 'someKey');
877
+ console.log(browser, someKey);
878
+
879
+ await state.remove('someKey');
880
+
881
+ const all = await state.get();
882
+ console.log(all);
883
+ });
884
+ ```
885
+ - customize sending and receiving messages
886
+ ```js
887
+ module.exports = {
888
+ reporter: [
889
+ ['list'],
890
+ ['monocart-reporter', {
891
+ name: "My Test Report",
892
+ outputFile: './test-results/report.html',
893
+ state: {
894
+ // receive messages and send back response
895
+ onReceive: function(... args) {
896
+ console.log('receive on server', args);
897
+ return ['custom response', ... args];
898
+ }
899
+ }
900
+ }]
901
+ ]
902
+ };
903
+ ```
904
+ ```js
905
+ const { test } = require('@playwright/test');
906
+ const { useState } = require('monocart-reporter');
907
+ test('state test', async ({ browserName }) => {
908
+ const state = useState({
909
+ // port: 8130
910
+ });
911
+ // send messages
912
+ const res = await state.send('string data', {});
913
+ console.log('receive on client', res);
914
+ });
915
+ ```
916
+
917
+
831
918
  ## Merge Shard Reports
832
919
  There will be multiple reports to be generated if Playwright test executes in sharding mode. for example:
833
920
  ```sh
package/lib/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
@@ -94,14 +94,17 @@ const start = function() {
94
94
  const args = process.argv.slice(2);
95
95
  const command = args.shift();
96
96
  // console.log(command, args);
97
- if (command === 'show-report') {
97
+ if (command === 'show' || command === 'show-report') {
98
98
  serveReport(args, true);
99
99
  return;
100
100
  }
101
101
 
102
- if (command === 'serve-report') {
102
+ if (command === 'serve' || command === 'serve-report') {
103
103
  serveReport(args, false);
104
+ return;
104
105
  }
106
+
107
+ EC.logRed(`Not found command: ${command}`);
105
108
  };
106
109
 
107
110
  start();
@@ -20,6 +20,8 @@ module.exports = {
20
20
  // sourceFilter: (sourceName) => sourceName.search(/src\/.+/) !== -1,
21
21
  // },
22
22
 
23
+ state: null,
24
+
23
25
  // trend data handler
24
26
  trend: null,
25
27
  // trend: () => './test-results/report.json',
@@ -1,7 +1,7 @@
1
1
  const path = require('path');
2
2
  const EC = require('eight-colors');
3
3
  const CG = require('console-grid');
4
- const { nodemailer } = require('./runtime/monocart-vendor.js');
4
+ const nodemailer = require('nodemailer');
5
5
  const Util = require('./utils/util.js');
6
6
  const emailPlugin = require('./plugins/email.js');
7
7
 
package/lib/index.d.ts ADDED
@@ -0,0 +1,127 @@
1
+ import { TestInfo } from "@playwright/test"
2
+
3
+ /**
4
+ * merge
5
+ */
6
+ export function merge(
7
+ reportDataList: [],
8
+ options?: any
9
+ ): Promise<void>;
10
+
11
+ /**
12
+ * audit
13
+ */
14
+ export type AuditReportOptions = {
15
+ title?: string,
16
+ outputDir?: string,
17
+ outputName?: string
18
+ };
19
+
20
+ export function attachAuditReport(
21
+ runnerResult: any,
22
+ testInfo: TestInfo,
23
+ options?: AuditReportOptions
24
+ ): Promise<any>;
25
+
26
+
27
+ /**
28
+ * coverage
29
+ */
30
+ export function addCoverageReport(
31
+ v8list: any[],
32
+ testInfo: TestInfo
33
+ ): Promise<any | void>;
34
+
35
+ export type CoverageReportOptions = {
36
+
37
+ title?: string,
38
+ outputDir?: string,
39
+ outputName?: string,
40
+
41
+ // Whether to convert to Istanbul report
42
+ toIstanbul?: boolean,
43
+
44
+ // A filter function to execute for each element in the V8 list.
45
+ entryFilter?: (entry: any) => boolean,
46
+
47
+ // Whether to unpack all sources from the source map if a related source map file is found.
48
+ unpackSourceMap?: boolean,
49
+ // Whether to exclude the dist file (usually minified) if the sources are successfully unpacked from the source map.
50
+ excludeDistFile?: boolean,
51
+
52
+ // A filter function to execute for each element in the sources which unpacked from the source map.
53
+ sourceFilter?: (sourcePath: string) => boolean,
54
+
55
+ sourcePath?: (sourcePath: string) => string,
56
+
57
+ sourceFinder?: (filePath: string) => string,
58
+
59
+ // Whether to create `lcov.info`
60
+ lcov?: boolean,
61
+
62
+ watermarks?: [number, number] | {
63
+ statements: [number, number],
64
+ functions: [number, number],
65
+ branches: [number, number],
66
+ lines: [number, number]
67
+ },
68
+
69
+ // Whether inline all scripts to the single HTML file.
70
+ inline?: boolean,
71
+
72
+ debug?: boolean
73
+ };
74
+
75
+ export function attachCoverageReport(
76
+ coverage: any[] | any,
77
+ testInfo: TestInfo,
78
+ options?: CoverageReportOptions
79
+ ): Promise<any>;
80
+
81
+
82
+
83
+ /**
84
+ * network
85
+ */
86
+ export type NetworkReportOptions = {
87
+ title?: string,
88
+ outputDir?: string,
89
+ outputName?: string,
90
+
91
+ // Whether inline all scripts to the single HTML file.
92
+ inline?: boolean
93
+ };
94
+
95
+ export function attachNetworkReport(
96
+ har: string | Buffer,
97
+ testInfo: TestInfo,
98
+ options?: NetworkReportOptions
99
+ ): Promise<any>;
100
+
101
+
102
+ /**
103
+ * state
104
+ */
105
+ export type StateOptions = {
106
+ host?: string,
107
+ port?: number,
108
+ timeout?: number
109
+ };
110
+
111
+ export type State = {
112
+ get: {
113
+ (key: string): Promise<any>,
114
+ (...args: string[]): Promise<any[]>
115
+ },
116
+ set: {
117
+ (key: string, value: any): Promise<void>,
118
+ (obj: object): Promise<void>
119
+ },
120
+ remove: {
121
+ (key: string): Promise<void>,
122
+ (...args: string[]): Promise<void>
123
+ },
124
+ send: (...args: any[]) => Promise<any>
125
+ }
126
+
127
+ export function useState(options?: StateOptions): State;
package/lib/index.js CHANGED
@@ -10,18 +10,23 @@ const { attachAuditReport } = require('./plugins/audit/audit.js');
10
10
  const { addCoverageReport, attachCoverageReport } = require('./plugins/coverage/coverage.js');
11
11
  const { attachNetworkReport } = require('./plugins/network/network.js');
12
12
 
13
+ const { createStateServer, useState } = require('./plugins/state/state.js');
14
+
13
15
  // custom reporter
14
16
  // https://playwright.dev/docs/test-reporters#custom-reporters
15
17
  class Reporter {
16
18
 
17
19
  static merge = merge;
18
20
 
19
- static addCoverageReport = addCoverageReport;
20
-
21
21
  static attachAuditReport = attachAuditReport;
22
+
23
+ static addCoverageReport = addCoverageReport;
22
24
  static attachCoverageReport = attachCoverageReport;
25
+
23
26
  static attachNetworkReport = attachNetworkReport;
24
27
 
28
+ static useState = useState;
29
+
25
30
  constructor(userOptions = {}) {
26
31
 
27
32
  const timestampStart = Date.now();
@@ -41,6 +46,11 @@ class Reporter {
41
46
 
42
47
  this.tickTime = this.options.tickTime || 1000;
43
48
  this.tickStart();
49
+
50
+ const stateOptions = this.options.state;
51
+ if (stateOptions) {
52
+ this.stateServer = createStateServer(stateOptions);
53
+ }
44
54
  }
45
55
 
46
56
  printsToStdio() {
@@ -67,14 +77,14 @@ class Reporter {
67
77
  // console.log(`onBegin: ${suite.allTests().length} tests`);
68
78
  }
69
79
 
70
- // Called on some global error, for example unhandled exception in the worker process.
71
- onError(error) {
72
- // EC.logRed(error);
73
- }
74
-
75
80
  onTestBegin(test, result) {
76
81
  // console.log(`onTestBegin ${test.title}`);
77
82
 
83
+ // there maybe multiple test running at same time
84
+ // currentTest only for missing logs
85
+ // do NOT using for test info
86
+ this.currentTest = test;
87
+
78
88
  // Note that do not use this because is parallel
79
89
  if (!test.timestamps) {
80
90
  test.timestamps = [];
@@ -93,6 +103,7 @@ class Reporter {
93
103
 
94
104
  onStdErr(chunk, test, result) {
95
105
  // Note that output may happen when no test is running, in which case this will be void.
106
+ test = test || this.currentTest;
96
107
  if (test) {
97
108
  test.logs.push(EC.red(chunk));
98
109
  }
@@ -100,11 +111,23 @@ class Reporter {
100
111
 
101
112
  onStdOut(chunk, test, result) {
102
113
  // Note that output may happen when no test is running, in which case this will be void.
114
+ test = test || this.currentTest;
103
115
  if (test) {
104
116
  test.logs.push(chunk);
105
117
  }
106
118
  }
107
119
 
120
+ // Called on some global error, for example unhandled exception in the worker process.
121
+ onError(error) {
122
+ // EC.logRed(error);
123
+
124
+ // add the error to test logs
125
+ if (this.currentTest) {
126
+ this.currentTest.logs.push(EC.red(error.message));
127
+ }
128
+
129
+ }
130
+
108
131
  // onStepBegin(test, result, step)
109
132
  // onStepEnd(test, result, step)
110
133
 
@@ -123,6 +146,14 @@ class Reporter {
123
146
  }
124
147
 
125
148
  async onEnd(result) {
149
+
150
+ this.currentTest = null;
151
+
152
+ if (this.stateServer) {
153
+ await this.stateServer.close(this.config);
154
+ this.stateServer = null;
155
+ }
156
+
126
157
  // console.log(`onEnd: ${result.status}`);
127
158
  // console.log(result);
128
159
  this.tickStop();
package/lib/index.mjs CHANGED
@@ -5,8 +5,11 @@ export { MonocartReporter };
5
5
 
6
6
  export const merge = MonocartReporter.merge;
7
7
 
8
- export const addCoverageReport = MonocartReporter.addCoverageReport;
9
-
10
8
  export const attachAuditReport = MonocartReporter.attachAuditReport;
9
+
10
+ export const addCoverageReport = MonocartReporter.addCoverageReport;
11
11
  export const attachCoverageReport = MonocartReporter.attachCoverageReport;
12
+
12
13
  export const attachNetworkReport = MonocartReporter.attachNetworkReport;
14
+
15
+ export const useState = MonocartReporter.useState;
@@ -8,12 +8,12 @@ const {
8
8
  initV8ListAndSourcemap, unpackV8List, mergeV8Coverage, saveV8Report
9
9
  } = require('./v8/v8.js');
10
10
 
11
- // ========================================================================================================
12
-
13
- const defaultV8Options = {
11
+ const defaultOptions = {
14
12
 
15
13
  // Defaults to test title
16
- // title: '',
14
+ // title
15
+ // outputDir
16
+ // outputName
17
17
 
18
18
  // (Boolean) Whether to convert to Istanbul report
19
19
  toIstanbul: false,
@@ -25,25 +25,10 @@ const defaultV8Options = {
25
25
  // (Boolean) Whether to exclude the dist file (usually minified) if the sources are successfully unpacked from the source map.
26
26
  excludeDistFile: true,
27
27
  // (Function) A filter function to execute for each element in the sources which unpacked from the source map.
28
- sourceFilter: null
29
-
30
- // (Array) Defaults to `[50, 80]`
31
- // watermarks: [50, 80],
32
-
33
- // (Boolean) Whether inline all scripts to the single HTML file.
34
- // inline: false
35
- };
36
-
37
- const defaultIstanbulOptions = {
38
-
39
- // Defaults to test title
40
- // title: '',
41
-
42
- // when toIstanbul = true
43
- entryFilter: null,
44
- unpackSourceMap: true,
45
28
  sourceFilter: null,
46
29
 
30
+ // Istanbul Only
31
+
47
32
  // source path handler
48
33
  sourcePath: null,
49
34
 
@@ -55,8 +40,16 @@ const defaultIstanbulOptions = {
55
40
 
56
41
  // (Object) Istanbul watermarks, see [here](https://github.com/istanbuljs/istanbuljs/tree/master/packages/istanbul-lib-report)
57
42
  // watermarks: {},
43
+ // (Array) V8 watermarks, Defaults to `[50, 80]`
44
+ // watermarks: [50, 80],
45
+
46
+ // (Boolean) Whether inline all scripts to the single HTML file.
47
+ // inline: false,
48
+
49
+ // debug: false
58
50
  };
59
51
 
52
+
60
53
  // ========================================================================================================
61
54
 
62
55
  const saveReportAttachment = (testInfo, report, htmlDir) => {
@@ -77,12 +70,9 @@ const saveReportAttachment = (testInfo, report, htmlDir) => {
77
70
 
78
71
  const generateIstanbulReport = (coverageData, testInfo, options) => {
79
72
 
80
- options = {
81
- ... defaultIstanbulOptions,
82
- ... options
83
- };
73
+ const fileSources = options.fileSources || {};
84
74
 
85
- const report = saveIstanbulReport(coverageData, options.fileSources, options);
75
+ const report = saveIstanbulReport(coverageData, fileSources, options);
86
76
 
87
77
  saveReportAttachment(testInfo, report, options.htmlDir);
88
78
 
@@ -94,12 +84,6 @@ const generateIstanbulReport = (coverageData, testInfo, options) => {
94
84
 
95
85
  const generateV8Coverage = async (v8list, testInfo, options) => {
96
86
 
97
- // v8list options, also for init / source map handler
98
- options = {
99
- ... defaultV8Options,
100
- ... options
101
- };
102
-
103
87
  // init v8list and unpack sourcemap
104
88
  const inlineSourceMap = true;
105
89
  v8list = await initV8ListAndSourcemap(v8list, options, inlineSourceMap);
@@ -107,10 +91,6 @@ const generateV8Coverage = async (v8list, testInfo, options) => {
107
91
  // ================================================================
108
92
 
109
93
  if (options.toIstanbul) {
110
- options = {
111
- ... defaultIstanbulOptions,
112
- ... options
113
- };
114
94
 
115
95
  const { coverageData, fileSources } = await convertV8ToIstanbul(v8list, options);
116
96
 
@@ -141,6 +121,7 @@ const attachCoverageReport = (coverageInput, testInfo, options = {}) => {
141
121
  }
142
122
 
143
123
  options = {
124
+ ... defaultOptions,
144
125
  // default title
145
126
  title: `Coverage Report - ${testInfo.title}`,
146
127
  outputDir: Util.resolveOutputDir(testInfo),
@@ -187,7 +168,7 @@ const addCoverageReport = async (v8list, testInfo) => {
187
168
  const outputDir = path.dirname(outputFile);
188
169
 
189
170
  const options = {
190
- ... defaultV8Options,
171
+ ... defaultOptions,
191
172
  // use reporter dir as output dir, NOT test output dir
192
173
  outputDir,
193
174
  outputName: 'coverage',
@@ -237,22 +218,12 @@ const addCoverageReport = async (v8list, testInfo) => {
237
218
 
238
219
  const getGlobalCoverageData = async (dataList, options) => {
239
220
 
240
- options = {
241
- ... defaultV8Options,
242
- ... options
243
- };
244
-
245
221
  // merge v8list first
246
222
  const v8list = await mergeV8Coverage(dataList, options);
247
223
  // console.log('after merge', v8list.map((it) => it.url));
248
224
 
249
225
  if (options.toIstanbul) {
250
226
 
251
- options = {
252
- ... defaultIstanbulOptions,
253
- ... options
254
- };
255
-
256
227
  const { coverageData, fileSources } = await convertV8ToIstanbul(v8list, options);
257
228
 
258
229
  const report = await saveIstanbulReport(coverageData, fileSources, options);
@@ -279,6 +250,7 @@ const generateGlobalCoverageReport = async (dataList, reporterOptions) => {
279
250
 
280
251
  const coverageOptions = reporterOptions.coverage || {};
281
252
  const options = {
253
+ ... defaultOptions,
282
254
  title: `Coverage Report - ${reporterOptions.name}`,
283
255
  outputDir,
284
256
  outputName: 'coverage',
@@ -28,11 +28,14 @@ const saveIstanbulReport = (coverageData, fileSources, options) => {
28
28
  data = {};
29
29
  Object.keys(coverageData).forEach((sourcePath) => {
30
30
  const d = coverageData[sourcePath];
31
- const newSourcePath = options.sourcePath(sourcePath, fileSources);
32
- if (newSourcePath) {
31
+ const s = fileSources[sourcePath];
32
+ const newSourcePath = options.sourcePath(sourcePath);
33
+ if (newSourcePath && newSourcePath !== sourcePath) {
33
34
  sourcePath = newSourcePath;
35
+ // related updates
36
+ fileSources[sourcePath] = s;
37
+ d.path = sourcePath;
34
38
  }
35
- d.path = sourcePath;
36
39
  data[sourcePath] = d;
37
40
  });
38
41
  }
@@ -181,14 +184,25 @@ const convertV8ToIstanbul = async (v8list, options) => {
181
184
  return p;
182
185
  };
183
186
 
187
+ let failed = false;
184
188
  await v8toIstanbul.load().catch((e) => {
185
- EC.logRed(`[MCR] ${item.filename} v8toIstanbul.load:`, e.message);
189
+ EC.logRed(`[MCR] ${item.sourcePath} v8toIstanbul.load:`, e.message);
190
+ failed = true;
186
191
  });
187
192
 
193
+ if (failed) {
194
+ continue;
195
+ }
196
+
188
197
  try {
189
198
  v8toIstanbul.applyCoverage(item.functions);
190
199
  } catch (e) {
191
- EC.logRed(`[MCR] ${item.filename} v8toIstanbul.applyCoverage:`, e.message);
200
+ EC.logRed(`[MCR] ${item.sourcePath} v8toIstanbul.applyCoverage:`, e.message);
201
+ failed = true;
202
+ }
203
+
204
+ if (failed) {
205
+ continue;
192
206
  }
193
207
 
194
208
  const istanbulData = v8toIstanbul.toIstanbul();
@@ -99,7 +99,7 @@ const findOriginalEndPosition = (consumer, eLoc, generatedMapping, range) => {
99
99
 
100
100
  // =========================================================================================================
101
101
 
102
- const getOriginalMappings = (generatedMapping, consumer, options) => {
102
+ const getOriginalMappings = (consumer, options) => {
103
103
 
104
104
  // source filter
105
105
  let sourceList = consumer.sources;
@@ -152,7 +152,7 @@ const unpackJsSourceMap = async (item, v8list, options) => {
152
152
 
153
153
  const generatedMapping = new PositionMapping(item.source);
154
154
  const consumer = await new SourceMapConsumer(sourceMap);
155
- const originalMappings = getOriginalMappings(generatedMapping, consumer, options);
155
+ const originalMappings = getOriginalMappings(consumer, options);
156
156
 
157
157
  // generated ranges to original ranges
158
158
  item.ranges.forEach((range) => {
@@ -419,6 +419,12 @@ const filterSourceMapList = (v8list, options) => {
419
419
  return;
420
420
  }
421
421
 
422
+ // do not remove in debug mode
423
+ if (options.debug) {
424
+ return sourceMapList;
425
+ }
426
+
427
+ // remove dist file if found sourceMap
422
428
  if (options.excludeDistFile) {
423
429
  indexes.reverse();
424
430
  indexes.forEach((i) => {
@@ -17,7 +17,7 @@ const getCssSummary = (item) => {
17
17
  const uncovered = total - covered;
18
18
 
19
19
  return {
20
- name: item.filename,
20
+ name: item.sourcePath,
21
21
  type: item.type,
22
22
  url: item.url,
23
23
  total,
@@ -59,7 +59,7 @@ const getJsSummary = (item) => {
59
59
  const covered = total - uncovered;
60
60
 
61
61
  return {
62
- name: item.filename,
62
+ name: item.sourcePath,
63
63
  type: item.type,
64
64
  url: item.url,
65
65
  total,