-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🚀 Feature: Expose public API for accessing diffs #3011
Comments
@segrey sure, feel free to send a PR. BTW, if you have any other suggestions for ways in which Mocha can better communicate with IDEs, I'm interested! |
So, I'd love to get this in place, and also I have no familiarity with contributing to mocha or the reporter. Anyone interested in pairing for a bit to provide context (@boneskull, @segrey) so I can get the ball rolling? |
@segrey Can this be closed, or is it incomplete? |
Can we close this? |
Maybe this can be closed when you implement #1348, which could make use of this API. It's the same, not in an IDE, but in the HTML reporter of Mocha, which still misses diffs/such a major feature. |
Cool, that was merged! Also, IDEs should be able to use a reporter for this. Either JSON or their own custom one if they need. Failing that, #1457 is an umbrella issue around adding in plugins that could enhance stuff like this. Linking to that issue to make sure this use case is accounted for. Cheers all! |
Prerequisites
common mistake
labelnode 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:
In this case, both
list
function fromlib/reporters/base.js
and IDE may useprettifyError
.Original issue in WebStorm's tracker: https://youtrack.jetbrains.com/issue/WEB-28905
The text was updated successfully, but these errors were encountered: