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

[require-top-level-describe] false positive for describe.each? #707

Closed
ljosberinn opened this issue Nov 10, 2020 · 3 comments · Fixed by #745
Closed

[require-top-level-describe] false positive for describe.each? #707

ljosberinn opened this issue Nov 10, 2020 · 3 comments · Fixed by #745

Comments

@ljosberinn
Copy link

tests within describe.each throw the require-top-level-describe error - is this intended?

image

@SimenB
Copy link
Member

SimenB commented Nov 12, 2020

Nah, that's a bug. Wanna send a PR?

@ljosberinn
Copy link
Author

I've been trying but I'm afraid I don't know enough about the internals of eslint rules.

      MemberExpression(node) {
        if (
          node.parent?.type === 'CallExpression' &&
          isDescribe(node.parent) &&
          node.type === 'MemberExpression' &&
          node.property.type === 'Identifier' &&
          node.property.name === 'each'
        ) {
          numberOfDescribeBlocks++;

          return;
        }
      },
      'MemberExpression:exit'(node: TSESTree.MemberExpression) {
        if (
          node.parent?.type === 'CallExpression' &&
          isDescribe(node.parent) &&
          node.type === 'MemberExpression' &&
          node.property.type === 'Identifier' &&
          node.property.name === 'each'
        ) {
          numberOfDescribeBlocks--;

          return;
        }
      },

technically that works, as in, increments numberOfDescribeBlocks, but I'm fairly lost beyond that.

@github-actions
Copy link

🎉 This issue has been resolved in version 24.1.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@G-Rath G-Rath added the each support Relates to supporting the `each` method label Apr 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants