eslint-plugin-unicorn
eslint-plugin-unicorn copied to clipboard
Testing enhancement: Testing individual rules or cases
For eslint-plugin-jsdoc
, we have added a convenient testing feature that allows us to run tests like npm run test-index --rule=xyz --invalid=3-5
or npm run test-index --rule=xyz --valid=-1
(with slice-like ranges/indexes/negative indexes). This alone has been extremely helpful for rapid testing and development, and I would suggest it be considered for eslint-plugin-unicorn
.
Alternatively, or in addition, one might add only: true
or only: 1
to a given tests to behave like Mocha's it.only
, changing the default to run no tests except those with an only
property.
Yes, that would indeed be useful.
I have something working locally as a patched version of eslint-ava-rule-tester
.
However, as I see no good way to get ava to dynamically ignore a test after the tests have begun, I see no way to avoid getting messages for each ignored file such as "No tests found in test/prefer-trim-start-end.js".
I suppose we could instead dynamically build a CLI glob pattern but besides feeling hacky and requiring some significant changes to the existing test files, this would not become available by default to all eslint-ava-rule-tester
users. Is it possible ava could be made to look for something during execution of individual test files so as to ignore displaying their results?
I have a VSCode configuration to run/debug an individual test file that I can share if that would be helpful.
@jmoore914 You wouldn't happen to have that VSCode config still lying around would you?
@travismorenz I don't, I'm sorry!