Skip to content
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

Testing enhancement: Testing individual rules or cases #501

Closed
brettz9 opened this issue Jan 21, 2020 · 5 comments · Fixed by #2243
Closed

Testing enhancement: Testing individual rules or cases #501

brettz9 opened this issue Jan 21, 2020 · 5 comments · Fixed by #2243

Comments

@brettz9
Copy link
Contributor

brettz9 commented Jan 21, 2020

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.

@sindresorhus
Copy link
Owner

Yes, that would indeed be useful.

@brettz9
Copy link
Contributor Author

brettz9 commented Jan 21, 2020

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?

@jmoore914
Copy link
Contributor

I have a VSCode configuration to run/debug an individual test file that I can share if that would be helpful.

@travismorenz
Copy link

@jmoore914 You wouldn't happen to have that VSCode config still lying around would you?

@jmoore914
Copy link
Contributor

@travismorenz I don't, I'm sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants