source: trip-planner-front/node_modules/karma-coverage/lib/in-memory-report.js@ 8d391a1

Last change on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 714 bytes
Line 
1const { ReportBase } = require('istanbul-lib-report')
2
3class InMemoryReport extends ReportBase {
4 constructor (opt) {
5 super(opt)
6 this.opt = opt
7 }
8
9 onStart () {
10 this.data = {}
11 }
12
13 onDetail (node) {
14 const fc = node.getFileCoverage()
15 const key = fc.path
16 this.data[key] = fc.toJSON()
17 }
18
19 onEnd () {
20 if (!this.opt || !this.opt.emitter || !this.opt.emitter.emit) {
21 console.error('Could not raise "coverage_complete" event, missing emitter because it was not supplied during initialization of the reporter')
22 return
23 }
24 this.opt.emitter.emit('coverage_complete', this.opt.browser, this.data)
25 }
26}
27InMemoryReport.TYPE = 'in-memory'
28
29module.exports = InMemoryReport
Note: See TracBrowser for help on using the repository browser.