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

forge coverage doesn't fail on failing tests #4485

Closed
2 tasks done
0xGuybrush opened this issue Mar 6, 2023 · 2 comments
Closed
2 tasks done

forge coverage doesn't fail on failing tests #4485

0xGuybrush opened this issue Mar 6, 2023 · 2 comments
Labels
C-forge Command: forge Cmd-forge-coverage Command: forge coverage T-bug Type: bug

Comments

@0xGuybrush
Copy link

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (28b2ae6 2023-03-06T00:04:30.253422Z)

What command(s) is the bug in?

forge coverage

Operating System

macOS (Apple Silicon)

Describe the bug

Description

Running forge coverage exits with code 0 even on test failures. This may be just a mismatch in my expections, but just used to running similar modes e.g. in JS testing tools where coverage would fail on any test failures.

If it's deliberate that coverage doesn't fail on failing tests (as in fairness the act of producing metric didn't fail), it could be nice to call it out in the Foundry book that it's a command to run coverage only, not to run tests with coverage.

Steps to reproduce:

  • Create a failing test:
function testThatFalseIsTrue() public {
  assertEq(true, false, "This will fail");
}
  • Run forge test — test fails as expected
  • Run forge coverage

Current outcome

  • forge coverage passes and prints coverage metrics. Returns 0 exit code

Expected outcome

  • Highlights same test failures as forge test (or exits non-zero).
@0xGuybrush 0xGuybrush added the T-bug Type: bug label Mar 6, 2023
@gakonst gakonst added this to Foundry Mar 6, 2023
@github-project-automation github-project-automation bot moved this to Todo in Foundry Mar 6, 2023
@mds1 mds1 added C-forge Command: forge Cmd-forge-coverage Command: forge coverage labels Mar 7, 2023
@llllvvuu
Copy link
Contributor

llllvvuu commented Mar 27, 2023

Might this be related to #3900 ?

@0xGuybrush
Copy link
Author

Might this be related to #3900 ?

sorry, you're right — I think it's a duplicate. I did try to search for an open issue, I'm not sure why I didn't see it. WIll close this one. Thanks!

@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge Cmd-forge-coverage Command: forge coverage T-bug Type: bug
Projects
Archived in project
Development

No branches or pull requests

3 participants