-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Open
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusioncoreRelates to ESLint's core APIs and featuresRelates to ESLint's core APIs and featuresenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLint
Description
ESLint version
v9.30.1
What problem do you want to solve?
I try to improve the quality of some (invalid) rule tests, by making sure they all test the same properties.
Specifically I want to ensure, I (and future developers) test for
- individual errors instead of error counts
- and test for specific error messages and locations instead of partial checks
What do you think is the correct solution?
I have considered two similar solutions:
- Add
assertionOptions/options: { requireMessage: boolean; requireLocation: boolean }toRuleTesterconstructor - Add
assertionOptions/options: { requireMessage: boolean; requireLocation: boolean; requiredBlocks: Array<'valid', 'invalid'> }toRuleTester'srunmethod
The second option would make it possible to run multiple test runs with the same runner instance but different options.
Participation
- I am willing to submit a pull request for this change.
Additional comments
Requiring the location would require the full location (might be configurable with boolean | 'full')
Continuation of #19904
Metadata
Metadata
Assignees
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusioncoreRelates to ESLint's core APIs and featuresRelates to ESLint's core APIs and featuresenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLint
Type
Projects
Status
Implementing