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

Fix 2067: HTML/DOC reporter regression with async failures #2068

Merged
merged 1 commit into from
Jan 26, 2016
Merged

Fix 2067: HTML/DOC reporter regression with async failures #2068

merged 1 commit into from
Jan 26, 2016

Conversation

danielstjules
Copy link
Contributor

Fixes #2067

Review on Reviewable

@boneskull
Copy link
Contributor

Reviewed 4 of 4 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from the review on Reviewable.io

boneskull added a commit that referenced this pull request Jan 26, 2016
Fix 2067: HTML/DOC reporter regression with async failures
@boneskull boneskull merged commit f00c197 into mochajs:master Jan 26, 2016
@danielstjules danielstjules deleted the dstjules/test-body branch January 26, 2016 19:13
@@ -22,6 +22,7 @@ function Test(title, fn) {
Runnable.call(this, title, fn);
this.pending = !fn;
this.type = 'test';
this.body = (fn || '').toString();
Copy link

Choose a reason for hiding this comment

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

Should Test#clone copy this one as well?

cc @longlho

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No - when the new test is created via Test#clone, it'll get the exact same string body https://github.com/danielstjules/mocha/blob/d59cc6c166d0d112a62016909b33e04ed08d2274/lib/test.js#L34

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same reason why Test#clone doesn't apply this.type = 'test';. It's already handled in the constructor :)

Copy link

Choose a reason for hiding this comment

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

right 👍

Choose a reason for hiding this comment

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

Shouldn't the initialization of this.body belong to Runnable's constructor rather than Test?

Right now, if you get an error in a hook, Mocha will bomb, because the Hook object that it tries to process here does not have a body field. Moving the creation of body to Runnable would make both Hook and Test get a body field.

The issue I'm talking about here is fully reproducible with the code provided in this comment. I also am able to reproduce it independently in a test suite of mine (which is why I found the comment and am commenting here).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will be resolved by #2115 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.

4 participants