Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
only
on test cases or CLI comma-separated--rules
and comma-separated--valid=idxOrNegIdx
/--invalid=idxOrNegIdx
Fixes #13.
I've implemented such that
only
only works if--rules
is present. I can implement it to work without it, but I thought it was helpful to avoid the extra overhead it necessitates by default.Note that without a means in ava to dynamically ignore test files, one will still get notices about test files not having tests (for those files where all test cases are filtered out).
Note also that I am checking for 3 config sources. One was added to allow for easier unit testing (within the constructor), and one (including the
minimist
dependency) was added so as to support regular CLI usage or the double-double-hyphen syntaxnpm test -- --rule
described at https://github.com/avajs/ava/blob/master/docs/recipes/passing-arguments-to-your-test-files.md . However--and ava could be modified to support this too--you don't actually need the extra double-hyphen if you are running frompackage.json
scripts
and if the code checks forprocess.env.npm_config_*
, e.g.,process.env.npm_config_rules
, as I've done in this PR also.I've also added this which I can remove or alter as needed: