This seems to be such an obvious bug that I feel like I'm missing something but I was following the typical "red-green-refactor" cycle of TDD and stumbled across a scenario where expect(undefined).to.be.defined was allowing a test to pass when used with Mocha. I've got a repo at https://github.com/mchandleraz/chai-wat that shows the issue.
I would expect a function that does not return anything to cause the 2nd test to fail (as the 3rd test does). Instead, only the 3rd test in my repo fails.
Have I found a bug, or is this expected?
Thanks!
Up until ES6 proxies, there was no way for Chai or Mocha to know that a non-existent property such as defined was chained off of an existing property like be. This problem is fixed in Chai v4 in ES6 compatible environments, currently available on npm via chai@canary. This and related issues are discussed in length in #726. Gonna close this issue due to duplication but please feel free to discuss in that thread.
Thanks @meeber, I figured I was missing something.
Most helpful comment
Up until ES6 proxies, there was no way for Chai or Mocha to know that a non-existent property such as
definedwas chained off of an existing property likebe. This problem is fixed in Chai v4 in ES6 compatible environments, currently available on npm viachai@canary. This and related issues are discussed in length in #726. Gonna close this issue due to duplication but please feel free to discuss in that thread.