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

Detect missing assertions in an arrow body #248

Merged

Conversation

jonathanperret
Copy link
Contributor

I stumbled upon a project that was missing expect assertions and tried to use eslint-plugin-chai-expect to find all occurrences but due to the way they wrote some of their tests (https://github.com/codeceptjs/CodeceptJS/blob/04739e52ddd725fc516a691b77ec37d4f9cbc3f5/test/unit/utils_test.js#L10-L11), some missing assertions were not detected:

    it('exists', () => expect(utils.fileExists(__filename)));
    it('not exists', () => expect(!utils.fileExists('not_utils.js')));

The use of expect(…) as the body of an arrow function, although unusual, does not seem invalid to me and I think it would be helpful if eslint-plugin-chai-expect would detect missing assertions in such a case as well.

So here's a PR that hopefully adds just this.

Copy link
Owner

@Turbo87 Turbo87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks :)

@Turbo87 Turbo87 merged commit 8c036c8 into Turbo87:master Aug 4, 2022
@jonathanperret jonathanperret deleted the arrow-function-missing-assertion branch August 4, 2022 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants