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(cmd/gno): move test output within gno code #1594

Merged
merged 4 commits into from
Jan 31, 2024

Conversation

thehowl
Copy link
Member

@thehowl thehowl commented Jan 26, 2024

Once again, welcome to "I was annoyed by a small thing that I wanted to do a 10 minute fix for and ended up on a refactoring detour".

This PR moves the output of the gno test function to happen within the gno code. This solves a number of issues:

  • filtered tests are no longer printed to the console with --- FILT (my original 10-minute fix)
  • test output is no longer buffered
  • success of subtests is reported correctly
  • run/success report of subtests goes to stderr instead of stdout
  • --- FAIL is not printed for every time a Fail function is called (ie. only once)
  • as a bonus, SkipNow and FailNow actually work, so now you can Skip and Fatal your way out of test functions.

Fixes #665

@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label Jan 26, 2024
Copy link

codecov bot commented Jan 26, 2024

Codecov Report

Attention: 16 lines in your changes are missing coverage. Please review.

Comparison is base (b619351) 55.80% compared to head (0c6a070) 56.13%.
Report is 1 commits behind head on master.

Files Patch % Lines
gnovm/stdlibs/native.go 0.00% 9 Missing ⚠️
gnovm/stdlibs/testing/testing.go 0.00% 3 Missing ⚠️
gnovm/cmd/gno/test.go 33.33% 2 Missing ⚠️
gnovm/pkg/gnolang/machine.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1594      +/-   ##
==========================================
+ Coverage   55.80%   56.13%   +0.33%     
==========================================
  Files         436      438       +2     
  Lines       66168    66163       -5     
==========================================
+ Hits        36922    37143     +221     
+ Misses      26356    26127     -229     
- Partials     2890     2893       +3     
Flag Coverage Δ
go-1.21.x ∅ <ø> (∅)
misc ∅ <ø> (∅)
misc-_test.genstd ∅ <ø> (∅)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@thehowl thehowl changed the title feat(cmd/gno): move test output within gno code feat(cmd/gno): move test output within gno code Jan 26, 2024
@thehowl
Copy link
Member Author

thehowl commented Jan 26, 2024

before/after clumsy asciicast:

asciicast

Copy link
Member

@gfanton gfanton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍

@thehowl thehowl merged commit 12b4b45 into master Jan 31, 2024
190 of 191 checks passed
@thehowl thehowl deleted the dev/morgan/gno-test-skip branch January 31, 2024 12:42
leohhhn pushed a commit to leohhhn/gno that referenced this pull request Feb 2, 2024
Once again, welcome to "I was annoyed by a small thing that I wanted to
do a 10 minute fix for and ended up on a refactoring detour".

This PR moves the output of the `gno test` function to happen within the
gno code. This solves a number of issues:

- filtered tests are no longer printed to the console with `--- FILT`
(my original 10-minute fix)
- test output is no longer buffered
- success of subtests is reported correctly
- run/success report of subtests goes to stderr instead of stdout
- `--- FAIL` is not printed for every time a Fail function is called
(ie. only once)
- as a bonus, `SkipNow` and `FailNow` actually work, so now you can Skip
and Fatal your way out of test functions.

Fixes gnolang#665
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: Done
Status: No status
Archived in project
Development

Successfully merging this pull request may close these issues.

improve gno test output for errors
4 participants