v3 new release (#80)
This commit is contained in:
committed by
GitHub
parent
a767c8d3a1
commit
20d2b4f98d
37
node_modules/collect-v8-coverage/index.js
generated
vendored
Normal file
37
node_modules/collect-v8-coverage/index.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
const { Session } = require('inspector');
|
||||
const { promisify } = require('util');
|
||||
|
||||
class CoverageInstrumenter {
|
||||
constructor() {
|
||||
this.session = new Session();
|
||||
|
||||
this.postSession = promisify(this.session.post.bind(this.session));
|
||||
}
|
||||
|
||||
async startInstrumenting() {
|
||||
this.session.connect();
|
||||
|
||||
await this.postSession('Profiler.enable');
|
||||
|
||||
await this.postSession('Profiler.startPreciseCoverage', {
|
||||
callCount: true,
|
||||
detailed: true,
|
||||
});
|
||||
}
|
||||
|
||||
async stopInstrumenting() {
|
||||
const {result} = await this.postSession(
|
||||
'Profiler.takePreciseCoverage',
|
||||
);
|
||||
|
||||
await this.postSession('Profiler.stopPreciseCoverage');
|
||||
|
||||
await this.postSession('Profiler.disable');
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.CoverageInstrumenter = CoverageInstrumenter;
|
Reference in New Issue
Block a user