Extend test
command to allow filtering package / file / test
#6696
Labels
test
command to allow filtering package / file / test
#6696
Having recently looked into a deeper integration of the OPA test runner (via command line invocation) and the OPA VS Code extension, there are some hurdles that I think would be best solved in OPA itself, as that would benefit not just VS Code but any editor including a similar integration. The problems are described in this issue, but to summarize here:
Editors and IDEs commonly run tests filtered by either:
The
opa test
command doesn't really accomodate any of the above needs, as it'll always run all tests in the files that are loaded. From an editors POV, that'll be all files in the workspace, or all Rego files really. It's possible to workaround this in editors by actually running all the tests, but only presenting the filtered result to the user, making them think that only the tests they asked for got run. It's also possible to use the--run
argument to pass a list of regular expressions that should match the name of the tests, but that doesn't take the name of the file or package into account... and a similarly named test could theoretically exist in any number of files without them being logically related.Suggestion here is to either extend what
--run
accepts, so that it would be possible to provide something likepackage/*
,file.rego/*
orfile.reg/test_1
, or to introduce another flag for this purpose. Naturally, this would need to work as expected with things like coverage, etc.The text was updated successfully, but these errors were encountered: