diff --git a/index.js b/index.js index 3ebf3555..8cc70200 100755 --- a/index.js +++ b/index.js @@ -418,17 +418,19 @@ class NYC { } async getCoverageMapFromAllCoverageFiles (baseDirectory) { - const map = libCoverage.createCoverageMap({}) const files = await this.coverageFiles(baseDirectory) - await pMap( + const reports = await pMap( files, - async f => { - const report = await this.coverageFileLoad(f, baseDirectory) - map.merge(report) - }, + f => this.coverageFileLoad(f, baseDirectory), { concurrency: os.cpus().length } ) + const map = reports.reduce((m, report) => { + m.merge(report) + return m + }, + libCoverage.createCoverageMap({}) + ) map.data = await this.sourceMaps.remapCoverage(map.data)