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

Improve error output when a test fails with a non-error #1537

Merged

Conversation

jakecraige
Copy link
Contributor

closes issue #1532

@dasilvacontin
Copy link
Contributor

Thanks!

dasilvacontin added a commit that referenced this pull request Feb 6, 2015
Improve error output when a test fails with a non-error
@dasilvacontin dasilvacontin merged commit 7f59583 into mochajs:master Feb 6, 2015
@jakecraige jakecraige deleted the test-rejection-with-object-1532 branch February 6, 2015 20:33
@@ -197,6 +199,8 @@ Runner.prototype.fail = function(test, err){

if ('string' == typeof err) {
err = new Error('the string "' + err + '" was thrown, throw an Error :)');
} else if (!(err instanceof Error)) {
err = new Error('the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a second branch of the conditional here? Why not just remove the check for string, and simply display this message if err is not an Error?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. Sorry, missed that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @boneskull PR #1542 submitted

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.

5 participants