From d1ed7d465ee1f45fefcd3cfc851cd989c1264204 Mon Sep 17 00:00:00 2001 From: Mathias Schreck Date: Fri, 29 May 2020 21:20:13 +0200 Subject: [PATCH] Fix no-setup-in-describe to not flag describe.skip() --- lib/rules/no-setup-in-describe.js | 2 +- test/rules/no-setup-in-describe.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/rules/no-setup-in-describe.js b/lib/rules/no-setup-in-describe.js index 3a872f1..4383b69 100644 --- a/lib/rules/no-setup-in-describe.js +++ b/lib/rules/no-setup-in-describe.js @@ -83,7 +83,7 @@ module.exports = { }, MemberExpression(node) { - if (isNestedInDescribeBlock()) { + if (!isDescribe(node.parent) && isNestedInDescribeBlock()) { reportMemberExpression(node); } }, diff --git a/test/rules/no-setup-in-describe.js b/test/rules/no-setup-in-describe.js index 52915de..63139e5 100644 --- a/test/rules/no-setup-in-describe.js +++ b/test/rules/no-setup-in-describe.js @@ -19,6 +19,9 @@ ruleTester.run('no-setup-in-describe', rule, { 'it("", function () { a[b]; })', 'it("", function () { a["b"]; })', 'describe("", function () { it(); })', + 'describe.skip("", function () { it(); })', + 'describe.only("", function () { it(); })', + 'describe["only"]("", function () { it(); })', 'describe("", function () { this.slow(1); it(); })', 'describe("", function () { this.timeout(1); it(); })', 'describe("", function () { this.retries(1); it(); })',