> On 14 May 2015, at 03:15, Boris Zbarsky <bzbar...@mit.edu> wrote: > > On 5/13/15 7:35 PM, Gregory Szorc wrote: >> I would steer people in the direction of Assert.jsm, specifically >> Assert.deepEqual > > This should be used very very carefully. > > As a very simple example, using this (or worse yet notDeepEqual) in any test > that tries to check for equality of Window objects is not a good idea.
The idea is *I think* that ObjectUtils.jsm (which Assert.jsm uses since recently) can be extended to be aware of various object types. Right now it doesn’t have optimal support for iterables like `Map` and `Set`. Same goes for Gecko wrapper objects, like `window`. When you want to use `deepEqual` with those, anyone should feel free to add support for it! Even if it’s only rudimentary support only. Regarding the `==` vs. `===` discussion: I think using `===` for in-test assertions is obviously preferred. This is where Assert.jsm can help and I’d be happy with a patch that replaces `Assert.equal` with `Assert.strictEqual` and just drop the `Assert.strict*` family of methods. In general I think it’s up to a dev’s own discretion which to use; it’s never been a footgun for me because I know each of their semantics inside-out[1]. TBH, I’ve never seen any of my colleagues encounter type coercion bugs over the past eight years. Maybe I’m just lucky, but I do know that the danger of `==` was hyped a bit when it first hit the blogosphere, followed by the (in)famous wtfjs.com site, a couple of years ago and has been a recurring theme ever since. I hope this helps, Mike. [1] No, I’m not trying to pat myself on the back, sometimes this is just the case when you’re a professional ;-) _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform