-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding support for including all sources in coverage data
- Loading branch information
Matt Winchester
authored and
Matt Winchester
committed
Mar 23, 2015
1 parent
b328e2e
commit 1809175
Showing
7 changed files
with
160 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var coverageMap = {}; | ||
|
||
function addCoverage(coverageObj){ | ||
coverageMap[coverageObj.path] = coverageObj; | ||
} | ||
|
||
function getCoverageMap(){ | ||
return coverageMap; | ||
} | ||
|
||
function resetCoverage(){ | ||
coverageMap = {}; | ||
} | ||
|
||
module.exports = { | ||
add: addCoverage, | ||
get: getCoverageMap, | ||
reset: resetCoverage | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
coverageMap = require '../lib/coverageMap' | ||
coverageObj = { path: './path.js', otherThings: 'that are in instrumented code' } | ||
|
||
describe 'coverageMap', -> | ||
it 'should add coverageMap and get them', -> | ||
coverageMap.add(coverageObj) | ||
|
||
expect(coverageMap.get()['./path.js']).to.equal coverageObj | ||
|
||
it 'should be able to be reset', -> | ||
coverageMap.reset() | ||
|
||
expect(coverageMap.get()['./path.js']).to.not.exist | ||
|
||
coverageMap.add(coverageObj) | ||
|
||
expect(coverageMap.get()['./path.js']).to.equal coverageObj | ||
|
||
coverageMap.reset() | ||
|
||
expect(coverageMap.get()['./path.js']).to.not.exist | ||
|
||
it 'should be able to have multiple coverageMap', -> | ||
coverageMap.reset() | ||
coverageMap.add(coverageObj) | ||
coverageMap.add({ path: './anotherFile.js', moarKeys: [1, 2, 3] }) | ||
|
||
expect(Object.keys(coverageMap.get()).length).to.equal 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters