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

feat(forge test) option to list summary table only #9307

Open
radeksvarz opened this issue Nov 13, 2024 · 2 comments
Open

feat(forge test) option to list summary table only #9307

radeksvarz opened this issue Nov 13, 2024 · 2 comments
Labels
C-forge Command: forge Cmd-forge-test Command: forge test T-feature Type: feature T-to-discuss Type: requires discussion

Comments

@radeksvarz
Copy link

Component

Forge

Describe the feature you would like

Motivation: Many tests fail when migrating from OZ 4 to OZ 5, esp. when you have hundreds of tests. One needs to see and report on the volume to be fixed.

The forge test --summary --detailed gives a nice overview, but the table is burned within the rest of the output.

I propose to have the flag --summaryonly , which would act similarly to --summary --detailed, but would output only the table and the general stat Encountered a total of xxx failing tests, zzz tests succeeded

Current workaround is:
forge test --summary --detailed | awk '/Test Summary:/,/----╯/'

But that loses coloring.

I assume there might be some other workaround, I welcome any comments on this.

Additional context

No response

@radeksvarz radeksvarz added T-feature Type: feature T-needs-triage Type: this issue needs to be labelled labels Nov 13, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Nov 13, 2024
@zerosnacks
Copy link
Member

Hi @radeksvarz I would like to avoid introducing a new flag here.

Could you expand on the table is burned within the rest of the output?

The idea is that the summary should collect all test output and summarize it in one table like:

Test Summary:

╭--------------+--------+--------+---------+---------------------+----------╮
|  Test Suite  | Passed | Failed | Skipped |      File Path      | Duration |
+===========================================================================+
| CounterTest  |    2   |    0   |    0    | test/Counter.t.sol  | 2.57ms   |
|--------------+--------+--------+---------+---------------------+----------|
| Counter2Test |    2   |    0   |    0    | test/Counter2.t.sol | 2.33ms   |
╰--------------+--------+--------+---------+---------------------+----------╯

@zerosnacks zerosnacks added Cmd-forge-test Command: forge test C-forge Command: forge T-to-discuss Type: requires discussion and removed T-needs-triage Type: this issue needs to be labelled labels Nov 13, 2024
@radeksvarz
Copy link
Author

When you have hundreds of tests the output is:

  • many rows of PASS and FAIL
  • Test Summary table
  • many rows with Failing tests with details

IMHO I fully agree that the case is not worth to introduce the new flag. Chaining the output and cutting should be the way to go.

The only issue there is losing the ANSI color information.

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-test Command: forge test T-feature Type: feature T-to-discuss Type: requires discussion
Projects
Archived in project
Development

No branches or pull requests

2 participants