Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add coverage testing #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fulldecent
Copy link
Contributor

@fulldecent fulldecent commented Dec 15, 2019

This adds an option for coverage testing.

Thank you to Damiano Shehaj for help with this issue.

@fulldecent
Copy link
Contributor Author

Pasting all the notes I have on this in case this sits for a while.


Damiano Shehaj
10:49 AM UTC, 24 Dec 2019
I mean your PR will work if you change this line.
nftleader/specron-example@49293ba

The gist is to let specron framework to test against coverage enabled ganache server of solidity-coverage.

This 'special' ganache server generates coverage report file during the test and it can be published to coveralls.io.

Why coveralls?

TLDR: We recommend Coveralls for the accuracy of its branch reporting.

https://github.com/sc-forks/solidity-coverage/blob/beta/docs/faq.md#continuous-integration

1. Changes for specron-framework

Most of my changes are in this commit
nftleader@ab992d1

a. I added coverage arg to speocron-cli

nftleader@ab992d1#diff-49488acef9dcb4e8eb1de28c2fb5b602R89

b. If coverage arg is set, use new web3 provider.

nftleader@ab992d1#diff-048c4a4e54f5c1dc42069a0da927abdbR65

This provider points to coverage enabled ganache server of solidity-coverage which runs in background.

I used static member variable in order to preserve coverage setting (port number) in the class.

nftleader@ab992d1#diff-048c4a4e54f5c1dc42069a0da927abdbR23

If this is too hacky, we may read speocron prop of package.json and parse process.argv.
Tried to minimize changes to the framework.

2. Changes for specron-example

This example requires specron cli installed globally.
So we need Rush hack to use forked specron framework above.

a. Change folder structure to truffle's standard

b. Install solidity-coverage

Added .solcover.js

Added npm run test-coverage command

3. Next steps

There are interesting pre-release versions of solidity-coverage that supports Buidler Plugin and Coverage API.
https://github.com/sc-forks/solidity-coverage/releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant