Skip to content

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.
'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