Skip to content
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

Do not crash when reporting on circular structures #1140

Closed
wants to merge 1 commit into from

Conversation

jugglinmike
Copy link
Contributor

Currently, Mocha attempts to stringify the actual and expected
properties of errors thrown by failing tests (when the showDiff flag
is set). If these structures contain circular references, the reporter
silently fails and Mocha exits with a status code of "0", hiding the
test failure.

Use the json-stringify-safe library to safely stringify objects that
may have circular references.

Currently, Mocha attempts to stringify the `actual` and `expected`
properties of errors thrown by failing tests (when the `showDiff` flag
is set). If these structures contain circular references, the reporter
silently fails and Mocha exits with a status code of "0", hiding the
test failure.

Use the `json-stringify-safe` library to safely stringify objects that
may have circular references.
@jugglinmike
Copy link
Contributor Author

This patch originally failed the Travis CI build, but since those errors looked unrelated, I triggered another build. This one succeeded, which makes me think those failures are intermittent. I'm not sure about that, though, which is why I'm documenting it here.

@jugglinmike
Copy link
Contributor Author

@visionmedia @travisjeffery Anything I can do to help move this along?

@jbnicolai
Copy link

@travisjeffery on a first glance, this looks good to me. Should we merge it?

@boneskull
Copy link
Contributor

@jbnicolai Is this the same as #1198?

@travisjeffery
Copy link
Contributor

seems to be the same, let's continue with #1198

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants