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

Asserts limit do not detect "Sinon" camelcase #45

Open
ymoreiratiti opened this issue Mar 9, 2024 · 0 comments
Open

Asserts limit do not detect "Sinon" camelcase #45

ymoreiratiti opened this issue Mar 9, 2024 · 0 comments

Comments

@ymoreiratiti
Copy link

ymoreiratiti commented Mar 9, 2024

Somente tests where Sinon is imported with the name "Sinon" instead "sinon" returns Test without assertions is not allowed.

e.g.

const rule = require('../../../lib/rules/asserts-limit');
const { RuleTester } = require('eslint');

const ruleTester = new RuleTester({ env: { es6: true } });

ruleTester.run('asserts-limit', rule, {
  valid: [
    {
      only: true,
      code: `it('1234', function () {
        Sinon.assert.calledOn(sp, {});
      })`
    }
  ],
  invalid: [],
});

It appears that changing lib/utils/node.js#L36
from node.object.name === 'sinon' to String(node.object.name).toLowerCase() === 'sinon' solves.

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

1 participant