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

Non string error messages #2101

Merged
merged 1 commit into from Feb 19, 2016

Conversation

jkimbo
Copy link
Contributor

@jkimbo jkimbo commented Feb 9, 2016

This PR checks that when handling assertion error messages in a reporter, the message is actually a string since if it isn't the message.match function (https://github.com/jkimbo/mocha/blob/2a1dc7a8f32d7eb65cdf645c30aac3cc37714ae7/lib/reporters/base.js#L208) fails and leads to the test suite failing silently.

@danielstjules
Copy link
Contributor

How about:

if (err.message && typeof err.message.toString === 'function') {
  message = err.message + '';
} ...

Then we handle other non-string messages that can be coerced.

@jkimbo
Copy link
Contributor Author

jkimbo commented Feb 17, 2016

@danielstjules great idea! I'll change it.

@danielstjules
Copy link
Contributor

Thanks! Could you rebase/squash? :)

@jkimbo
Copy link
Contributor Author

jkimbo commented Feb 19, 2016

@danielstjules done!

danielstjules added a commit that referenced this pull request Feb 19, 2016
@danielstjules danielstjules merged commit 9c41051 into mochajs:master Feb 19, 2016
@danielstjules
Copy link
Contributor

Thanks!

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.

None yet

2 participants