monocart-coverage-reports 2.12.8 → 2.12.9
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/lib/utils/source-path.js +6 -2
- package/package.json +1 -1
package/lib/utils/source-path.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
1
2
|
const path = require('path');
|
|
2
3
|
const { fileURLToPath, pathToFileURL } = require('url');
|
|
3
4
|
const Util = require('./util.js');
|
|
@@ -161,6 +162,7 @@ const initIstanbulSourcePath = (coverageData, fileSources, options) => {
|
|
|
161
162
|
const sourcePathReplacer = getSourcePathReplacer(options);
|
|
162
163
|
|
|
163
164
|
const newCoverage = {};
|
|
165
|
+
// eslint-disable-next-line complexity
|
|
164
166
|
Object.keys(coverageData).forEach((sourcePath) => {
|
|
165
167
|
// previous coverage and source
|
|
166
168
|
const item = coverageData[sourcePath];
|
|
@@ -175,6 +177,10 @@ const initIstanbulSourcePath = (coverageData, fileSources, options) => {
|
|
|
175
177
|
}
|
|
176
178
|
}
|
|
177
179
|
|
|
180
|
+
if (!fs.existsSync(sourcePath)) {
|
|
181
|
+
sourcePath = normalizePathDir(sourcePath);
|
|
182
|
+
}
|
|
183
|
+
|
|
178
184
|
// new source path, second is source url
|
|
179
185
|
if (sourcePathReplacer) {
|
|
180
186
|
const newSourcePath = sourcePathReplacer(sourcePath, item);
|
|
@@ -183,8 +189,6 @@ const initIstanbulSourcePath = (coverageData, fileSources, options) => {
|
|
|
183
189
|
}
|
|
184
190
|
}
|
|
185
191
|
|
|
186
|
-
// console.log(item);
|
|
187
|
-
|
|
188
192
|
// update source path
|
|
189
193
|
if (item.data) {
|
|
190
194
|
item.data.path = sourcePath;
|