Closed
Deckhandfirststar01/mocha
#13Description
openedon Sep 25, 2017
Prerequisites
- Checked that your issue isn't already filed by cross referencing issues with the
common mistake
label - Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code.
- 'Smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, your usage of Mocha, or Mocha itself
- Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with:
node node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend avoiding the use of globally installed Mocha.
Description
Mocha prints nice diffs for failed assertions. It'd be great to show these diffs when running mocha tests in IDE.
Currently, IDE accesses err
object directly to format error info: https://github.com/JetBrains/mocha-intellij/blob/3c40655fcb8e4b216586d19ab83cac8c3f98e4a9/lib/mochaIntellijReporter.js#L157-L176 and doesn't print diffs in console (only clicking "Click to see difference" opens a separate diff dialog).
What do you think about allowing IDE to show unified diffs for failed assertions? // cc @boneskull
A possible API might look this:
// lib/utils.js
exports.prettifyError = function (err) {
return {
msg: '<colored text with unified diff>',
stack: '<colored tail of stack>'
};
};
In this case, both list
function from lib/reporters/base.js
and IDE may use prettifyError
.
Original issue in WebStorm's tracker: https://youtrack.jetbrains.com/issue/WEB-28905
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment