Closed garybernhardt closed 5 years ago
I think that Node's assert module might be the one doing this? If so then this can be closed.
Yes, I suspect that's the case. I'm pretty motivated to find a standalone assertion module that does deep equality checking in with a visually-appealing diffing format. I don't have one.
I switched to power-assert half an hour ago and it's been nice so far. It's doing evil by looking at the AST, which I don't like. But the diffs are nice.
Yes, good, power-assert is the only one I've had success with that's any good at all at this. How do you have it configured, if you don't mind sharing?
Also, does it add any slowness on passing tests? (My hope is that a great assertion library would only introduce slowness when producing good failure output)
I didn't realize it was configurable; I just switched my import from assert to power-assert and it seemed fine. It adds 72 ms of startup latency. I don't know whether it slows the tests themselves down.
I believe this was a Node assert thing. I'm not able to reproduce it when using other assertion errors.
If you assert very large objects against each other, the stringified versions shown at the terminal are truncated. So there's no way to actually see what was being asserted other than instrumenting the code with
console.log
etc.Here's an example with all identifiers anonymized. Search it for "..." to see where the truncation is happening. The actual difference between these two values isn't visible in this error message; it's somewhere after the "...".