Suite Panics have incorrect trace

Open
#771 3 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
go
Domain
testing

Research direction

Start by reading suite.go, especially the panic trace handling around line 61, and reproduce the report with a suite inheriting through an intermediary suite and with multiple panics. Determine how the hard-coded skip values select the reported frame. Done means panic traces identify the actual project location or provide the requested configurable/full-trace behavior.

Written by the indexing model from the issue text.

Description

When a panic occurs I'm seeing the following error:

suite.go:61: test panicked: runtime error: invalid memory address or nil pointer dereference

suite.go does not exist anywhere in my project, I'm not sure where it's coming from. If I have multiple panics they all show this file and line number.

My test suite struct itself inherits from an intermediary test suite which in turn inherits from the testify test suite, I suspect this might be related.

I think the problem here is that testify uses hard coded skip values for generating its trace.

I think there are 2 things that could (should) be done to address this:

  • Allow us to specify a custom skip count
  • Allow us to set a preference that would produce a full trace (not just the last frame)
Dominant language
Go
Stars
26.2k
Forks
1.9k
Avg merge
2d 4h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stretchr/testify

All issues in stretchr/testify

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.