lo1tuma / eslint-plugin-mocha

ESLint rules for mocha
MIT License
279 stars 61 forks source link

False positive when test is not a mocha global #327

Open perrin4869 opened 2 years ago

perrin4869 commented 2 years ago

Let's say the test file is something like:

import { test } from 'ramda';

const validate = test(new RegExp(...), "foo"); // mocha/no-global-tests,mocha/no-pending-tests

describe(..., () => {
  it(..., () => {
    test(new RegExp(...), "foo"); // mocha/no-nested-tests
  });
});

The above will be false positives because test here is not a mocha global

lo1tuma commented 2 years ago

Hello @perrin4869, thanks for raising this issue. This is indeed a problem, in several rules of this plugin. I have already an idea how to fix it and started a while ago with a proof-of-concept implementation, unfortunately I wasn’t able to find enough time to finish it. The change is quite big, and changes basically all rules and how they work, which could also have a lot of impact on the performance of this plugin (I don’t know yet if the impact is negative or positive though). I hope to get the PoC in a shape where I can push it soon.

Related: #296