elm-test icon indicating copy to clipboard operation
elm-test copied to clipboard

Test hitting a Debug.crash should return the test name

Open simonh1000 opened this issue 7 years ago • 2 comments

I am hitting a Debug.crash with some of my tests. In other words I'm reaching a place that I thought was impossible to get to so i'm pretty keen to see what is happening. But I don't get the name of the test that crashed, and I have 380 of them,... Is there something I can do?

Here's the sort of output I'm seeing

 $ elm-test
Success! Compiled 37 modules.                                       
Successfully generated /dev/null
Success! Compiled 1 module.                                         
Successfully generated /home/simon/code/sync/remix/turntable/side-chain/elm-stuff/generated-code/elm-community/elm-test/elmTestOutput.js
/home/simon/code/sync/remix/turntable/side-chain/elm-stuff/generated-code/elm-community/elm-test/elmTestOutput.js:1582
		throw new Error(
		^

Error: Ran into a `Debug.crash` in module `L2.CodegenHelpers`

This was caused by the `case` expression between lines 320 and 338.
One of the branches ended with a crash and the following value got through:

    (True,True)

The message provided by the code author is:

    *****Cannot loop over main binding of an object
    at /home/simon/code/sync/remix/turntable/side-chain/elm-stuff/generated-code/elm-community/elm-test/elmTestOutput.js:1582:9
    at /home/simon/code/sync/remix/turntable/side-chain/elm-stuff/generated-code/elm-community/elm-test/elmTestOutput.js:37799:13
    at Function.func (/home/simon/code/sync/remix/turntable/side-chain/elm-stuff/generated-code/elm-community/elm-test/elmTestOutput.js:37833:5)
    at A6 (/home/simon/code/sync/remix/turntable/side-chain/elm-stuff/generated-code/elm-community/elm-test/elmTestOutput.js:158:11)
    at Function.func (/home/simon/code/sync/remix/turntable/side-chain/elm-stuff/generated-code/elm-community/elm-test/elmTestOutput.js:38099:4)
    at A6 (/home/simon/code/sync/remix/turntable/side-chain/elm-stuff/generated-code/elm-community/elm-test/elmTestOutput.js:158:11)
    at Function.func (/home/simon/code/sync/remix/turntable/side-chain/elm-stuff/generated-code/elm-community/elm-test/elmTestOutput.js:38111:14)
    at A4 (/home/simon/code/sync/remix/turntable/side-chain/elm-stuff/generated-code/elm-community/elm-test/elmTestOutput.js:146:11)
    at /home/simon/code/sync/remix/turntable/side-chain/elm-stuff/generated-code/elm-community/elm-test/elmTestOutput.js:39085:6
    at Function.func (/home/simon/code/sync/remix/turntable/side-chain/elm-stuff/generated-code/elm-community/elm-test/elmTestOutput.js:39088:4)


There was an unexpected runtime exception while running tests


/home/simon/code/sync/remix/turntable/side-chain/elm-stuff/generated-code/elm-community/elm-test/elmTestOutput.js:1582
		throw new Error(
		^

Error: Ran into a `Debug.crash` in module `L2.CodegenHelpers`

This was caused by the `case` expression between lines 320 and 338.
One of the branches ended with a crash and the following value got through:

    (True,True)

The message provided by the code author is:

    *****Cannot loop over main binding of an object
    at /home/simon/code/sync/remix/turntable/side-chain/elm-stuff/generated-code/elm-community/elm-test/elmTestOutput.js:1582:9

simonh1000 avatar Mar 16 '18 17:03 simonh1000

In 0.19 we can (and should, I think!) introduce this feature in this repo.

In the meantime I have an idea for how to do it in node-test-runner.

rtfeldman avatar Mar 16 '18 17:03 rtfeldman

One thing I just found was that I would get the unhelpful error when I ran elm-test alone, but I get the specific test name back when I run elm-test tests/TestFile.elm, i.e. with the full name of a test file

simonh1000 avatar Mar 18 '18 14:03 simonh1000