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

let's through non-existing statements #19

Open
karlismelderis opened this issue Apr 16, 2021 · 4 comments
Open

let's through non-existing statements #19

karlismelderis opened this issue Apr 16, 2021 · 4 comments

Comments

@karlismelderis
Copy link

I caught that due to this lint rule setup:

        'chai-friendly/no-unused-expressions': 'error',
        'no-unused-expressions': 'off',

Things like this pass through:
.to.be.disabled

Where syntax should be:
.to.be.disabled()

As we don't have any plugin that has such .disabled implementation but do have .disabled().

Issue is that Jest just moves on happily and marks tests as green irrelevant of syntax.

no-unused-expressions and IntelliJ code inspection is able to detect this error.

@ihordiachenko
Copy link
Owner

Hi @karlismelderis

This plugin is for chai-js-style asserts like this:

expect(true).to.be.true;

It is useless for Jest-style asserts so just remove/disable the plugin.

@karlismelderis
Copy link
Author

Due to historical decisions we're using chai assertions in Jest
So .exist, .true and other chai syntax still exist in our test files

but chai do not have .disabled (it's only part of chai-jquery and we don't have it installed)

@ihordiachenko
Copy link
Owner

@karlismelderis I see. The linter is not aware of chai plugins, so the best we can do is to add a configurable whitelist of chai asserts. Will look into it this weekend.

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

3 participants
@karlismelderis @ihordiachenko and others