Detect missing assertions in an arrow body #248
Merged
+19
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I stumbled upon a project that was missing
expect
assertions and tried to useeslint-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: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 ifeslint-plugin-chai-expect
would detect missing assertions in such a case as well.So here's a PR that hopefully adds just this.