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

Coverage ignore large test #486

Merged
merged 17 commits into from
Jan 22, 2020
Merged

Coverage ignore large test #486

merged 17 commits into from
Jan 22, 2020

Conversation

bh2smith
Copy link
Contributor

@bh2smith bh2smith commented Jan 21, 2020

Based on the solidity-coverage advanced usage guide here

we are able to ignore the tests with the @skip-on-coverage tag included in the test message.

This is directly advised as the proper use from their readme

Coverage distorts gas consumption.
Tests that check exact gas consumption should be skipped.

Note that, in order for the test ignored during coverage to be executed, we have moved it into a separate file and included an additional truffle test for this file. This is not ideal, but does work as expected without executing any tests twice.

@josojo
Copy link
Contributor

josojo commented Jan 21, 2020

I only hope that Travis is also running these tests separately.

I don't think that this is happening, is it? Currently, we are only running coverage tests, as otherwise many tests would be run twice!

@bh2smith
Copy link
Contributor Author

bh2smith commented Jan 21, 2020

I don't think that this is happening, is it? Currently, we are only running coverage tests, as otherwise many tests would be run twice!

I am going to try putting the large test into its own file and running this test independently via

yarn run test ./test/stablex/stablex_large_test.js

.travis.yml Show resolved Hide resolved
Copy link
Contributor

@nlordell nlordell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to only run tests with the @skip-on-coverage for the second step of the test? That way if we add more tests that should be skipped they automatically get picked up?

@bh2smith
Copy link
Contributor Author

Would it be possible to only run tests with the @skip-on-coverage for the second step of the test? That way if we add more tests that should be skipped they automatically get picked up?

This is likely possible, but I will have to dig into the solidity-coverage code to see how they do this...

@bh2smith
Copy link
Contributor Author

@nlordell - I wonder if it would be reasonable to restructure the test folder one for which we run solidity-coverage and the other where we run truffle-test

@nlordell
Copy link
Contributor

I wonder if it would be reasonable to restructure the test folder one for which we run solidity-coverage and the other where we run truffle-test

That could work, don’t know enough about truffle test to tell you if that’s the best way to go though.

Copy link
Contributor

@josojo josojo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice... looks real good.

Now, that we are running the test no longer in the coverage mode, we could also reduce the constant

      const sixPointFiveMillion = 6500000

to 5.5 M

@fleupold
Copy link
Contributor

I like the idea of grepping on @solidity-no-coverage to make sure all tests are run in either mode. However, looks like the grep is not yet supported for regular truffle test: trufflesuite/truffle#2080

@bh2smith
Copy link
Contributor Author

we could also reduce the constant

Will do.

@bh2smith
Copy link
Contributor Author

I like the idea of grepping on @solidity-no-coverage to make sure all tests are run in either mode. However, looks like the grep is not yet supported for regular truffle test: trufflesuite/truffle#2080

How about we land this for now and create an issue for the future (i.e. when this is available in truffle)

@nlordell
Copy link
Contributor

How about we land this for now and create an issue for the future (i.e. when this is available in truffle)

Sure, but then we should probably remove the mocha options in the truffle-config.js or else when I run truffle test locally, it will not run that test.

@bh2smith
Copy link
Contributor Author

bh2smith commented Jan 22, 2020

Sure, but then we should probably remove the mocha options in the truffle-config.js or else when I run truffle test locally, it will not run that test.

Those mocha options are not in the truffle config, they are in the coverage config and they are necessary for our coverage to ignore the gas estimation test. I will update the PR description to summarize the changes introduced here.

@nlordell
Copy link
Contributor

Those mocha options are not in the truffle config, they are in the coverage config and they are necessary for our coverage to ignore the gas estimation test.

Oops! My bad. So running truffle test pulls in these tests?

@bh2smith
Copy link
Contributor Author

So running truffle test pulls in these tests?

truffle test still executes as usual/expected without any change

@bh2smith bh2smith merged commit c6e4ec4 into master Jan 22, 2020
@bh2smith bh2smith deleted the coverage_ignore_large_test branch January 22, 2020 09:52
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.

None yet

4 participants