-
Notifications
You must be signed in to change notification settings - Fork 218
Support filtering by specific group names instead of only full (group + test) names #908
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
Comments
Note that |
Oh, I'll give that a try - the help text still said it was a substring so I didn't think about that. Could I do the same with a |
Yep, it should support everything dart regex supports I would guess |
Oh, I see the problem - it matches against the full name (all groups and test name joined). I'll see if I can join the group names in before I send (and I guess for a group I can put a wildcard on the end to run all the tests within). It's a bit of a tangent, but somewhat related... There are a couple of issues we've discussed that make |
So, the regex works, but there's a slight niggle with this solution is when running a group you can't put group("test" {});
group("test 2" {}); As far I can see, you can't run |
I think those are all reasonable requests, but we don't have a lot of extra resources to devote to that right now. What we are working on in the short/medium term is exposing more imperative apis from the test package to help improve the situation with regards to custom platforms, plugins, runners, etc. It could actually be that you are able to use that work in order to do all these things within your own process though - although they will all be dart apis which complicates things since the vscode plugin is written in typescript. |
Ya I think you would have to explicitly specify the exact full name of each test you want to run (the nested groups + test name, joined with a space). |
We do require there's a Dart VM, so in theory running a couple of Dart scripts isn't totally out of the question (ofcourse, the version of the VM, restoring packages, etc., could be a little more complicated). Is there any info on the work being done that I could review?
I don't think that'll work, the args help says
This seems less useful than the opposite to me (since tags allow you to run groups if that's what you wanted?) |
Not sure if we have any issues filed right now, @grouma ? |
Ok, well do ping me if you start on anything you think might be of interest :-) |
Regarding the regex that is unfortunate that it must match all of them - doesn't seem right on the surface but also probably not something we can change (and I don't know the original reasoning). I think you could however construct a regex using non-capturing groups, for instance something like this edit: hmm actually that regex also matches things like |
Ob-RegExp comment: If the group("a", () { test("b", () {}); }
test("a b", (){}); One option might be to allow the name test to be applied group names and individual test names as well as full test names. If it matches a group's name, then the entire group is included. That does require some way to find the group of a test (and the group of a group). |
thanks @lrhn for the regex-fu! |
Heh, that might work - though I'm slightly worried about how fragile this might get. There are extra steps this is going through:
Though maybe I can avoid some of these issues by replacing all non-alphanumerics with a I wonder if a relatively simple way to handle this is if hashes of the names are provided (as discussed in the "stable IDs" issue) and then there's a way to run tests by hash. That could also support multiple without having to change the name ones:
|
Yeah, I think the best way can do without changes is to minimise, but not eliminate, the false runs. If we can agree it's a reasonable option, I'd be happy to take a stab at adding some sort of hash to each test/group (based on the name) and an extra flag that allows specifically running them. To reduce the collisions we could hash with some separator between the group/test names and/or keep a hash set and add a incrementing suffixing if we come across a collision. |
Hmmm, that stable IDs thing doesn't actually help a lot with some of what I was implementing here. I'm using the analysis servers Outline data to inject Run/Debug links into the document - so I don't have any data from the test framework. It'd still probably help improve the tree, but I think "Code Lens" is still going to be a bit hit and miss. |
I updated the issue title to what I think reflects the current request. Today you can't match by group names, only by the full string that results after merging groups and test names. I do think it's reasonable to want to filter also by group names. |
Currently
--plain-name
matches any substring of tests which is great for users typing, but less great for editors wanting to offer a quick way of running tests. For ex., take this sample suite I got from the readme:I initially implemented a
Run
button next togroup
in Dart Code. However if you run theString
group here, it also runs one of theint
tests because it hasstring
in its name.It would be great to support some sort of exact-match which will only run a group or test if it matches exactly (it should support running all tests in a group if the string matches the group name exactly).
The text was updated successfully, but these errors were encountered: