Add t.helper() to skip helper frames in assertion error locations
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 41
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
Problem
When a test fails inside a helper function, the error location points to the helper's internal line, not the test that called it.
Proposal
Add t.helper() — mark a function as a helper so assertion errors point to its caller instead.
local function assert_foo(actual)
t.helper()
t.assert_equals(actual, 'foo')
end
function g.test_foo()
assert_foo('bar')
-- error points HERE, not inside assert_foo
end
Works with nested helpers — all helper frames are skipped.
Inspired by Go's t.Helper().
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how assertion failures determine their source location and how test calls are represented. Add the t.helper() behavior described in the proposal, then verify that marked helper frames are skipped, including nested helpers, while the calling test location is reported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100