ffMathy / FluffySpoon.JavaScript.Testing.Faking

An NSubstitute port to TypeScript called substitute.js.
MIT License
202 stars 22 forks source link

Improve assertion messages when running expectations #281

Closed notanengineercom closed 7 months ago

notanengineercom commented 8 months ago

Showcases a draft on how to improve the readability and developer experience when evaluating assertions (received didNotReceive). Originated from the suggestion in #140, with this addition, we'd be recording stack traces of where a call was made. I also tried to enrich the assertion failure description with information like what has been called, how and what's expected:

Screenshot 2024-03-10 at 00 43 41

Closes #140 Closes #27 Closes #138

notanengineercom commented 8 months ago

Tests for node.js 12, 14 and 16 fail just because the formatting of stack traces lines are slightly different than in the newer node.js versions (>= 18).

ffMathy commented 8 months ago

Wow, this is an amazing addition! I am currently sick and have been for a week, but hope to contribute at a faster pace soon ❤️

ffMathy commented 8 months ago

Yeah let's just drop support for those older versions of node BTW.

18 and up should be fine.

notanengineercom commented 8 months ago

Thanks 😄 Alright, what do you think about following node.js' release schedule? That would mean (looking at April'24), we'd run the CI tests against versions 18, 20 and 22. Get well soon 🫶🏼

ffMathy commented 8 months ago

Thanks 😄 Alright, what do you think about following node.js' release schedule? That would mean (looking at April'24), we'd run the CI tests against versions 18, 20 and 22. Get well soon 🫶🏼

I love that strategy! Let's do that :heart:

Thank you!

notanengineercom commented 7 months ago

I made some changes to allow a bunch of serialization options:

It just generates a string with a simple tree of the substitution object (not exposing any internals)