Skip to content

Commit

Permalink
fix: improve error message output in integration tests (#1349)
Browse files Browse the repository at this point in the history
This PR improves error output in integration tests by using more verbose
format.

`gnokey` will now display the full stack trace log, including the
underlying error, when an error occurs, instead of only presenting the
top-level error.

This enhancement will assist in better debugging what's happening
without the need to delve directly into gnoland logs.

<!-- please provide a detailed description of the changes made in this
pull request. -->

<details><summary>Contributors' checklist...</summary>

- [ ] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [ ] Updated the official documentation or not needed
- [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [ ] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>

---------

Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
  • Loading branch information
gfanton authored Nov 16, 2023
1 parent 0c68394 commit 1126d9f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gno.land/pkg/integration/testing_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func getTestingLogger(env *testscript.Env, logname string) (log.Logger, error) {

func tsValidateError(ts *testscript.TestScript, cmd string, neg bool, err error) {
if err != nil {
fmt.Fprintf(ts.Stderr(), "%q error: %v\n", cmd, err)
fmt.Fprintf(ts.Stderr(), "%q error: %+v\n", cmd, err)
if !neg {
ts.Fatalf("unexpected %q command failure: %s", cmd, err)
}
Expand Down
2 changes: 1 addition & 1 deletion gnovm/pkg/integration/gno.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func SetupGno(p *testscript.Params, buildDir string) error {
p.Cmds["gno"] = func(ts *testscript.TestScript, neg bool, args []string) {
err := ts.Exec(gnoBin, args...)
if err != nil {
ts.Logf("gno command error: %v", err)
ts.Logf("gno command error: %+v", err)
}

commandSucceeded := (err == nil)
Expand Down

0 comments on commit 1126d9f

Please sign in to comment.