I have a failing mocha test that outputs my string with the "Actual" and "Expected" highlighting... except that nothing's highlighted.
After some head-bashing, I think I've determined that my actual string contains some whacky UTF-8 characters that are completely hidden from me, and Mocha doesn't seem to know to highlight them.
I figured this out by writing out my expected and actual values to raw text files and loading them up in Kaleidoscope, which shows that they differ by highlighting what appears to be empty spaces between words.
I tried loading the utf8
library (on npm) and encoding one of the strings with utf8.encode str
, and that still failed, but now the characters appear as something more than blank spaces, and Mocha does highlighting:
But either way, my tests are failing. How can I encode/decode/whatever these strings so that they match and my tests pass?
Btw, the comparison string I'm using in my test looks like this: