On 05/06/14 10:38, Mike de Boer wrote: > As I tried to explain, the CommonJS API naively made sense to me at > the time. To others as well, because we’re happily using it. As I now > understand, some of us are very attached to a specific, different, > API.
FWIW I don't think that I am attached to a "specific different api". I am, however, attached to api semantics that make writing good tests easy. I don't think that either CommonJS or SimpleTest achieve this in their current form. For SimpltTest I think the main problems are: * The is() and isnot methods use non-strict equality. * ok() coerces its argument (this is a more minor problem). * is and ok seem like pretty uninformative names. ise is even worse. * isenot doesn't even exist. * The API is largely undocumented. From reading MDN you would think that is, isnot and ok were the only methods. I can't find any other doumentation except for the source. * The API seems to be inconsistently exposed e.g. doesThrow isn't placed in the global scope but is on the SimpleTest object. But it seems like some properties of SimpleTest that look like assertions are not e.g. isa seems to return a bool rather than call ok(). * doesThrow does't provide any means of inspecting the object that was thrown. * isDeeply uses non-strict equality comparisons. * All the todo stuff is mixing concerns. It forces you into a mode of test writing where properties of a single implementation are hardcoded into the testcases. This isn't a huge problem when there is only a single relevant implementation, but we do a lot of work on standards where there are multiple implementations. * The fact that the implementation to todo* has to duplicate all the comparison code is pretty terrible. Maybe that's why all the methods other than ok, is, and isn are undocumented, because they don't have todo equivalents. _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform