Open
Description
Plugin version
v5
What problem do you want to solve?
Quoting myself from #588:
Thinking about all the changes we did to test all rules for the corresponding Testing Library frameworks, I think it makes sense to add some improvements to our TestingLibraryRuleMeta
and createRuleTester
to automatically generate the test cases variations for indicated frameworks.
Your take on the correct solution?
In my mind, it could look like this:
// rules/foo.js
export default createTestingLibraryRule({
// ...
meta: {
// ...
supportedFrameworks: ['react', 'vue']
// ^ we extend our TestingLibraryRuleMeta so it has this new required property,
// which can be used also to autogenerate a table of compatible frameworks for each rule doc
}
})
// test/lib/rules/foo.js
ruleTester.run(RULE_NAME, rule, {
valid: [
{
code: `
import { fireEvent } from '{TESTING_LIBRARY_FRAMEWORK}'
// ^ this placeholder gets replaced automatically,
// iterating over each value from supportedFrameworks
await fireEvent.click(element)
`
}
]
})
Anything else?
No response
Do you want to submit a pull request to implement this change?
Yes