-
Notifications
You must be signed in to change notification settings - Fork 269
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
Excluding lines of code from coverage testing #190
Comments
@aleybovich Currently there is not. Agree this might be useful in some cases though. |
@cgewecke Is this something you are planning to do or should I close this issue? |
@aleybovich I think it should stay open - tagging it as a possible enhancement. |
maybe just adopt the existing istanbul interface for ignoring code for coverage ? |
@chapati23 Thanks for that link! |
@cgewecke - are you planning to implement this in the future? It would be a very useful feature for many, I'm sure. For example, many contracts have trivial setters with no logic besides assigning a variable (like changing a dependent contract address) and those could be excluded from unit tests. |
Trivial setters may as well be tested. In my situatian, I have code like
As far as I can tell, there is no way to reach the revert in the |
Any update? |
Love to have this. A use-case is having internal function overrides required by Solidity during multiple inheritances, but not exposed with a public function. |
I have a helper contract that is used just for tests and I want it to be excluded from the coverage results. This thread #17 states that ignoring files can be accomplished "using the /* istanbul ignore . . . */ strategy". I've not been able to exclude the file or specific code using /* istanbul ... */ directives. In the case of a test helper contract, it would be better if the helper contract was excluded from coverage results rather than included and showing as covered (IMO) |
I couldn't get this to work with hardhat/solidity. It the above meaning that it should be achievable this way now, or a suggestion of a way it could be implemented? |
Would like this for stuff like // The following functions are overrides required by Solidity.
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal override(ERC1155, ERC1155Supply) {
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC1155, AccessControl)
returns (bool)
{
return super.supportsInterface(interfaceId);
} |
I need this too! |
Any updates on this ? |
+1, would be very useful. |
I need this too |
Is there a way to exclude some solidity code from coverage testing, like its done in JS with istanbul directives in comments?
The text was updated successfully, but these errors were encountered: