Update coverage report after each step
This commit is contained in:
parent
9887a2204d
commit
cd8980151b
|
@ -24,12 +24,8 @@ class CodeCoverage {
|
|||
this.coverageReport = {};
|
||||
this.contractSources = new ContractSources([]);
|
||||
|
||||
var self = this;
|
||||
|
||||
process.on('exit', (_code) => {
|
||||
const coverageReportPath = fs.dappPath('.embark', 'coverage.json');
|
||||
fs.writeFileSync(coverageReportPath, JSON.stringify(self.coverageReport));
|
||||
});
|
||||
this.dotEmbarkPath = fs.dappPath('.embark');
|
||||
this.coverageReportPath = fs.dappPath('.embark', 'coverage.json');
|
||||
}
|
||||
|
||||
compileSolc(input) {
|
||||
|
@ -42,6 +38,11 @@ class CodeCoverage {
|
|||
this.contractSources.parseSolcOutput(output);
|
||||
}
|
||||
|
||||
updateCoverageReport() {
|
||||
fs.mkdirpSync(this.dotEmbarkPath);
|
||||
fs.writeFileSync(this.coverageReportPath, JSON.stringify(this.coverageReport));
|
||||
}
|
||||
|
||||
async runSolc(receipt) {
|
||||
let block = await web3.eth.getBlock(receipt.number);
|
||||
if(block.transactions.length == 0) return;
|
||||
|
@ -61,6 +62,8 @@ class CodeCoverage {
|
|||
for(let i in traces) {
|
||||
this.coverageReport = this.contractSources.generateCodeCoverage(traces[i]);
|
||||
}
|
||||
|
||||
this.updateCoverageReport();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue