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

literal-compare-order rule crash #74

Closed
bmish opened this issue Sep 7, 2019 · 1 comment
Closed

literal-compare-order rule crash #74

bmish opened this issue Sep 7, 2019 · 1 comment

Comments

@bmish
Copy link
Member

bmish commented Sep 7, 2019

I have a large codebase with many different types of tests, including many that look like this:

test('it has the right URL', function() {
  expect(url).to.equal('/items/library');
});

This test case causes the following crash:

     TypeError: Cannot read property 'type' of undefined
Occurred while linting <input>:1
      at checkLiteralCompareOrder (lib/rules/literal-compare-order.js:42:77)
      at processAssertion (lib/rules/literal-compare-order.js:67:17)
      at CallExpression (lib/rules/literal-compare-order.js:79:21)

It appears that this is happening because there is only one argument to equal instead of the expected 2+ arguments.

The rule likely should be ignoring my usage of equal because it doesn't have the expected form.

And note that this same problem occurs with other functions covered by the rule (strictEqual, notDeepEqual, etc).

@platinumazure
Copy link
Collaborator

Hi @bmish, thanks for the issue!

We definitely want to fix the crash (PR would be welcome). At a later point, we should also do more to ensure that all of the QUnit-related functions are actually imported from QUnit, but that will be a wider change.

In the meantime-- to unblock you as fast as possible-- I would recommend seeing if you can use ESLint's glob-based configuration feature to see if you can override ESLint to not run the eslint-plugin-qunit rules on files that use other test frameworks. That will hopefully help you until the rule is fixed not to crash!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants