Skip to content

Commit d6b86fa

Browse files
authored
Merge pull request #460 from sc-forks/beta
Merge 0.7.x beta to master
2 parents 25fd077 + fd0735a commit d6b86fa

File tree

279 files changed

+505024
-4028
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

279 files changed

+505024
-4028
lines changed

.circleci/config.yml

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
version: 2.0
2-
# Necessary for running in machine mode, which is necessary to execute the
3-
# Zeppelin and MetaCoin E2E scripts
1+
version: 2.1
2+
3+
orbs:
4+
win: circleci/[email protected]
5+
6+
# Necessary for running in machine mode,
7+
# which is necessary to execute the E2E scripts
48
step_install_nvm: &step_install_nvm
59
run:
610
name: "Install nvm for machine"
@@ -12,41 +16,37 @@ step_install_nvm: &step_install_nvm
1216
nvm alias default v8.15.0
1317
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
1418
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV
19+
1520
jobs:
1621
unit-test:
17-
docker:
18-
- image: circleci/node:8.15.0
22+
machine: true
1923
steps:
2024
- checkout
25+
- <<: *step_install_nvm
2126
- run:
2227
name: Delete any old node_modules
2328
command: |
2429
rm -rf node_modules/
30+
- run:
31+
name: Install yarn
32+
command: |
33+
npm install -g yarn
34+
- run:
35+
name: Install truffle (globally)
36+
command: |
37+
npm install -g truffle
2538
- run:
2639
name: Install dependencies
2740
command: |
2841
yarn
2942
- run:
3043
name: Run tests
3144
command: |
32-
npm run test-cov
45+
npm run test:ci
3346
- run:
3447
name: Upload coverage
3548
command: |
3649
bash <(curl -s https://codecov.io/bash)
37-
38-
# This works but takes a while....
39-
e2e-colony:
40-
docker:
41-
- image: circleci/node:10.12-stretch
42-
working_directory: ~/colonyNetwork
43-
steps:
44-
- checkout
45-
- run:
46-
name: ColonyNetwork E2E
47-
command: |
48-
./scripts/run-colony.sh
49-
5050
e2e-zeppelin:
5151
machine: true
5252
steps:
@@ -56,7 +56,6 @@ jobs:
5656
name: Zeppelin E2E
5757
command: |
5858
./scripts/run-zeppelin.sh
59-
6059
e2e-metacoin:
6160
machine: true
6261
steps:
@@ -66,21 +65,30 @@ jobs:
6665
name: MetaCoin E2E
6766
command: |
6867
./scripts/run-metacoin.sh
68+
e2e-metacoin-windows:
69+
executor: win/default
70+
steps:
71+
- checkout
72+
- run: dotnet tool install --global PowerShell
73+
- run:
74+
name: Windows Metacoin E2E
75+
command: |
76+
bash ./scripts/run-metacoin.sh
77+
e2e-buidler:
78+
machine: true
79+
steps:
80+
- checkout
81+
- <<: *step_install_nvm
82+
- run:
83+
name: Buidler E2E
84+
command: |
85+
./scripts/run-buidler.sh
6986
workflows:
7087
version: 2
7188
build:
7289
jobs:
7390
- unit-test
7491
- e2e-zeppelin
7592
- e2e-metacoin
76-
nightly:
77-
triggers:
78-
- schedule:
79-
cron: "0 1 * * *" # 1am UTC
80-
filters:
81-
branches:
82-
only:
83-
- master
84-
jobs:
85-
- e2e-zeppelin
86-
#- e2e-colony
93+
- e2e-metacoin-windows
94+
- e2e-buidler

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
allFiredEvents
2-
scTopics
3-
scDebugLog
41
coverage.json
52
coverage/
63
node_modules/
74
.changelog
85
.DS_Store
6+
test/artifacts
7+
test/cache
8+
temp
9+
.nyc_output/

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
test/
2+
.circleci/
3+
docs/
4+
.nyc_output/

BUIDLER_README.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
[![Gitter chat](https://badges.gitter.im/sc-forks/solidity-coverage.svg)][18]
2+
![npm (tag)](https://img.shields.io/npm/v/solidity-coverage/beta)
3+
[![CircleCI](https://circleci.com/gh/sc-forks/solidity-coverage.svg?style=svg)][20]
4+
[![codecov](https://codecov.io/gh/sc-forks/solidity-coverage/branch/beta/graph/badge.svg)][21]
5+
[![buidler](https://buidler.dev/buidler-plugin-badge.svg?1)][26]
6+
7+
# solidity-coverage
8+
9+
Solidity code coverage plugin for [buidler](http://getbuidler.com).
10+
11+
## What
12+
13+
![coverage example][22]
14+
15+
+ For more details about how it works and potential limitations, see [the accompanying article][16].
16+
+ `solidity-coverage` is also [JoinColony/solcover][17]
17+
18+
19+
## Installation
20+
21+
```bash
22+
$ npm install --save-dev solidity-coverage@beta
23+
```
24+
25+
And add the following to your `buidler.config.js`:
26+
27+
```js
28+
usePlugin("solidity-coverage");
29+
```
30+
31+
## Tasks
32+
33+
This plugin implements a `coverage` task
34+
35+
```bash
36+
npx buidler coverage [options]
37+
```
38+
39+
| Option <img width=200/> | Example <img width=750/>| Description <img width=1000/> |
40+
|--------------|------------------------------------|--------------------------------|
41+
| testfiles | `--testfiles test/file.js` | JS test file(s) to run.|
42+
| solcoverjs | `--solcoverjs ./../.solcover.js` | Relative path from working directory to config. Useful for monorepo packages that share settings. (Path must be "./" prefixed) |
43+
| network | `--network development` | Use network settings defined in the Buidler config |
44+
45+
46+
## Configuration
47+
48+
Options can be specified in a `.solcover.js` config file located in the root directory of your project.
49+
50+
**Project Examples:**
51+
52+
+ Simple: [buidler-metacoin][29]
53+
+ More complex: [MolochDao/moloch][30]
54+
55+
**Config Example:**
56+
```javascript
57+
module.exports = {
58+
skipFiles: ['Routers/EtherRouter.sol']
59+
};
60+
```
61+
62+
| Option <img width=200/>| Type <img width=200/> | Default <img width=1300/> | Description <img width=800/> |
63+
| ------ | ---- | ------- | ----------- |
64+
| silent | *Boolean* | false | Suppress logging output |
65+
| client | *Object* | `require("ganache-core")` | Useful if you need a specific ganache version. |
66+
| providerOptions | *Object* | `{ }` | [ganache-core options][1] |
67+
| skipFiles | *Array* | `['Migrations.sol']` | Array of contracts or folders (with paths expressed relative to the `contracts` directory) that should be skipped when doing instrumentation. |
68+
| istanbulFolder | *String* | `./coverage` | Folder location for Istanbul coverage reports. |
69+
| istanbulReporter | *Array* | `['html', 'lcov', 'text', 'json']` | [Istanbul coverage reporters][2] |
70+
| 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.|
71+
| 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] |
72+
| 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]|
73+
| onTestsComplete[<sup>*</sup>][14] | *Function* | | Hook run *after* the tests complete, *before* Istanbul reports are generated. [More...][23]|
74+
| 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]|
75+
76+
[<sup>*</sup> Advanced use][14]
77+
78+
## Usage
79+
80+
+ Coverage runs tests a little more slowly.
81+
+ Coverage launches its own in-process ganache server.
82+
+ You can set [ganache options][1] using the `providerOptions` key in your `.solcover.js` [config][15].
83+
+ Coverage [distorts gas consumption][13]. Tests that check exact gas consumption should be [skipped][24].
84+
+ :warning: Contracts are compiled **without optimization**. Please report unexpected compilation faults to [issue 417][25]
85+
86+
## Documentation
87+
88+
More documentation, including FAQ and information about solidity-coverage's API [is available here][28].
89+
90+
91+
[1]: https://github.com/trufflesuite/ganache-core#options
92+
[2]: https://istanbul.js.org/docs/advanced/alternative-reporters/
93+
[3]: https://mochajs.org/api/mocha
94+
[4]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/faq.md#running-out-of-gas
95+
[5]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/faq.md#running-out-of-memory
96+
[6]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/faq.md#running-out-of-time
97+
[7]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/faq.md#continuous-integration
98+
[8]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/faq.md#notes-on-branch-coverage
99+
[9]: https://sc-forks.github.io/metacoin/
100+
[10]: https://coveralls.io/github/OpenZeppelin/openzeppelin-solidity?branch=master
101+
[11]: https://github.com/sc-forks/solidity-coverage/tree/beta/test/units
102+
[12]: https://github.com/sc-forks/solidity-coverage/issues
103+
[13]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/faq.md#notes-on-gas-distortion
104+
[14]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/advanced.md
105+
[15]: #config-options
106+
[16]: https://blog.colony.io/code-coverage-for-solidity-eecfa88668c2
107+
[17]: https://github.com/JoinColony/solcover
108+
[18]: https://gitter.im/sc-forks/solidity-coverage?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
109+
[19]: https://badge.fury.io/js/solidity-coverage
110+
[20]: https://circleci.com/gh/sc-forks/solidity-coverage
111+
[21]: https://codecov.io/gh/sc-forks/solidity-coverage
112+
[22]: https://cdn-images-1.medium.com/max/800/1*uum8t-31bUaa6dTRVVhj6w.png
113+
[23]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/advanced.md#workflow-hooks
114+
[24]: https://github.com/sc-forks/solidity-coverage/blob/beta/docs/advanced.md#skipping-tests
115+
[25]: https://github.com/sc-forks/solidity-coverage/issues/417
116+
[26]: https://buidler.dev/
117+
[27]: https://www.trufflesuite.com/docs
118+
[28]: https://github.com/sc-forks/solidity-coverage/blob/beta/README.md
119+
[29]: https://github.com/sc-forks/buidler-e2e/tree/coverage
120+
[30]: https://github.com/sc-forks/moloch
121+

0 commit comments

Comments
 (0)