diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-22 02:38:45 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-22 02:38:45 +0800 |
commit | 6fef533fffba7e1ff559fb139be2dd29760db884 (patch) | |
tree | 400c2f827b46c00c843e36e6c6d880a3d4e1ad8d /packages/sol-cov/src | |
parent | ec219fc3959cb4721a559472a872598f8dbee719 (diff) | |
download | dexon-0x-contracts-6fef533fffba7e1ff559fb139be2dd29760db884.tar.gz dexon-0x-contracts-6fef533fffba7e1ff559fb139be2dd29760db884.tar.zst dexon-0x-contracts-6fef533fffba7e1ff559fb139be2dd29760db884.zip |
Improve comments
Diffstat (limited to 'packages/sol-cov/src')
-rw-r--r-- | packages/sol-cov/src/coverage_subprovider.ts | 14 |
1 files changed, 9 insertions, 5 deletions
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<void> { await this._coverageManager.writeCoverageAsync(); } |