Testy / TestyTs

✔️ Modern TypeScript testing framework.
http://testy.github.io
ISC License
123 stars 8 forks source link

Exceptions are swallowed, and there is no way to see the line number where they are thrown. #79

Closed geon closed 3 years ago

geon commented 3 years ago

It would be nice to know where the errors comes from. Print at least the line number. Possibly the entire stack trace.

Aboisier commented 3 years ago

Thanks for filing this issue!

The logging definitely needs some improvements. I'll try and work on that this week. Any suggestions as to what the output could look like are welcome.

geon commented 3 years ago

Current:

Root
  MeshTestSuite
    √ makeEmptyMesh
    √ addEdge
    √ makeLongEdgeMesh
    x extrudeCornerOnEdge - Bad id: -1
    √ meshGraphIsValid

Better:

Root
  MeshTestSuite
    √ makeEmptyMesh
    √ addEdge
    √ makeLongEdgeMesh
    x extrudeCornerOnEdge - Uncaught Error: Bad id: -1
        at Object.makeTestMesh (Mesh.ts?763c:198)
        at eval (main.ts?34d3:6)
        at Object../src/main.ts (bundle.js:248)
        at __webpack_require__ (bundle.js:488)
        at bundle.js:552
        at bundle.js:555      
    √ meshGraphIsValid

I basically just copied how Chrome prints thrown errors.

geon commented 3 years ago

This also goes for expect.not.toThrow. If it is not expected to throw, the thrown error should probably be shown.

Aboisier commented 3 years ago

That's pretty clean! The stack was making the log a bit crowded, so I made the test suites bold to facilitate scanning.

stack-demo

Aboisier commented 3 years ago

This will be deployed in version ~2.0.0-beta.1~ in a few minutes. Let me know if you get the change to test it!

Edit: Actually, it was deployed in version 2.0.0-beta.2. 2.0.0-beta.1 was deployed by error a while ago apparently. 🤷‍♂️

geon commented 3 years ago

That looks perfect.