deno_std
deno_std copied to clipboard
Shorter message for simple assertion failures
Is your feature request related to a problem? Please describe.
I use assertEquals quite often in my tests When running from VSCode, I get this little tooltip
which can be clicked on to get the full error message
Describe the solution you'd like
I wish I didn't always have to click on the message. It'd be lovely if it would display a variation of the following for short messages
This is actually pretty straightforward to implement. It's roughly
let message;
if (actualString.length + expectedString.length <= 32) {
message = `${actualString} != ${expectedString}${msgSuffix}`;
} else {
message = `Values are not equal${msgSuffix}`;
}
Describe alternatives you've considered
-
Write my own
assertEquals. -
Just accept the one extra click.
-
Hook up the
expectedandactualvalues in the Deno LSP and report it to the UI that way. Part of the code for that is already in the LSP.