Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
fc31151
Initial draft: 0.7.0
cgewecke Jul 23, 2019
3802cff
Update assembly unit tests
cgewecke Jul 23, 2019
713f4cb
Update assert tests
cgewecke Jul 23, 2019
bac42a1
Update comment tests
cgewecke Jul 23, 2019
2cf6dd6
Move ternary logic & tests into lib/ternary folder
cgewecke Jul 23, 2019
40fbe92
Update function & expression tests
cgewecke Jul 24, 2019
9ca4ae2
Update loops tests
cgewecke Jul 24, 2019
6604b06
Update returns tests (move to generic expressions)
cgewecke Jul 24, 2019
768908b
Update statements tests
cgewecke Jul 24, 2019
b312af0
Initial app test cleanup
cgewecke Jul 24, 2019
79b2fa6
Remove ganache-core / misc cleanup
cgewecke Jul 24, 2019
501ad9a
Rebase fixes
cgewecke Jul 24, 2019
98d9b39
Suspend nightly job (fix circleci)
cgewecke Jul 24, 2019
5a7587b
Truffle plugin draft
cgewecke Jul 25, 2019
dc3edfa
Edits
cgewecke Aug 3, 2019
e52a3ab
More test sources reorg and truffle mock utilities cleanup
cgewecke Aug 10, 2019
c8de349
Working truffle plugin draft w/ integration tests
cgewecke Aug 13, 2019
d9353b6
Fix circle/ci
cgewecke Aug 13, 2019
ec231a2
Instrument with injected function calls (#381)
cgewecke Sep 6, 2019
7bc952c
Add index.js stub
cgewecke Sep 6, 2019
1d093e9
Stop injecting coverage hash fn definition in interfaces (#383)
cgewecke Sep 6, 2019
7d1e6ac
Handle truffle provider config restrictions & process killing
cgewecke Sep 6, 2019
4d5a4e2
Add tests and fixtures for full project scenarios (#385)
cgewecke Sep 9, 2019
8c7b2f7
Create separate contract & artifact temp folders at root (#386)
cgewecke Sep 9, 2019
18df4dd
Show test output in CI
cgewecke Sep 9, 2019
6bd3bcd
Add --file command option (for js test subsets) (#387)
cgewecke Sep 9, 2019
c0f38a5
Istanbul reporter (#388)
kandrianov Sep 9, 2019
c0c554a
Add UI reporter class (#389)
cgewecke Sep 9, 2019
07ca4d3
Add --config and --help command options (#390)
cgewecke Sep 10, 2019
ce6a524
Attach to non-fork ganache vm (#391)
cgewecke Sep 10, 2019
39a4481
Initial README edit
cgewecke Sep 10, 2019
3ce4c05
Add --version cli flag
cgewecke Sep 10, 2019
f2d5fe1
More README edits
cgewecke Sep 10, 2019
e75a631
Even more edits
cgewecke Sep 10, 2019
df1c7b3
Re-enable e2e zeppelin & metacoin (#396)
cgewecke Sep 13, 2019
bad4fd0
Handle native solidity tests / add test logger fixtures (#398)
cgewecke Sep 14, 2019
7bce214
Route all errors through reporter (#399)
cgewecke Sep 15, 2019
35e6631
Reorganize and cleanup truffle integration tests (#400)
cgewecke Sep 15, 2019
503c300
Add mocha options to solcoverjs (#401)
cgewecke Sep 15, 2019
556d2d2
Use ganache server (instead of provider) (#402)
cgewecke Sep 16, 2019
ee72e8d
Validate solcoverjs with json schema (#403)
cgewecke Sep 19, 2019
cd7fae0
Add EADDRINUSE test (#404)
cgewecke Sep 19, 2019
6bf6b1a
Add warnings for deprecated shell commands (#405)
cgewecke Sep 19, 2019
efc321e
Refactor instrument method (#406)
cgewecke Sep 20, 2019
79b6443
Pre-empt EADDRINUSE and show useful error. (#407)
cgewecke Sep 20, 2019
438b2fe
Add onServerReady, onTestsComplete, onIstanbulComplete Hooks (#408)
cgewecke Sep 20, 2019
1c8701e
Improve coverage (#409)
cgewecke Sep 20, 2019
0795af6
chore(lib/ui): make URL https:// prefixed (#410)
yxliang01 Sep 20, 2019
b66dcd4
Add yxliang01 to contributors list
cgewecke Sep 20, 2019
baa6e85
Make gasLimit lower than gasLimitString
cgewecke Sep 22, 2019
39ed983
README fixes for options tables (#412)
cgewecke Sep 22, 2019
4e24385
Update package version to 0.7.0-beta.1
cgewecke Sep 22, 2019
bfe63f4
Add @beta to installation instructions
cgewecke Sep 22, 2019
8a438e0
Fix zeppelin CI run
cgewecke Sep 22, 2019
dc618ba
Fix ganache options usage note in README
cgewecke Sep 22, 2019
2552eba
Add 'onCompileComplete' option (#413)
cgewecke Sep 22, 2019
3421207
Add --temp command flag (#414)
cgewecke Sep 23, 2019
fab8aaa
Update version to 0.7.0-beta.2
cgewecke Sep 23, 2019
00f32f6
Docs for beta release (#415)
cgewecke Sep 25, 2019
64a501b
Merge pull request #372 from sc-forks/truffle-plugin
cgewecke Sep 25, 2019
9b5adeb
Link correctly to workflow hooks
cgewecke Sep 25, 2019
ceeff4d
Link to skipping tests correctly
cgewecke Sep 25, 2019
d359df2
Add usage note about compiler optimization
cgewecke Oct 2, 2019
a43ee65
Clarify compiler optimization warning
cgewecke Oct 2, 2019
99b3b6e
Update buidler / reorg dependencies
cgewecke Oct 12, 2019
0bc67b8
Update test fixtures and plugin utils for Buidler (#422)
cgewecke Oct 13, 2019
5924706
Buidler plugin draft (#426)
cgewecke Oct 17, 2019
9d98f3f
Add error test suites for Buidler plugin (#428)
cgewecke Oct 20, 2019
ce2e6c3
Add tests for buidler cli options (#435)
cgewecke Nov 22, 2019
367ef81
Prepare API for parallelization (#436)
cgewecke Nov 23, 2019
d0f188f
Add autoLauchServer option / update config validator (#437)
cgewecke Nov 23, 2019
404c73d
Add simple E2E for Buidler (#438)
cgewecke Nov 24, 2019
33b33f9
Moloch E2E (#439)
cgewecke Nov 25, 2019
4f73e15
Add buidler config and run info (#440)
cgewecke Nov 25, 2019
97de9c6
Add builder-ethers test to CI (#441)
cgewecke Nov 27, 2019
653fc51
Stop camel-casing testfiles flag (#443)
cgewecke Nov 28, 2019
f87c274
Rename the dist folder 'plugins' (#444)
cgewecke Nov 28, 2019
3612a81
Make api require-able, expose plugin utils (#445)
cgewecke Nov 29, 2019
f2cdb63
Add API documentation (#447)
cgewecke Nov 29, 2019
d9af5ac
Gracefully overwrite eth-gas-reporter (#448)
cgewecke Nov 30, 2019
e25728a
Allow Truffle V4 style solc config (#449)
cgewecke Nov 30, 2019
40c7ce3
Add imports only test, fix instrumenter (#450)
cgewecke Nov 30, 2019
f7603ac
Use recursive-readdir to resolve test files (#451)
cgewecke Nov 30, 2019
c1d9ea1
Improve API docs overview (#452)
cgewecke Nov 30, 2019
28ab3d2
More API docs cleanup
cgewecke Nov 30, 2019
212c88f
Merge pull request #421 from sc-forks/buidler-plugin
cgewecke Nov 30, 2019
1ea44ea
Fix broken import test using Truffle 5.1.2 (#454)
cgewecke Dec 3, 2019
1b47ecf
Use consistent naming in examples
cgewecke Dec 5, 2019
4567465
Add buidler readme (#456)
cgewecke Dec 16, 2019
ce77d3b
Fix saving on Windows OS (#459)
cgewecke Dec 20, 2019
fd0735a
Merge branch 'master' into beta
cgewecke Dec 20, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 39 additions & 31 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
version: 2.0
# Necessary for running in machine mode, which is necessary to execute the
# Zeppelin and MetaCoin E2E scripts
version: 2.1

orbs:
win: circleci/[email protected]

# Necessary for running in machine mode,
# which is necessary to execute the E2E scripts
step_install_nvm: &step_install_nvm
run:
name: "Install nvm for machine"
Expand All @@ -12,41 +16,37 @@ step_install_nvm: &step_install_nvm
nvm alias default v8.15.0
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV

jobs:
unit-test:
docker:
- image: circleci/node:8.15.0
machine: true
steps:
- checkout
- <<: *step_install_nvm
- run:
name: Delete any old node_modules
command: |
rm -rf node_modules/
- run:
name: Install yarn
command: |
npm install -g yarn
- run:
name: Install truffle (globally)
command: |
npm install -g truffle
- run:
name: Install dependencies
command: |
yarn
- run:
name: Run tests
command: |
npm run test-cov
npm run test:ci
- run:
name: Upload coverage
command: |
bash <(curl -s https://codecov.io/bash)

# This works but takes a while....
e2e-colony:
docker:
- image: circleci/node:10.12-stretch
working_directory: ~/colonyNetwork
steps:
- checkout
- run:
name: ColonyNetwork E2E
command: |
./scripts/run-colony.sh

e2e-zeppelin:
machine: true
steps:
Expand All @@ -56,7 +56,6 @@ jobs:
name: Zeppelin E2E
command: |
./scripts/run-zeppelin.sh

e2e-metacoin:
machine: true
steps:
Expand All @@ -66,21 +65,30 @@ jobs:
name: MetaCoin E2E
command: |
./scripts/run-metacoin.sh
e2e-metacoin-windows:
executor: win/default
steps:
- checkout
- run: dotnet tool install --global PowerShell
- run:
name: Windows Metacoin E2E
command: |
bash ./scripts/run-metacoin.sh
e2e-buidler:
machine: true
steps:
- checkout
- <<: *step_install_nvm
- run:
name: Buidler E2E
command: |
./scripts/run-buidler.sh
workflows:
version: 2
build:
jobs:
- unit-test
- e2e-zeppelin
- e2e-metacoin
nightly:
triggers:
- schedule:
cron: "0 1 * * *" # 1am UTC
filters:
branches:
only:
- master
jobs:
- e2e-zeppelin
#- e2e-colony
- e2e-metacoin-windows
- e2e-buidler
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
allFiredEvents
scTopics
scDebugLog
coverage.json
coverage/
node_modules/
.changelog
.DS_Store
test/artifacts
test/cache
temp
.nyc_output/
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test/
.circleci/
docs/
.nyc_output/
121 changes: 121 additions & 0 deletions BUIDLER_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
[![Gitter chat](https://badges.gitter.im/sc-forks/solidity-coverage.svg)][18]
![npm (tag)](https://img.shields.io/npm/v/solidity-coverage/beta)
[![CircleCI](https://circleci.com/gh/sc-forks/solidity-coverage.svg?style=svg)][20]
[![codecov](https://codecov.io/gh/sc-forks/solidity-coverage/branch/beta/graph/badge.svg)][21]
[![buidler](https://buidler.dev/buidler-plugin-badge.svg?1)][26]

# solidity-coverage

Solidity code coverage plugin for [buidler](http://getbuidler.com).

## What

![coverage example][22]

+ For more details about how it works and potential limitations, see [the accompanying article][16].
+ `solidity-coverage` is also [JoinColony/solcover][17]


## Installation

```bash
$ npm install --save-dev solidity-coverage@beta
```

And add the following to your `buidler.config.js`:

```js
usePlugin("solidity-coverage");
```

## Tasks

This plugin implements a `coverage` task

```bash
npx buidler coverage [options]
```

| Option <img width=200/> | Example <img width=750/>| Description <img width=1000/> |
|--------------|------------------------------------|--------------------------------|
| testfiles | `--testfiles test/file.js` | JS test file(s) to run.|
| solcoverjs | `--solcoverjs ./../.solcover.js` | Relative path from working directory to config. Useful for monorepo packages that share settings. (Path must be "./" prefixed) |
| network | `--network development` | Use network settings defined in the Buidler config |


## Configuration

Options can be specified in a `.solcover.js` config file located in the root directory of your project.

**Project Examples:**

+ Simple: [buidler-metacoin][29]
+ More complex: [MolochDao/moloch][30]

**Config Example:**
```javascript
module.exports = {
skipFiles: ['Routers/EtherRouter.sol']
};
```

| Option <img width=200/>| Type <img width=200/> | Default <img width=1300/> | Description <img width=800/> |
| ------ | ---- | ------- | ----------- |
| silent | *Boolean* | false | Suppress logging output |
| client | *Object* | `require("ganache-core")` | Useful if you need a specific ganache version. |
| providerOptions | *Object* | `{ }` | [ganache-core options][1] |
| skipFiles | *Array* | `['Migrations.sol']` | Array of contracts or folders (with paths expressed relative to the `contracts` directory) that should be skipped when doing instrumentation. |
| istanbulFolder | *String* | `./coverage` | Folder location for Istanbul coverage reports. |
| istanbulReporter | *Array* | `['html', 'lcov', 'text', 'json']` | [Istanbul coverage reporters][2] |
| mocha | *Object* | `{ }` | [Mocha options][3] to merge into existing mocha config. `grep` and `invert` are useful for skipping certain tests under coverage using tags in the test descriptions.|
| onServerReady[<sup>*</sup>][14] | *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. [More...][23] |
| onCompileComplete[<sup>*</sup>][14] | *Function* | | Hook run *after* compilation completes, *before* tests are run. Useful if you have secondary compilation steps or need to modify built artifacts. [More...][23]|
| onTestsComplete[<sup>*</sup>][14] | *Function* | | Hook run *after* the tests complete, *before* Istanbul reports are generated. [More...][23]|
| onIstanbulComplete[<sup>*</sup>][14] | *Function* | | Hook run *after* the Istanbul reports are generated, *before* the ganache server is shut down. Useful if you need to clean resources up. [More...][23]|

[<sup>*</sup> Advanced use][14]

## Usage

+ Coverage runs tests a little more slowly.
+ Coverage launches its own in-process ganache server.
+ You can set [ganache options][1] using the `providerOptions` key in your `.solcover.js` [config][15].
+ Coverage [distorts gas consumption][13]. Tests that check exact gas consumption should be [skipped][24].
+ :warning: Contracts are compiled **without optimization**. Please report unexpected compilation faults to [issue 417][25]

## Documentation

More documentation, including FAQ and information about solidity-coverage's API [is available here][28].


[1]: https://github.com/trufflesuite/ganache-core#options
[2]: https://istanbul.js.org/docs/advanced/alternative-reporters/
[3]: https://mochajs.org/api/mocha
[4]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/faq.md#running-out-of-gas
[5]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/faq.md#running-out-of-memory
[6]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/faq.md#running-out-of-time
[7]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/faq.md#continuous-integration
[8]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/faq.md#notes-on-branch-coverage
[9]: https://sc-forks.github.io/metacoin/
[10]: https://coveralls.io/github/OpenZeppelin/openzeppelin-solidity?branch=master
[11]: https://github.com/sc-forks/solidity-coverage/tree/beta/test/units
[12]: https://github.com/sc-forks/solidity-coverage/issues
[13]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/faq.md#notes-on-gas-distortion
[14]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/advanced.md
[15]: #config-options
[16]: https://blog.colony.io/code-coverage-for-solidity-eecfa88668c2
[17]: https://github.com/JoinColony/solcover
[18]: https://gitter.im/sc-forks/solidity-coverage?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
[19]: https://badge.fury.io/js/solidity-coverage
[20]: https://circleci.com/gh/sc-forks/solidity-coverage
[21]: https://codecov.io/gh/sc-forks/solidity-coverage
[22]: https://cdn-images-1.medium.com/max/800/1*uum8t-31bUaa6dTRVVhj6w.png
[23]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/advanced.md#workflow-hooks
[24]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/advanced.md#skipping-tests
[25]: https://github.com/sc-forks/solidity-coverage/issues/417
[26]: https://buidler.dev/
[27]: https://www.trufflesuite.com/docs
[28]: https://github.com/sc-forks/solidity-coverage/blob/beta/README.md
[29]: https://github.com/sc-forks/buidler-e2e/tree/coverage
[30]: https://github.com/sc-forks/moloch

Loading