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

no-setup-in-describe triggers on both describe.each() and it.each() #348

Open
maikeru opened this issue Feb 28, 2024 · 1 comment
Open

Comments

@maikeru
Copy link

maikeru commented Feb 28, 2024

Thanks for all the hard work on this incredibly useful plugin!

It looks like describe.each() and it.each() aren't handled and trigger the no-setup-in-describe rule when they shouldn't
Plain describe() and it() behave as expected (i.e. don't trigger no-setup-in-describe.

Some examples:

import expect from 'expect';

// this triggers no-setup-in-describe
describe.each([['a'], ['b']])('letter %s', letter => {
  it('does something with the letter', () => {
    // meaningless test so that example is runnable
    expect(letter).toEqual(letter);
  });
});

describe('fruit', () => {
  // this also triggers no-setup-in-describe
  it.each([['apples'], ['oranges']])('eats %s', fruit => {
    expect(eats(fruit)).toBe(true);
  });
});

package.json dependencies:

"eslint-plugin-mocha": "^10.3.0",
"expect": "29.6.1",
"mocha": "10.0.0",

Could it be a similar problem to this? #249

@lo1tuma
Copy link
Owner

lo1tuma commented Feb 28, 2024

🤔 Mocha doesn’t have describe.each() or it.each(), so I think you need to specify additionalCustomNames so the rule knows about it and treats it as a describe or it block, see here.

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

No branches or pull requests

2 participants