Skip to content

Commit b54b8ed

Browse files
authored
Merge pull request #336 from sc-forks/misc/prerelease
Misc prep for 6.0 release
2 parents f671b72 + c0086dc commit b54b8ed

File tree

8 files changed

+57
-714
lines changed

8 files changed

+57
-714
lines changed

.circleci/config.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ jobs:
1313
name: Install dependencies
1414
command: |
1515
yarn
16-
- run:
17-
name: Get submodules
18-
command: |
19-
git submodule update --init
2016
- run:
2117
name: Run tests
2218
command: |
@@ -42,15 +38,27 @@ jobs:
4238
# command: |
4339
# ./scripts/run-colony.sh
4440

41+
# It would be nice if all this could be a shell script but Circle is
42+
# extremely annoying about
43+
# a) cacheing
44+
# b) sudo
45+
# c) scripts
46+
# d) being in a docker container.
4547
e2e-zeppelin:
4648
docker:
4749
- image: circleci/node:10.12-stretch
4850
steps:
4951
- checkout
50-
- run:
51-
name: OpenZeppelin E2E
52-
command: |
53-
sudo URL=$CIRCLE_REPOSITORY_URL BRANCH=$CIRCLE_BRANCH ./scripts/run-zeppelin.sh
52+
- run: >
53+
sudo rm -rf node_modules &&
54+
PR_PATH=$(echo "$CIRCLE_REPOSITORY_URL#$CIRCLE_BRANCH" | sudo sed 's/git@github.com:/https:\/\/github.com\//') &&
55+
sudo git clone https://github.com/OpenZeppelin/openzeppelin-solidity.git &&
56+
cd openzeppelin-solidity &&
57+
sudo sed -i 's/cat coverage\/lcov.info | npx coveralls/echo "No coveralls"/g' scripts/test.sh &&
58+
sudo yarn &&
59+
sudo yarn remove solidity-coverage --dev &&
60+
sudo yarn add "$PR_PATH" --dev &&
61+
sudo npm run coverage
5462
5563
workflows:
5664
version: 2

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
[![npm version](https://badge.fury.io/js/solidity-coverage.svg)](https://badge.fury.io/js/solidity-coverage)
55
[![CircleCI](https://circleci.com/gh/sc-forks/solidity-coverage.svg?style=svg)](https://circleci.com/gh/sc-forks/solidity-coverage)
66
[![codecov](https://codecov.io/gh/sc-forks/solidity-coverage/branch/master/graph/badge.svg)](https://codecov.io/gh/sc-forks/solidity-coverage)
7-
[![Stories in Ready](https://badge.waffle.io/sc-forks/solidity-coverage.png?label=ready&title=Ready)](https://waffle.io/sc-forks/solidity-coverage?utm_source=badge)
87

98
### Code coverage for Solidity testing
109
![coverage example](https://cdn-images-1.medium.com/max/800/1*uum8t-31bUaa6dTRVVhj6w.png)
@@ -18,46 +17,35 @@ find discrepancies between the coverage report and your suite's behavior, please
1817

1918
### Install
2019
```
21-
$ npm install --save-dev solidity-coverage
20+
$ npm install --save-dev solidity-coverage@beta
2221
```
2322

2423
### Run
2524

26-
#### Option 1
27-
28-
```
29-
$ ./node_modules/.bin/solidity-coverage
30-
```
31-
32-
#### Option 2
33-
3425
```
35-
$ $(npm bin)/solidity-coverage
26+
$ npx solidity-coverage
3627
```
3728

38-
Tests run significantly slower while coverage is being generated. Your contracts are double-compiled
39-
and a 1 to 2 minute delay between the end of the second compilation and the beginning of test execution
40-
is possible if your test suite is large. Large Solidity files can also take a while to instrument.
41-
42-
**Important: breaking change for versions >= `0.5.0`**
43-
+ `solidity-coverage` requires compilation with `solc` >= `0.4.21`. We're prefixing our own
44-
instrumentation events with the `emit` keyword to reduce warnings volume when running the tool.
45-
+ Ternary conditionals (ex: `(x) ? y : z;`) no longer receive branch coverage. There's more info about
46-
why this isn't currently possible at [solidity 3887](https://github.com/ethereum/solidity/issues/3887).
29+
**NB:** for most projects you'll also need to configure a 'coverage' network in
30+
truffle-config.js. See the Network Configuration guide below.
4731

48-
**Important: breaking change for versions >= `0.4.3`**
49-
+ solidity-coverage now expects a globally installed truffle in your environment / on CI. If you
32+
### Usage notes:
33+
+ Requires Solidity pragmas >= `0.5.0`.
34+
+ Tests run more slowly while coverage is being generated.
35+
+ Your contracts will be double-compiled and a delay between compilation and
36+
the beginning of test execution is possible if your contracts are large.
37+
+ solidity-coverage expects a globally installed truffle in your environment / on CI. If you
5038
prefer to control which Truffle version your tests are run with, please see the FAQ for
5139
[running truffle as a local dependency](https://github.com/sc-forks/solidity-coverage/blob/master/docs/faq.md#running-truffle-as-a-local-dependency).
52-
53-
+ Solidity fixtures / mocks / tests stored in the `tests/` directory are no longer supported. If your suite uses native Solidity testing or accesses contracts via mocks stored in `tests/` (a la Zeppelin), coverage will trigger test errors because it's unable to rewrite your contract ABIs appropriately. Mocks should be relocated to the root folder's `contracts` directory. More on why this is necessary at issue [146](https://github.com/sc-forks/solidity-coverage/issues/146)
40+
+ Solidity fixtures / mocks stored in the `tests/` directory are no longer supported. If your suite uses native Solidity testing or accesses contracts via mocks stored in `tests/` (a la Zeppelin), coverage will trigger test errors because it's unable to rewrite your contract ABIs appropriately. Mocks should be relocated to the root folder's `contracts` directory. More on why this is necessary at issue [146](https://github.com/sc-forks/solidity-coverage/issues/146)
5441

5542
### Network Configuration
5643

57-
By default, solidity-coverage generates a stub `truffle.js` that accommodates its special gas needs and
58-
connects to a coverage-enabled fork of the ganache-cli client called **testrpc-sc** on port 8555. This special client ships with `solidity-coverage` - there's nothing extra to download. If your tests will run on truffle's development network
59-
using a standard `truffle.js` and ganache-cli instance, you shouldn't have to do any configuration or launch the coverage client separately. If your tests depend on logic or special options added to `truffle.js` you should declare a coverage
60-
network there following the example below.
44+
By default, solidity-coverage connects to a coverage-enabled fork of the ganache-cli client
45+
called **testrpc-sc** on port 8555. (It ships with `solidity-coverage` -
46+
there's nothing extra to download.)
47+
48+
In `truffle-config.js`, add a coverage network following the example below.
6149

6250
**Example**
6351
```javascript

lib/truffleConfig.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ module.exports = function truffleConfig(port, gasLimit, gasPrice) {
99
gas: ${gasLimit},
1010
gasPrice: ${gasPrice}
1111
}
12-
},
13-
compilers: {
14-
solc: {
15-
version: "0.5.3",
16-
}
1712
}
1813
};`;
1914
};

package.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "solidity-coverage",
3-
"version": "0.6.0-beta.5",
3+
"version": "0.5.12",
44
"description": "",
55
"bin": {
66
"solidity-coverage": "./bin/exec.js"
@@ -10,8 +10,7 @@
1010
},
1111
"scripts": {
1212
"test": "mocha --timeout 60000",
13-
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --timeout 60000 --exit",
14-
"lint": "./node_modules/.bin/eslint --fix ./"
13+
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --timeout 60000 --exit"
1514
},
1615
"homepage": "https://github.com/sc-forks/solidity-coverage",
1716
"repository": {
@@ -26,7 +25,7 @@
2625
"istanbul": "^0.4.5",
2726
"keccakjs": "^0.2.1",
2827
"req-cwd": "^1.0.1",
29-
"shelljs": "^0.7.4",
28+
"shelljs": "https://github.com/sc-forks/shelljs.git",
3029
"sol-explore": "^1.6.2",
3130
"solidity-parser-antlr": "^0.4.1",
3231
"tree-kill": "^1.2.0",
@@ -35,10 +34,6 @@
3534
},
3635
"devDependencies": {
3736
"crypto-js": "^3.1.9-1",
38-
"eslint": "^3.19.0",
39-
"eslint-config-airbnb-base": "^11.0.1",
40-
"eslint-plugin-import": "^2.2.0",
41-
"eslint-plugin-mocha": "^4.8.0",
4237
"ethereumjs-account": "~2.0.4",
4338
"ethereumjs-tx": "^1.2.2",
4439
"ethereumjs-util": "^5.0.1",

scripts/run-zeppelin.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ set -o errexit
88
PR_PATH=$(echo "$URL#$BRANCH" | sed 's/git@github.com:/https:\/\/github.com\//')
99
echo "Installing $PR_PATH"
1010

11+
# Circle caches really agressively?
12+
sudo rm -rf node_modules
1113
sudo git clone https://github.com/OpenZeppelin/openzeppelin-solidity.git
1214
cd openzeppelin-solidity || exit
15+
sudo rm -rf node_modules
1316

1417
# EDITS
1518
# Use testrpc-sc ...

test/zeppelin.js

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)