dimanche 26 mars 2017

Mocha / Chai testing: How can I make it more strict?

Using Mocha and Chai, I have notice many unreliable tests. I would like these ALL to fail. Similar StackOverflow questions are because of Async and not using done(). Even if this was my case, I would surely want it to fail!

I have a typo in what should be exist. It doesnt tell me this unless I make a type in a particular position.

  1. Why do this test not fail?
  2. Is there something I am doing wrong?
  3. How can I make Mocha / Chai more strict?

These all pass!?

expect(component.find('#hero')).to.exest;
expect(component.find('#hero')).to.not.exest;
expect(component.find('#hero')).to.exsdafdsafdsfdsafest;

This doesnt.

expect(component.find('#hero')).BLAHASDF.exest;

TypeError: Cannot read property 'exest' of undefined

Well, thank you Chai for telling me now!

Ok I am being a bit silly, but I can assure you this frustrate me a lot!

Is there some settings, or is there something I am missing, or is there another library that trumps this one?

Aucun commentaire:

Enregistrer un commentaire