New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RuleTester] Test case validation #13917
Comments
Thanks for the issue so your proposal is to allow objects, arrays too along with a string for Let me know if I am getting this wrong. |
No I don't propose allowing other types for the code property. |
Okay, so to add a check for Make sense to me. |
Makes sense to me, it would be useful to provide more helpful info. I'll champion this.
Some properties are passed through as ESLint config properties and validated as such. For example, try to specify These are all RuleTester-specific properties: eslint/lib/rule-tester/rule-tester.js Lines 118 to 124 in 06b5809
Aside from |
I have opened up a fix for this in #15425. Note that separately, I also have an RFC open for some additional test validations that are breaking changes: eslint/rfcs#84. Please comment on the RFC if there are additional breaking changes you would like to suggest. |
Marked as accepted since this is more of a bug than an enhancement. |
The version of ESLint you are using.
Node version: v15.3.0
npm version: v6.14.2
Local ESLint version: v7.15.0 (Currently used)
Global ESLint version: Not found
The problem you want to solve.
The rule tester throws a type error and does not run any test case if the test case property is not a string:
which results in an ugly error:
Relevant code is here.
I categorized this as a change as there is only little test case validation but this issue may also be seen as a bug report.
Your take on the correct solution to problem.
The rule tester only fails the impacted test case with an instruction on how to correct the error.
This may be expanded to other properties than the code property.
Currently the rule tester only checks the structure of the scenarios (eg. valid and invalid are present) and for test cases that options are an array and that parser is an absolute path.
Are you willing to submit a pull request to implement this change?
Yes
The text was updated successfully, but these errors were encountered: