diff --git a/lib/tests/reporter.js b/lib/tests/reporter.js index de20b469..db515061 100644 --- a/lib/tests/reporter.js +++ b/lib/tests/reporter.js @@ -26,6 +26,10 @@ class EmbarkSpec extends Base { console.log(fmt, receipt.className, receipt.gasUsed); } + function onBlockHeader(blockHeader) { + self.stats.totalGasCost += blockHeader.gasUsed; + self.stats.test.gasUsed += blockHeader.gasUsed; + } function onBlockHeader(blockHeader) { if(!self.listenForGas) { diff --git a/lib/tests/test.js b/lib/tests/test.js index 72cdcd71..12bebd71 100644 --- a/lib/tests/test.js +++ b/lib/tests/test.js @@ -140,6 +140,18 @@ class Test { callback(); } + subscribeToPendingTransactions() { + const self = this; + if (self.logsSubscription) { + self.logsSubscription.unsubscribe(); + } + self.logsSubscription = self.web3.eth + .subscribe('newBlockHeaders') + .on("data", function (blockHeader) { + self.engine.events.emit('block:header', blockHeader); + }); + } + initDeployServices() { this.engine.startService("web3", { web3: this.web3