Prerequisites
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
Prerequisites
common mistakelabelnode 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
errobject 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:
In this case, both
listfunction fromlib/reporters/base.jsand IDE may useprettifyError.Original issue in WebStorm's tracker: https://youtrack.jetbrains.com/issue/WEB-28905