diff --git a/src/reporter.js b/src/reporter.js index 0075f79..f537cfc 100644 --- a/src/reporter.js +++ b/src/reporter.js @@ -102,8 +102,13 @@ function CoverageIstanbulReporter(baseReporterDecorator, logger, config) { .map; if (!coverageConfig.skipFilesWithNoCoverage) { + // On Windows, istanbul returns files with mixed forward/backslashes in them + const fixedFilePaths = {}; + remappedCoverageMap.files().forEach(path => { + fixedFilePaths[util.fixPathSeparators(path)] = true; + }); coverageMap.files().forEach(path => { - if (!(path in remappedCoverageMap)) { + if (!(util.fixPathSeparators(path) in fixedFilePaths)) { // Re-add empty coverage record remappedCoverageMap.addFileCoverage(path); } diff --git a/src/util.js b/src/util.js index 76b85a4..b54309b 100644 --- a/src/util.js +++ b/src/util.js @@ -90,6 +90,7 @@ function overrideThresholds(key, overrides, basePath) { return thresholds; } +module.exports.fixPathSeparators = fixPathSeparators; module.exports.fixWebpackSourcePaths = fixWebpackSourcePaths; module.exports.fixWebpackFilePath = fixWebpackFilePath; module.exports.overrideThresholds = overrideThresholds;