mjackson / expect

Write better assertions
MIT License
2.29k stars 117 forks source link

Improve failure messages for toThrow, toNotThrow, and toHaveBeenCalledWith #218

Closed cobyrne closed 7 years ago

cobyrne commented 7 years ago

Hello, I set out to improve the error messages for toHaveBeenCalledWith to be more specific in cases where the spy was never called at all, and to show call arguments in cases where it was called but not with the expected arguments. While trying to test-drive my changes I found the failures for toThrow similarly opaque, so I tried to improve those too.

I tried to be consistent with the existing testing style and message formats. Please let me know if there are changes you'd like to see, either in the general approach or specific implementation.

Thanks, colin

ljharb commented 7 years ago

This package is no longer being updated; v21+ is maintained here