Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Convert InMemoryReport to the ES6 class * Use default params for reporters and coverageReporter * Remove lodash usages and dependencies * Replace all vars on const vs let in preprocessor
- Loading branch information
1 parent
9c8a222
commit d3f53e3
Showing
6 changed files
with
87 additions
and
101 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
function InMemoryReport (opt) { | ||
this.opt = opt | ||
} | ||
class InMemoryReport { | ||
constructor (opt) { | ||
this.opt = opt | ||
} | ||
|
||
InMemoryReport.prototype.onStart = function (root, context) { | ||
this.data = {} | ||
} | ||
onStart () { | ||
this.data = {} | ||
} | ||
|
||
InMemoryReport.prototype.onDetail = function (node) { | ||
const fc = node.getFileCoverage() | ||
const key = fc.path | ||
this.data[key] = fc.toJSON() | ||
} | ||
onDetail (node) { | ||
const fc = node.getFileCoverage() | ||
const key = fc.path | ||
this.data[key] = fc.toJSON() | ||
} | ||
|
||
InMemoryReport.prototype.onEnd = function () { | ||
if (!this.opt.emitter || !this.opt.emitter.emit) { | ||
console.error('Could not raise "coverage_complete" event, missing emitter because it was not supplied during initialization of the reporter') | ||
} else { | ||
onEnd () { | ||
if (!this.opt || !this.opt.emitter || !this.opt.emitter.emit) { | ||
console.error('Could not raise "coverage_complete" event, missing emitter because it was not supplied during initialization of the reporter') | ||
return | ||
} | ||
this.opt.emitter.emit('coverage_complete', this.opt.browser, this.data) | ||
} | ||
} | ||
|
||
InMemoryReport.TYPE = 'in-memory' | ||
|
||
module.exports = InMemoryReport |
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
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
Oops, something went wrong.