mercredi 30 mars 2016

How to make unit test fail when API of mocked module changed

When I write some javascript unit tests for my code, I mocked a methond of a module with sinon, defined what arguments it expected and what it should return.

someone changed the argument of that method and he forgot to change my code. now my code were broken, but the unit tests still passed because I used the mocked module in the unit tests.

how to make unit tests fail when mocked module changed, so that this issue could be exposed?

Thanks!

Aucun commentaire:

Enregistrer un commentaire