elm-explorations / elm-explorations/test

Show the stack trace in case of caught exceptions

Open
#169 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Elm
Stars
244
Forks
40
Avg merge
1d 23h
Merged PRs (30d)
2

Description

For the backstory, refer to https://github.com/mpizenberg/elm-test-rs/issues/90#issuecomment-877514064

TL;DR: I had a faulty Generator in my code, but this message didn't help me much:

![](https://user-images.githubusercontent.com/149425/125143458-21a8a880-e11b-11eb-80f4-7ada6f0cb528.png)

It was only after I hacked enough tooling to get to the stack trace that I understood the root cause:

```
RangeError: Maximum call stack size exceeded
at Function.f (/Users/martinjaniczek/Localhost/lamdera/nu-ashworld/elm-stuff/tests-0.19.1/js/Runner.elm.js:2978:11)
at A2 (/Users/martinjaniczek/Localhost/lamdera/nu-ashworld/elm-stuff/tests-0.19.1/js/Runner.elm.js:57:28)
at Function.f (/Users/martinjaniczek/Localhost/lamdera/nu-ashworld/elm-stuff/tests-0.19.1/js/Runner.elm.js:4681:4)
at A2 (/Users/martinjaniczek/Localhost/lamdera/nu-ashworld/elm-stuff/tests-0.19.1/js/Runner.elm.js:57:28)
at Function.f (/Users/martinjaniczek/Localhost/lamdera/nu-ashworld/elm-stuff/tests-0.19.1/js/Runner.elm.js:4851:25)
at A3 (/Users/martinjaniczek/Localhost/lamdera/nu-ashworld/elm-stuff/tests-0.19.1/js/Runner.elm.js:60:28)
at shotAndChance (/Users/martinjaniczek/Localhost/lamdera/nu-ashworld/elm-stuff/tests-0.19.1/js/Runner.elm.js:7583:18)
at /Users/martinjaniczek/Localhost/lamdera/nu-ashworld/elm-stuff/tests-0.19.1/js/Runner.elm.js:2908:10
at /Users/martinjaniczek/Localhost/lamdera/nu-ashworld/elm-stuff/tests-0.19.1/js/Runner.elm.js:16:54
at Function.f (/Users/martinjaniczek/Localhost/lamdera/nu-ashworld/elm-stuff/tests-0.19.1/js/Runner.elm.js:2985:7)
```

Note the `shotAndChance` in the middle of the stack trace - that's my function.

I think it would be benefitial if [`_Test_runThunk`](https://github.com/elm-explorations/test/blob/74076ea9869d1ac70c8c7f674c87946784911506/src/Elm/Kernel/Test.js#L16) also reported the stack trace alongside the message itself, and [`Test.Runner.run`](https://github.com/elm-explorations/test/blob/74076ea9869d1ac70c8c7f674c87946784911506/src/Test/Runner.elm#L140-L141) showed that stack trace.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.