question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add 'shouldFailWithMessage' test helper

See original GitHub issue

🧐 Motivation Exactly as described in issue’s title 😃.

📝 Details First of all, thanks for prividing this awesome framework. It makes creating secure smart contracts actually possible!

I’ve been importing functions from openzeppelin-solidity/tests/helpers to use in my own tests for a couple of weeks. They work perfectly so there’s no need to craft my own. Helpers in shouldFail.js have been particularly useful.

Aside, from the canned shouldFail[reverting,throwing,outOfGas] helpers, I think the generic shouldFailWithMessage is flexible and can be used to check for different failure reasons. However, it is not exported by the module.

I suggest exporting it so it could be used externally when neither of reverting, throwing, outOfGas fill the bill.

I will follow up with a one liner PR to introduce that change.

Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
remon-nashidcommented, Dec 4, 2018

Working on exporting test helper + adding unit tests for the helper itself.

0reactions
nventurocommented, Jan 14, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Error Message On Should-Fail #825 - pester/Pester
Ideally you want to start with say 10 tests, add one test and have 10 passing tests and 1 failing test. Then when...
Read more >
How to add custom message to Jest expect?
I would like to add auto-generated message for each email like Email 'f@f.com' should be valid so that it's easy to find failing...
Read more >
testing: better support test helper functions with TB.Helper
We propose to add a new testing.TB method, Helper , which marks the calling function as a test helper. When logging test messages, ......
Read more >
Advanced googletest Topics
This document will show you more assertions as well as how to construct complex failure messages, propagate fatal failures, reuse and speed up...
Read more >
Great compiler messages? Great test failure messages!
The most common path (that should be optimized for) is when the tests pass, so I prefer to only add performance hits when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found