-
Notifications
You must be signed in to change notification settings - Fork 245
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
Testing improvements #513
Testing improvements #513
Conversation
@@ -37,6 +37,9 @@ const processResult = txReceipt => { | |||
throw new Error(log.args.message) | |||
} | |||
}) | |||
if (mustAssert && !decodedLogs.length) { | |||
throw new Error('No assertions made') | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know if this is necessary, test fwks usually don't throw if there are no assertions, they simply throw in case there was at least one failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes... it is kind of "special" behaviour but for our purposes I think having this check is more robust:
- Tests without explicit assertions made are probably buggy in some way
- This implicitly tests that the test framework is working (decoding
Assert
's events), avoiding an earlier issue where the tests were always just passing regardless of actual test behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, left one minor comment tho.
Adds some improvements to the test suite, as per the Consensys Diligence advisory.