Skip to content

feat: more tests options#9

Open
N1xev wants to merge 3 commits into
DaltonSW:mainfrom
N1xev:feat/more-tests-options
Open

feat: more tests options#9
N1xev wants to merge 3 commits into
DaltonSW:mainfrom
N1xev:feat/more-tests-options

Conversation

@N1xev

@N1xev N1xev commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Add coverage reporting and new CLI flags

  • Add --summary-only/-s, --filter/-F, --count/-c, --cover/-C CLI flags
  • Per-package coverage % appended to package totals line
  • Per-function coverage breakdown, wrapped to terminal width, sorted worst-first, color-coded
  • Overall coverage % appended to summary

The count flag is for go test -count=1 that disables cache for re-run the tests freshly <:

The cover flag runs statments coverage only if the tests is with the .go file that holds the statments of these test cases.

and also it uses go test -coverprofile to make temp out file and then appends the function names with percentage of its statments covered (and its colored too per much percent).

Example cover and count:

image

The summary only flag prints only the overall tests results.

Example:

image

The filter flag filters the test names and show it normally under its package.

Example:

image

- Add --summary-only/-s, --filter/-F, --count/-c, --cover/-C CLI flags
- Per-package coverage % appended to package totals line
- Per-function coverage breakdown, wrapped to terminal width, sorted
  worst-first, color-coded
- Overall coverage % appended to summary

the count flag is for `go test -count=1` that disables cache for re-run
the tests freshly <:

the cover flag runs statments coverage only if the tests is with the .go
file that holds the statments of these test cases.
and also it uses `go test -coverprofile` to make temp out file and then
appends the function names with percentage of its statments covered (and
its colored too per much percent).

the summary only flag prints only the overall tests results.

the filter flag filters the test names and show it normally under its
package.
@DaltonSW

Copy link
Copy Markdown
Owner

Overall I think it looks great! Two main things:

  1. Can you add some VHS demo tape files to assets for the new things you added? As well as any necessary tests to some of the example packages if needed to make your demos make sense? I want the example packages to be able to provide examples necessary for all features so they can be used for testing/dev without needing to have stuff in another project to use
  2. I wonder if there's a way to make the coverage output a bit more... organized/readable? I found it a bit confusing reading through your example pictures without something like delimiters or parentheses. I also think it would make sense to order them alphabetically within the colored groups instead of just within same-numbers? Like I was confused why Avg filtered to the very end of the red section since it was still red, but then realized it's because it was at 48%. I don't necessarily wanna suggest a table, or one run per line, since that feels like it could potentially make the output super long, but maybe that's just kinda the price to be paid for the organized output?

- Add gif and explain in readme for cache (-count=1 in normal `go test`)

- Add gif and explain in readme for coverage

- Add gif and explain in readme for filter

- Add gif and explain in readme for summary only output

- Add 1 file_test.go for testing the new coverage flag and for making
  the example gif.
@N1xev

N1xev commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Overall I think it looks great! Two main things:

1. Can you add some VHS demo tape files to `assets` for the new things you added? As well as any necessary tests to some of the example packages if needed to make your demos make sense? I want the example packages to be able to provide examples necessary for all features so they can be used for testing/dev without needing to have stuff in another project to use

2. I wonder if there's a way to make the coverage output a bit more... organized/readable? I found it a bit confusing reading through your example pictures without something like delimiters or parentheses. I also think it would make sense to order them alphabetically within the colored groups instead of _just_ within same-numbers? Like I was confused why `Avg` filtered to the very end of the red section since it was still red, but then realized it's because it was at 48%. I don't necessarily wanna suggest a table, or one run per line, since that feels like it could potentially make the output _super_ long, but maybe that's just kinda the price to be paid for the organized output?

i added the examples and tapes/gifs and updated the readme for this branch.

for the organization idk tbh but this Avg is not average of coverage its from the tests. for now idk if there is a way for making them good enough and organized like within tables because with tables will require too wide terminal emulator width or making it 1 column table for separating red, yellow and green within a table like display.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants