Skip to content

Commit

Permalink
fix: Data merge concurrency limit to prevent OOM (#1293)
Browse files Browse the repository at this point in the history
Fixes #1263
  • Loading branch information
canonic-epicure authored Apr 1, 2020
1 parent befbf08 commit df34c1c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,16 @@ class NYC {

async getCoverageMapFromAllCoverageFiles (baseDirectory) {
const map = libCoverage.createCoverageMap({})
const files = await this.coverageFiles(baseDirectory)

const data = await this.coverageData(baseDirectory)
data.forEach(report => {
map.merge(report)
})
await pMap(
files,
async f => {
const report = await this.coverageFileLoad(f, baseDirectory)
map.merge(report)
},
{ concurrency: os.cpus().length }
)

map.data = await this.sourceMaps.remapCoverage(map.data)

Expand Down Expand Up @@ -503,6 +508,7 @@ class NYC {
}
}

// TODO: Remove from nyc v16
async coverageData (baseDirectory) {
const files = await this.coverageFiles(baseDirectory)
return pMap(
Expand Down

0 comments on commit df34c1c

Please sign in to comment.