You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would require invalid test cases to assert what suggestions are provided for each violation (using suggestions: [] if the violation provides no assertions).
Why?
Currently, it's easy to forget to assert what suggestions a test case yields, or that a test case yields no assertions. As a result, this can be an area of poor test coverage.
newRuleTester().run('example-rule',rule,{valid: [],invalid: [{code: `foo();`,output: null,errors: [{messageId: 'bar',type: 'Property',suggestions: [],// or array of suggestions if rule offers them},],},]});
This rule would have a consistent option (enabled by default), which would only require the suggestions assertion if at least one test case in the file has it (similar to eslint-plugin/consistent-output).
I hope that a future major version of ESLint will require test cases that yield suggestions to assert what they are, so that this lint rule wouldn't be as necessary as it is now. Here is the issue I file about this: eslint/eslint#15104
The text was updated successfully, but these errors were encountered:
bmish
changed the title
New Rule: require-suggestions-assertion
New Rule: require-test-suggestionsSep 25, 2021
It would require invalid test cases to assert what suggestions are provided for each violation (using
suggestions: []
if the violation provides no assertions).Why?
This rule would have a
consistent
option (enabled by default), which would only require thesuggestions
assertion if at least one test case in the file has it (similar to eslint-plugin/consistent-output).I hope that a future major version of ESLint will require test cases that yield suggestions to assert what they are, so that this lint rule wouldn't be as necessary as it is now. Here is the issue I file about this: eslint/eslint#15104
The text was updated successfully, but these errors were encountered: