aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-cov
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-22 02:40:59 +0800
committerFabio Berger <me@fabioberger.com>2018-03-22 02:40:59 +0800
commit542b46a22feb6187e483aa4e9ccee344a9b64ec6 (patch)
tree0710f1d4b0bb31f57456e40bac6d719e9567a706 /packages/sol-cov
parent6fef533fffba7e1ff559fb139be2dd29760db884 (diff)
downloaddexon-0x-contracts-542b46a22feb6187e483aa4e9ccee344a9b64ec6.tar.gz
dexon-0x-contracts-542b46a22feb6187e483aa4e9ccee344a9b64ec6.tar.zst
dexon-0x-contracts-542b46a22feb6187e483aa4e9ccee344a9b64ec6.zip
Move usage out of README and replace with link to Docs
Diffstat (limited to 'packages/sol-cov')
-rw-r--r--packages/sol-cov/README.md31
1 files changed, 8 insertions, 23 deletions
diff --git a/packages/sol-cov/README.md b/packages/sol-cov/README.md
index 6a98346f9..466595f4e 100644
--- a/packages/sol-cov/README.md
+++ b/packages/sol-cov/README.md
@@ -2,41 +2,26 @@
A Solidity code coverage tool.
+### Read the [Documentation](0xproject.com/docs/sol-cov).
+
## Installation
```bash
-yarn add -D @0xproject/sol-cov
+npm install @0xproject/sol-cov --save
```
-## Usage
-
-Sol-cov uses transaction traces in order to figure out which lines of Solidity source code have been covered by your tests. In order for it to gather these traces, you must add the `CoverageSubprovider` to the [ProviderEngine](https://github.com/MetaMask/provider-engine) instance you use when running your Solidity tests. If you're unfamiliar with ProviderEngine, please read the [Web3 Provider explained](https://0xproject.com/wiki#Web3-Provider-Explained) wiki article.
+**Import**
-The CoverageSubprovider eavesdrops on the `eth_sendTransaction` and `eth_call` RPC calls and collects traces after each call using `debug_traceTransaction`. `eth_call`'s' don't generate traces - so we take a snapshot, re-submit it as a transaction, get the trace and then revert the snapshot.
-
-```typescript
+```javascript
import { CoverageSubprovider } from '@0xproject/sol-cov';
-
-const provider = new ProviderEngine();
-
-const artifactsPath = 'src/artifacts';
-const contractsPath = 'src/contracts';
-const networkId = 50;
-// Some calls might not have `from` address specified. Nevertheless - transactions need to be submitted from an address with at least some funds. defaultFromAddress is the address that will be used to submit those calls as transactions from.
-const defaultFromAddress = '0x5409ed021d9299bf6814279a6a1411a7e866a631';
-const coverageSubprovider = new CoverageSubprovider(artifactsPath, contractsPath, networkId, defaultFromAddress);
-
-provider.addProvider(coverageSubprovider);
```
-After your test suite is complete (e.g global `after` hook), you'll need to call:
+or
-```typescript
-await coverageSubprovider.writeCoverageAsync();
+```javascript
+var CoverageSubprovider = require('@0xproject/sol-cov').CoverageSubprovider;
```
-This will create a `coverage.json` file in the `coverage` directory. This file has an [Istanbul format](https://github.com/gotwarlost/istanbul/blob/master/coverage.json.md) - so you can use any of the existing Instanbul reporters.
-
## Contributing
We strongly encourage the community to help us make improvements. To report bugs within this package, please create an issue in this repository.