Skip to content

Commit 83eb629

Browse files
authored
fix: Avoid source-map module during signal-exit handler (#1191)
Prior to this change child processes would call upon the source-map module to remap coverage during the `signal-exit` handler. This was a blocker for updating `source-map` to 0.7.x which uses an async constructor method. Now we simply save the source-map with the raw coverage data for each file. This allows the main nyc process to perform source-map remapping. The benefit is that the main nyc process can use async code.
1 parent 22a5ea0 commit 83eb629

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ class NYC {
369369
}
370370
}, this)
371371
} else {
372-
coverage = this.sourceMaps.remapCoverage(coverage)
372+
this.sourceMaps.addSourceMaps(coverage)
373373
}
374374

375375
var id = this.processInfo.uuid

lib/source-maps.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ class SourceMaps {
3737
return sourceMap
3838
}
3939

40+
addSourceMaps (coverage) {
41+
this._sourceMapCache.addInputSourceMapsSync(coverage)
42+
}
43+
4044
remapCoverage (obj) {
4145
const transformed = this._sourceMapCache.transformCoverage(
4246
libCoverage.createCoverageMap(obj)

0 commit comments

Comments
 (0)