LarsDenBakker / web-test-runner

This package has moved to: https://github.com/modernweb-dev/web/tree/master/packages/test-runner
6 stars 1 forks source link

Create clickable links per failed test #26

Closed LarsDenBakker closed 4 years ago

LarsDenBakker commented 4 years ago

Terminal links can have line numbers to jump directly to a failed test line number. We need to see if we think this is useful, or if it creates too much spam.

LarsDenBakker commented 4 years ago

This will require passing around test line numbers. We need to check if mocha has this information in the browser.

daKmoR commented 4 years ago

that actually already works 🎉

it's a chai feature and always worked 😅

Failed tests look like this

demo/test/pass-1.test.js
  test 2
    AssertionError: expected 1 to be a string
        at Context.<anonymous> (demo/test/pass-1.test.js:11:19)

you can click on demo/test/pass-1.test.js:11:19 and it will open the exact location which assertion failed 🤯

How could I have not known 😱 😱 😱 😱

daKmoR commented 4 years ago

ok we want to have it more obvious... something like this

demo/test/fail-object-diff.test.js
  object diff
    Go To Failed Assertion: demo/test/fail-object-diff.test.js:20:11
    Open Test in Browser: http://localhost/...
    expected { a: '1', b: '2', c: '3' } to equal { a: '1', b: '4', c: '3' }
    + expected - actual
     {
       "a": "1"
    -  "b": "2"
    +  "b": "4"
       "c": "3"
     }
LarsDenBakker commented 4 years ago

I implemented an initial version of this, we can track improving it in https://github.com/LarsDenBakker/web-test-runner/issues/25