monocart-coverage-reports 2.10.5 → 2.10.6
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 +2 -0
- package/README.zh-Hans.md +2 -0
- package/lib/converter/untested.js +3 -64
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -967,6 +967,8 @@ process.env.MCR_LOG_TIME = true
|
|
|
967
967
|
- Coverage for Next.js, both server side and client side:
|
|
968
968
|
- [nextjs-with-playwright](https://github.com/cenfun/nextjs-with-playwright)
|
|
969
969
|
- [nextjs-with-playwright-istanbul](https://github.com/cenfun/nextjs-with-playwright-istanbul)
|
|
970
|
+
- Coverage for Remix:
|
|
971
|
+
- [remix-with-playwright](https://github.com/cenfun/remix-with-playwright)
|
|
970
972
|
- see [Collecting V8 Coverage Data with Playwright](#collecting-v8-coverage-data-with-playwright)
|
|
971
973
|
|
|
972
974
|
### [c8](https://github.com/bcoe/c8)
|
package/README.zh-Hans.md
CHANGED
|
@@ -971,6 +971,8 @@ process.env.MCR_LOG_TIME = true
|
|
|
971
971
|
- Coverage for Next.js, both server side and client side:
|
|
972
972
|
- [nextjs-with-playwright](https://github.com/cenfun/nextjs-with-playwright)
|
|
973
973
|
- [nextjs-with-playwright-istanbul](https://github.com/cenfun/nextjs-with-playwright-istanbul)
|
|
974
|
+
- Coverage for Remix:
|
|
975
|
+
- [remix-with-playwright](https://github.com/cenfun/remix-with-playwright)
|
|
974
976
|
- see [Collecting V8 Coverage Data with Playwright](#collecting-v8-coverage-data-with-playwright)
|
|
975
977
|
|
|
976
978
|
### [c8](https://github.com/bcoe/c8)
|
|
@@ -5,7 +5,7 @@ const Util = require('../utils/util.js');
|
|
|
5
5
|
const { pathToFileURL, fileURLToPath } = require('url');
|
|
6
6
|
|
|
7
7
|
// const EC = require('eight-colors');
|
|
8
|
-
const { minimatch
|
|
8
|
+
const { minimatch } = require('../packages/monocart-coverage-vendor.js');
|
|
9
9
|
|
|
10
10
|
// ========================================================================================================
|
|
11
11
|
|
|
@@ -109,63 +109,15 @@ const resolveFileType = (fileType, filePath) => {
|
|
|
109
109
|
return 'js';
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
-
const
|
|
113
|
-
const {
|
|
114
|
-
id,
|
|
115
|
-
url,
|
|
116
|
-
source,
|
|
117
|
-
sourceMap
|
|
118
|
-
} = entryFile;
|
|
119
|
-
// console.log('-', entry.sourcePath);
|
|
120
|
-
|
|
121
|
-
const { cachePath } = Util.getCacheFileInfo('source', id, options.cacheDir);
|
|
122
|
-
if (fs.existsSync(cachePath)) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// save source and sourceMap to separated json file
|
|
127
|
-
const sourceData = {
|
|
128
|
-
id,
|
|
129
|
-
url,
|
|
130
|
-
source,
|
|
131
|
-
sourceMap
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
// remove comments if not debug
|
|
135
|
-
if (!Util.isDebug()) {
|
|
136
|
-
sourceData.source = convertSourceMap.removeComments(source);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// console.log('save untested file', id, url);
|
|
140
|
-
|
|
141
|
-
await Util.saveSourceCacheFile(sourceData, options);
|
|
142
|
-
|
|
143
|
-
};
|
|
112
|
+
const getUntestedCoverageData = (emptyList, options, coverageType) => {
|
|
144
113
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
// save all empty coverage
|
|
148
|
-
const dataId = Util.uid();
|
|
149
|
-
const results = {
|
|
150
|
-
id: dataId
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
if (coverageType === 'istanbul') {
|
|
154
|
-
results.type = 'istanbul';
|
|
155
|
-
results.data = {};
|
|
156
|
-
} else {
|
|
157
|
-
results.type = 'v8';
|
|
158
|
-
results.data = [];
|
|
159
|
-
}
|
|
114
|
+
// NOTE: do not save untested file to raw report
|
|
160
115
|
|
|
161
116
|
const emptyCoverageList = [];
|
|
162
117
|
|
|
163
118
|
// save all empty source and sourcemap
|
|
164
119
|
for (const entryFile of emptyList) {
|
|
165
120
|
|
|
166
|
-
// for raw report: source file
|
|
167
|
-
await saveUntestedFileSource(entryFile, options);
|
|
168
|
-
|
|
169
121
|
const { type, url } = entryFile;
|
|
170
122
|
|
|
171
123
|
if (coverageType === 'istanbul') {
|
|
@@ -181,7 +133,6 @@ const getUntestedCoverageData = async (emptyList, options, coverageType) => {
|
|
|
181
133
|
b: {}
|
|
182
134
|
};
|
|
183
135
|
// object
|
|
184
|
-
results.data[item.path] = item;
|
|
185
136
|
emptyCoverageList.push(item);
|
|
186
137
|
|
|
187
138
|
} else {
|
|
@@ -202,14 +153,6 @@ const getUntestedCoverageData = async (emptyList, options, coverageType) => {
|
|
|
202
153
|
entryFile.ranges = entryFile.ranges || [];
|
|
203
154
|
}
|
|
204
155
|
|
|
205
|
-
const item = {
|
|
206
|
-
... entryFile
|
|
207
|
-
};
|
|
208
|
-
delete item.source;
|
|
209
|
-
delete item.sourceMap;
|
|
210
|
-
|
|
211
|
-
// array
|
|
212
|
-
results.data.push(item);
|
|
213
156
|
// will be parsed to AST and converted to V8 coverage
|
|
214
157
|
emptyCoverageList.push(entryFile);
|
|
215
158
|
|
|
@@ -217,10 +160,6 @@ const getUntestedCoverageData = async (emptyList, options, coverageType) => {
|
|
|
217
160
|
|
|
218
161
|
}
|
|
219
162
|
|
|
220
|
-
// for raw report: coverage file
|
|
221
|
-
const { cachePath } = Util.getCacheFileInfo('coverage', dataId, options.cacheDir);
|
|
222
|
-
await Util.writeFile(cachePath, JSON.stringify(results));
|
|
223
|
-
|
|
224
163
|
return emptyCoverageList;
|
|
225
164
|
};
|
|
226
165
|
|