From 06f36430f542d96fb23f90a75f75271abdbdbabd Mon Sep 17 00:00:00 2001 From: cgewecke Date: Sat, 21 Sep 2019 18:52:50 -0700 Subject: [PATCH 1/5] edit-1 --- README.md | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index e5c97a05..3f4c045c 100644 --- a/README.md +++ b/README.md @@ -20,38 +20,37 @@ find discrepancies between the coverage report and your suite's behavior, please $ npm install --save-dev solidity-coverage ``` ### Usage notes: -+ For pragma solidity >=0.4.22 <0.6.0 / Petersburg ++ For Truffle V5 + Coverage runs tests a little more slowly. -+ Coverage distorts gas consumption. ++ Coverage distorts gas consumption. Tests that check exact gas consumption should be skipped. + Coverage launches its own in-process ganache instance. You can set [ganache options](https://github.com/trufflesuite/ganache-core#options) via the `providerOptions` key in your `.solcover.js` config file. ### Truffle V5 -Add "solidity-coverage" to your plugins array in `truffle-config.js` +**Add** "solidity-coverage" to your plugins array in `truffle-config.js` ```javascript module.exports = { networks: {...}, plugins: ["solidity-coverage"] } ``` -Run +**Run** ``` truffle run coverage [options] ``` ### Command Options -| Option | Example | Description | -|--------------|--------------------------------|-------------| -| `--file` | `--file="test/registry/*.js"` | Filename or glob describing a subset of JS tests to run. (Globs must be enclosed by quotes.)| -| `--solcoverjs` | `--solcoverjs ./../.solcover.js` | Relative path from working directory to config. Useful for monorepo packages that share settings. (Path must be "./" prefixed) | -| `--useGlobalTruffle` | | Force use of truffle library module from globally installed truffle. (Default: false)| -| `--usePluginTruffle` | | Force use of truffle library module from plugin provided copy (Truffle v5.0.31.) Requires you have locally installed Truffle V5 <= 5.0.30 (Default: false)| -| `--version` | | Version info | -| `--help` | | Usage notes | -|| || +| Option | Example | Description | +|--------------|------------------------------------|--------------------------------| +| file | `--file="test/registry/*.js"` | Filename or glob describing a subset of JS tests to run. (Globs must be enclosed by quotes.)| +| solcoverjs | `--solcoverjs ./../.solcover.js` | Relative path from working directory to config. Useful for monorepo packages that share settings. (Path must be "./" prefixed) | +| useGlobalTruffle | | Force use of truffle library module from globally installed truffle.| +| version | | Version info | +| help | | Usage notes | +|| || ### Config Options @@ -68,15 +67,14 @@ module.exports = { | Option | Type | Default | Description | | ------ | ---- | ------- | ----------- | -| client | *Object* | require("truffle").ganache | Useful if you need a specific ganache version. (usage: `client: require("ganache-core")`)| -| providerOptions | *Object* | {} | ganache-core options (ex: `network_id: 55`). Complete list of options [here](https://github.com/trufflesuite/ganache-core#options). | -| skipFiles | *Array* | `['Migrations.sol']` | Array of contracts or folders (with paths expressed relative to the `contracts` directory) that should be skipped when doing instrumentation. `Migrations.sol` is skipped by default, and does not need to be added to this configuration option if it is used. | -| istanbulReporter | *Array* | ['html', 'lcov', 'text'] | Coverage reporters for Istanbul. Optional reporter replaces the default reporters. | +| client | *Object* | `require("ganache-core")` | Useful if you need a specific ganache version. | +| providerOptions | *Object* | `{}` | [ganache-core options](https://github.com/trufflesuite/ganache-core#options). | +| skipFiles | *Array* | `['Migrations.sol']` | Array of contracts or folders (with paths expressed relative to the `contracts` directory) that should be skipped when doing instrumentation. | +| istanbulReporter | *Array* | `['html', 'lcov', 'text']` | Coverage reporters for Istanbul. Optional reporter replaces the default reporters. | | silent | *Boolean* | false | suppress logging output | -| onServerReady | *Function* | `async (config) => {}` | Function run when server is ready to receive calls, but before the tests execute. Useful if you need to launch the Oraclize/Provable bridge or have preparatory scripts which rely on the server's availability | -| onTestsComplete | *Function* | `async (config) => {}` | Function run immediately after the tests -complete, but before Istanbul reports are generated. | -| onIstanbulComplete | *Function* | `async (config) => {}` | Function run immediately after the Istanbul reports are generated, but before the ganache server is shut down. Useful if you need to clean resources up. | +| onServerReady | *Function* | `async (config) => {}` | Hook run *after* server is launched, *before* the tests execute. Useful if you need to use the Oraclize/Provable bridge or have preparatory scripts which rely on the server's availability | +| onTestsComplete | *Function* | `async (config) => {}` | Hook run *after* the tests complete, *before* Istanbul reports are generated. | +| onIstanbulComplete | *Function* | `async (config) => {}` | Function run *after* the Istanbul reports are generated, *before* the ganache server is shut down. Useful if you need to clean resources up. | From 9926be927f71a3ff391a3134db60a696cae6bb9f Mon Sep 17 00:00:00 2001 From: cgewecke Date: Sat, 21 Sep 2019 19:08:05 -0700 Subject: [PATCH 2/5] edit-2 --- README.md | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 3f4c045c..f630f578 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,9 @@ find discrepancies between the coverage report and your suite's behavior, please $ npm install --save-dev solidity-coverage ``` ### Usage notes: -+ For Truffle V5 + Coverage runs tests a little more slowly. + Coverage distorts gas consumption. Tests that check exact gas consumption should be skipped. -+ Coverage launches its own in-process ganache instance. You can - set [ganache options](https://github.com/trufflesuite/ganache-core#options) via - the `providerOptions` key in your `.solcover.js` config file. ++ Coverage launches its own in-process ganache server. [ganache options](https://github.com/trufflesuite/ganache-core#options) via the `providerOptions` key in your `.solcover.js` config file. ### Truffle V5 @@ -45,12 +42,11 @@ truffle run coverage [options] ### Command Options | Option | Example | Description | |--------------|------------------------------------|--------------------------------| -| file | `--file="test/registry/*.js"` | Filename or glob describing a subset of JS tests to run. (Globs must be enclosed by quotes.)| -| solcoverjs | `--solcoverjs ./../.solcover.js` | Relative path from working directory to config. Useful for monorepo packages that share settings. (Path must be "./" prefixed) | +| file | --file="test/registry/*.js" | Filename or glob describing a subset of JS tests to run. (Globs must be enclosed by quotes.)| +| solcoverjs | --solcoverjs ./../.solcover.js | Relative path from working directory to config. Useful for monorepo packages that share settings. (Path must be "./" prefixed) | | useGlobalTruffle | | Force use of truffle library module from globally installed truffle.| | version | | Version info | | help | | Usage notes | -|| || ### Config Options @@ -67,14 +63,15 @@ module.exports = { | Option | Type | Default | Description | | ------ | ---- | ------- | ----------- | -| client | *Object* | `require("ganache-core")` | Useful if you need a specific ganache version. | -| providerOptions | *Object* | `{}` | [ganache-core options](https://github.com/trufflesuite/ganache-core#options). | -| skipFiles | *Array* | `['Migrations.sol']` | Array of contracts or folders (with paths expressed relative to the `contracts` directory) that should be skipped when doing instrumentation. | -| istanbulReporter | *Array* | `['html', 'lcov', 'text']` | Coverage reporters for Istanbul. Optional reporter replaces the default reporters. | | silent | *Boolean* | false | suppress logging output | -| onServerReady | *Function* | `async (config) => {}` | Hook run *after* server is launched, *before* the tests execute. Useful if you need to use the Oraclize/Provable bridge or have preparatory scripts which rely on the server's availability | -| onTestsComplete | *Function* | `async (config) => {}` | Hook run *after* the tests complete, *before* Istanbul reports are generated. | -| onIstanbulComplete | *Function* | `async (config) => {}` | Function run *after* the Istanbul reports are generated, *before* the ganache server is shut down. Useful if you need to clean resources up. | +| client | *Object* | require("ganache-core") | Useful if you need a specific ganache version. | +| providerOptions | *Object* | `{}` | [ganache-core options](https://github.com/trufflesuite/ganache-core#options). | +| skipFiles | *Array* | ['Migrations.sol'] | Array of contracts or folders (with paths expressed relative to the `contracts` directory) that should be skipped when doing instrumentation. | +| istanbulReporter | *Array* | ['html', 'lcov', 'text'] | [Istanbul coverage reporters](https://istanbul.js.org/docs/advanced/alternative-reporters/). | +| mocha | *Object* | `{ }` | [Mocha options](https://mochajs.org/api/mocha) to merge into existing mocha config. `grep` and `invert` are useful for skipping certain tests under coverage using tags in the test descriptions.| +| onServerReady | *Function* | | Hook run *after* server is launched, *before* the tests execute. Useful if you need to use the Oraclize/Provable bridge or have preparatory scripts which rely on the server's availability | +| onTestsComplete | *Function* | | Hook run *after* the tests complete, *before* Istanbul reports are generated. | +| onIstanbulComplete | *Function* | | Function run *after* the Istanbul reports are generated, *before* the ganache server is shut down. Useful if you need to clean resources up. | From 30e98aecdff9a9a53cf2246f8ca0a2176e57648d Mon Sep 17 00:00:00 2001 From: cgewecke Date: Sat, 21 Sep 2019 19:33:38 -0700 Subject: [PATCH 3/5] edit-3 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f630f578..9cfcf9bf 100644 --- a/README.md +++ b/README.md @@ -40,10 +40,10 @@ truffle run coverage [options] ### Command Options -| Option | Example | Description | +| Option | Example | Description | |--------------|------------------------------------|--------------------------------| -| file | --file="test/registry/*.js" | Filename or glob describing a subset of JS tests to run. (Globs must be enclosed by quotes.)| -| solcoverjs | --solcoverjs ./../.solcover.js | Relative path from working directory to config. Useful for monorepo packages that share settings. (Path must be "./" prefixed) | +| file | `--file="test/registry/*.js"` | Filename or glob describing a subset of JS tests to run. (Globs must be enclosed by quotes.)| +| solcoverjs | `--solcoverjs ./../.solcover.js` | Relative path from working directory to config. Useful for monorepo packages that share settings. (Path must be "./" prefixed) | | useGlobalTruffle | | Force use of truffle library module from globally installed truffle.| | version | | Version info | | help | | Usage notes | From fa8954f7527ecc0884c60828e735dfd9f716361e Mon Sep 17 00:00:00 2001 From: cgewecke Date: Sat, 21 Sep 2019 19:41:17 -0700 Subject: [PATCH 4/5] edit-4 --- README.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9cfcf9bf..765faa75 100644 --- a/README.md +++ b/README.md @@ -40,11 +40,10 @@ truffle run coverage [options] ### Command Options -| Option | Example | Description | +| Option | Example | Description | |--------------|------------------------------------|--------------------------------| | file | `--file="test/registry/*.js"` | Filename or glob describing a subset of JS tests to run. (Globs must be enclosed by quotes.)| | solcoverjs | `--solcoverjs ./../.solcover.js` | Relative path from working directory to config. Useful for monorepo packages that share settings. (Path must be "./" prefixed) | -| useGlobalTruffle | | Force use of truffle library module from globally installed truffle.| | version | | Version info | | help | | Usage notes | @@ -61,15 +60,15 @@ module.exports = { ``` -| Option | Type | Default | Description | +| Option | Type | Default | Description | | ------ | ---- | ------- | ----------- | | silent | *Boolean* | false | suppress logging output | -| client | *Object* | require("ganache-core") | Useful if you need a specific ganache version. | -| providerOptions | *Object* | `{}` | [ganache-core options](https://github.com/trufflesuite/ganache-core#options). | +| client | *Object* | `require("ganache-core")` | Useful if you need a specific ganache version. | +| providerOptions | *Object* | `{ }` | [ganache-core options](https://github.com/trufflesuite/ganache-core#options) | | skipFiles | *Array* | ['Migrations.sol'] | Array of contracts or folders (with paths expressed relative to the `contracts` directory) that should be skipped when doing instrumentation. | -| istanbulReporter | *Array* | ['html', 'lcov', 'text'] | [Istanbul coverage reporters](https://istanbul.js.org/docs/advanced/alternative-reporters/). | +| istanbulReporter | *Array* | `['html', 'lcov', 'text']` | [Istanbul coverage reporters](https://istanbul.js.org/docs/advanced/alternative-reporters/) | | mocha | *Object* | `{ }` | [Mocha options](https://mochajs.org/api/mocha) to merge into existing mocha config. `grep` and `invert` are useful for skipping certain tests under coverage using tags in the test descriptions.| -| onServerReady | *Function* | | Hook run *after* server is launched, *before* the tests execute. Useful if you need to use the Oraclize/Provable bridge or have preparatory scripts which rely on the server's availability | +| onServerReady | *Function* | | Hook run *after* server is launched, *before* the tests execute. Useful if you need to use the Oraclize bridge or have setup scripts which rely on the server's availability | | onTestsComplete | *Function* | | Hook run *after* the tests complete, *before* Istanbul reports are generated. | | onIstanbulComplete | *Function* | | Function run *after* the Istanbul reports are generated, *before* the ganache server is shut down. Useful if you need to clean resources up. | From 27fc54ee34b9f2e0bef5a2ff1ffc93ec9d70eff9 Mon Sep 17 00:00:00 2001 From: cgewecke Date: Sat, 21 Sep 2019 19:43:52 -0700 Subject: [PATCH 5/5] edit 5 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 765faa75..a3b5412b 100644 --- a/README.md +++ b/README.md @@ -62,15 +62,15 @@ module.exports = { | Option | Type | Default | Description | | ------ | ---- | ------- | ----------- | -| silent | *Boolean* | false | suppress logging output | +| silent | *Boolean* | false | Suppress logging output | | client | *Object* | `require("ganache-core")` | Useful if you need a specific ganache version. | | providerOptions | *Object* | `{ }` | [ganache-core options](https://github.com/trufflesuite/ganache-core#options) | -| skipFiles | *Array* | ['Migrations.sol'] | Array of contracts or folders (with paths expressed relative to the `contracts` directory) that should be skipped when doing instrumentation. | +| skipFiles | *Array* | `['Migrations.sol']` | Array of contracts or folders (with paths expressed relative to the `contracts` directory) that should be skipped when doing instrumentation. | | istanbulReporter | *Array* | `['html', 'lcov', 'text']` | [Istanbul coverage reporters](https://istanbul.js.org/docs/advanced/alternative-reporters/) | | mocha | *Object* | `{ }` | [Mocha options](https://mochajs.org/api/mocha) to merge into existing mocha config. `grep` and `invert` are useful for skipping certain tests under coverage using tags in the test descriptions.| | onServerReady | *Function* | | Hook run *after* server is launched, *before* the tests execute. Useful if you need to use the Oraclize bridge or have setup scripts which rely on the server's availability | | onTestsComplete | *Function* | | Hook run *after* the tests complete, *before* Istanbul reports are generated. | -| onIstanbulComplete | *Function* | | Function run *after* the Istanbul reports are generated, *before* the ganache server is shut down. Useful if you need to clean resources up. | +| onIstanbulComplete | *Function* | | Hook run *after* the Istanbul reports are generated, *before* the ganache server is shut down. Useful if you need to clean resources up. |