This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
mocha-avoid-only only checking for string literals #436
Labels
Difficulty: Medium
People with non-trivial experience in TSLint should be able to send a pull request for this issue.
Requires Type Checker
Must be implemented with a "typed" rule that uses a TypeScript program.
Status: Accepting PRs
Type: Rule Feature
Adding a feature to an existing rule.
I noticed
mochaAvoidOnlyRule.ts
was missing cases where the first argument was not a string literal. So the following case would be missed:I saw that there were test cases specifically written not to catch this case. I believe it is to avoid false positives where
.only
is not from mocha. It might be better to be more aggressive with reporting the issue and people can use https://palantir.github.io/tslint/usage/rule-flags/ to disable false positives.Perhaps the best approach would be to make this rule a typed rule and check if the return of .only is one of
ExclusiveSuiteFunction
orExclusiveTestFunction
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/mocha/index.d.ts#L392
The text was updated successfully, but these errors were encountered: