Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement valid-expect-in-promise rule (#42)
* feat: implement valid-expect-in-promise rule introduce a lint rule to report error when testing promises. If a expectation is added inside a then or catch block of promise then as per jest docs, it is mandatory to return that promise for succesfull execution of that expectation. This rule will report all such expectations where promise is not returned. * fix: do not add the rule to recommended * fix: do not validate await expressions for valid_expect_in_promise * fix: scenario with expect in nested then/catch * docs: updating docs for valid-expect-in-promise rule * test: add failing test case * fix: scenario where promise is returned later * fix: adding more scenarios where promise is returned later * test: adding more tests * fix: adding scenarios for non test functions * fix: refactor to avoid multiple execution of getTestFuncBody * fix: scenario with arrow-short-hand-fn with implicit return statement * fix: scenario with multiline function in then block * fix: scenario with short hand arrow function in then block * fix: do not validate tests with done async param * fix: scenario where expect in then is preceded by return * fix: duplicate warning for same promise * fix: better naming * test: better formatting
- Loading branch information