lpil / lpil/gleeunit

Include stack trace in failed test info

Open
#47 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Gleam
Stars
49
Forks
38
PR merge metrics
No merged PRs in 30d

Description

I opened an issue on the Gleam repository about a potential inconsistency in how let assert failures are reported ([issue 4703](https://github.com/gleam-lang/gleam/issues/4703#issuecomment-2990200796)). The behavior differs between gleam run and gleam test.

Here’s an example of the output from `gleam test`:

```
test/phone_number_test.gleam
test: cleans_the_number_test
error: Pattern match failed
site: phone_number:9
value: ["2", "2", "3", "4", "5", "6", "7", "8", "9", "0"]
```

And from `gleam run`:

```
runtime error: let assert

Pattern match failed, no pattern matched the value.

unmatched value:
["0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]

stacktrace:
phone_number.-clean/1-fun-0- src\phone_number.gleam:9
```

As I noted in the issue:

> “It seems like `gleam run` is much more explicit—it clearly signals that the developer made a wrong assertion, with a red-colored title and a full stack trace (e.g., src\phone_number.gleam:9). On the other hand, `gleam test` reports the failure more subtly, almost as if everything ran normally.”

Wouldn’t it be a good idea for `gleam test` to adopt a stricter and more visible approach to `let assert` failures—similar to `gleam run`—since these are developer errors that benefit from being highlighted clearly?

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Reproduce the difference using gleam test and gleam run with test/phone_number_test.gleam and src/phone_number.gleam, focusing on the let assert failure at phone_number:9. Trace how each command formats failures and compare the existing test output with the run output; done means failed test information includes a clear stack trace and the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.