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.

Test passes when Assert.fail is called and on other assertions that should fail.

See original GitHub issue
  • [ x ] I’ve asked for help in the Truffle Gitter before filing this issue.

Issue

Truffle tests do not fail when I call Assert.fail("this should fail");

Steps to Reproduce

Write a test that calls Assert.fail(“this should fail”), and it won’t fail.

Expected Behavior

I expect the test to fail.

Actual Results

The test runs and passes

Environment

  • Operating System: Max OS X Catalina
  • Ethereum client: Truffle 5.1.11 default (ganache?)
  • Truffle version (truffle version): v5.1.11
  • node version (node --version): v10.16.3
  • npm version (npm --version): 6.13.4

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
haltman-atcommented, Sep 21, 2021

@SidSethi Could you file a new issue, with more information, for the problem you’re encountering? Thanks!

1reaction
SidSethicommented, Sep 21, 2021

[solved - kind of]

Am still seeing this issue with: truffle version 5.4.11 node version 14.17.3 solc version 0.5.17 ganache-cli version 6.12.2

Do i need to do something else to get the above fix https://github.com/trufflesuite/truffle/pull/2826?


turns out this was actually an out of gas error on a transaction, but for whatever reason truffle displays it as Ambiguous event, possible interpretations 🤷‍♂️

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cypress assertion fails but test passes - Stack Overflow
One of the tests passes and the other fails when assertions are basically the same. Confused about how cypress handles async/promises. Why does ......
Read more >
Assert.Fail - NUnit Docs
Fail. The Assert.Fail method provides you with the ability to generate a failure based on tests that are not encapsulated by the other...
Read more >
Expected Failures | Apple Developer Documentation
If any assertions fail in a test after you call XCTExpectFailure , Xcode marks the test as an expected failure instead of a...
Read more >
Using Fail Assertion in JUnit | Baeldung
When writing unit tests, we can use fail to explicitly create a failure under desired testing conditions.
Read more >
TestNG showing as test passed even if assertion fails
However, if your test throws an exception, whether it is AssertionError or other exception, the test execution framework will consider your test ......
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