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 no-setup-in-describe to allow Mocha suite config #209

Merged
merged 4 commits into from
Sep 11, 2019

Conversation

straub
Copy link
Contributor

@straub straub commented Sep 5, 2019

This rule will now allow this.timeout();, this.slow();, and
this.retries(); in describe blocks, since they're configuration for
the suite and not setup.

Fixes #208.

This rule will now allow `this.timeout();`, `this.slow();`, and
`this.retries();` in describe blocks, since they're configuration for
the suite and not setup.

Fixes lo1tuma#208.
@@ -19,10 +19,16 @@ ruleTester.run('no-setup-in-describe', rule, {
'it("", function () { a[b]; })',
'it("", function () { a["b"]; })',
'describe("", function () { it(); })',
'describe("", function () { this.slow(1); it(); })',
'describe("", function () { this.timeout(1); it(); })',
'describe("", function () { this.retries(1); it(); })',
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add one test case with a computed member expression? E.g. this['retries'](1);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My change to the rule doesn't allow for that form of the expression, so I added this to the invalid test cases, but lmk if you would rather I add support for that form in the rule!

Copy link
Owner

Choose a reason for hiding this comment

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

IMHO we should handle this case as well. There is already a function for that in ast utils: getPropertyName().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All set!

Copy link
Owner

@lo1tuma lo1tuma left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

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

Successfully merging this pull request may close these issues.

no-setup-in-describe: disallows this.timeout()/this.slow()
2 participants