From 6fef533fffba7e1ff559fb139be2dd29760db884 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 21 Mar 2018 18:38:45 +0000 Subject: Improve comments --- packages/sol-cov/src/coverage_subprovider.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'packages/sol-cov') diff --git a/packages/sol-cov/src/coverage_subprovider.ts b/packages/sol-cov/src/coverage_subprovider.ts index 1d3f263b0..fc06720de 100644 --- a/packages/sol-cov/src/coverage_subprovider.ts +++ b/packages/sol-cov/src/coverage_subprovider.ts @@ -12,12 +12,13 @@ interface MaybeFakeTxData extends Web3.TxData { isFakeTransaction?: boolean; } +// Because there is no notion of a call trace in the Ethereum rpc - we collect them in a rather non-obvious/hacky way. +// On each call - we create a snapshot, execute the call as a transaction, get the trace, revert the snapshot. +// That allows us to avoid influencing test behaviour. + /** * This class implements the [web3-provider-engine](https://github.com/MetaMask/provider-engine) subprovider interface. * It collects traces of all transactions that were sent and all calls that were executed through JSON RPC. - * Because there is no notion of a call trace in the Ethereum rpc - we collect them in a rather non-obvious/hacky way. - * On each call - we create a snapshot, execute the call as a transaction, get the trace, revert the snapshot. - * That allows us to avoid influencing test behaviour. */ export class CoverageSubprovider extends Subprovider { // Lock is used to not accept normal transactions while doing call/snapshot magic because they'll be reverted later otherwise @@ -25,9 +26,9 @@ export class CoverageSubprovider extends Subprovider { private _coverageManager: CoverageManager; private _defaultFromAddress: string; /** - * Instantiates a CoverageSubprovider + * Instantiates a CoverageSubprovider instance * @param artifactsPath Path to the smart contract artifacts - * @param sourcePath Path to the smart contract source files + * @param sourcesPath Path to the smart contract source files * @param networkId network id * @param defaultFromAddress default from address to use when sending transactions */ @@ -42,6 +43,9 @@ export class CoverageSubprovider extends Subprovider { this._getContractCodeAsync.bind(this), ); } + /** + * Write the test coverage results to a file in Istanbul format. + */ public async writeCoverageAsync(): Promise { await this._coverageManager.writeCoverageAsync(); } -- cgit v1.2.3