Dart-code: "No tests match regular expression ..." when running tests marked for browser with CodeLens links

Created on 12 Feb 2019  路  9Comments  路  Source: Dart-Code/Dart-Code

screenshot 2019-02-12 at 10 11 50 am

Clicking the Run CodeLens link on the group.

duplicate

Most helpful comment

Some more notes from my Dart/Flutter project experience:

First Observation:

src/utils/test.ts shows that the $ should not be included at the end of the flutter test regular expression string if it is a group. However, in my case, when I run a test group from the window editor, it attempts to put a $ at the end. (see GIF below)

https://github.com/Dart-Code/Dart-Code/blob/67c5af59eadd6195438112a02cde6a00289c3192/src/utils/test.ts#L14-L19

Second Observation

Even though the No tests match regular expression appears in the console, the test still shows up in the test outline view.

If you right click on the test and run it from the outline view, it executes properly and even builds out the remaining test outline subgroups and tests.

2019-04-13 01 31 00

Third Observation

Possibly related, the outline in the file explorer does not show the nested groups and tests.

Screen Shot 2019-04-13 at 1 34 33 AM

All 9 comments

... It's because of @TestOn('browser')

@DanTup I don't know if this is related (or maybe it's a different issue entirely), but I get this error when I try to run the Dart: Run Test At Cursor command.

No tests match regular expression "^Search Result$". Exited (1)

It might be related to group(), because if I remove group(), the Dart: Run Test At Cursor command works fine with no regular expression error.

@zenkimoto Sounds like the same issue, yeah. Are your groups/tests all in the same file, or different files?

@DanTup I have multiple files, each file with one group indicating the class that I'm testing. I might have subgroups, I don't know for sure. I'll have to check my tests. But if I remove the group, it works.

@zenkimoto What I really meant was, is the main method, your groups and your tests all in the same file? Eg. sometimes people have a file that does group('name', someFunction) in file 1, and define someFunction in another file. That definitely messes things up. If you have things in the same file, it should definitely work.

I re-read this issue, and actually I don't think your issue is related - since this one is because we don't know to tell the test package to use the browser so it just finds 0 tests. So, if your issue is not a result of spreading the main/group/test across multiple files, open a new issue and I'll take a look!

@DanTup Yep, it is all in the same file. I'm not referencing any functions externally.

I'll go ahead and create a new issue. Thanks!

Some more notes from my Dart/Flutter project experience:

First Observation:

src/utils/test.ts shows that the $ should not be included at the end of the flutter test regular expression string if it is a group. However, in my case, when I run a test group from the window editor, it attempts to put a $ at the end. (see GIF below)

https://github.com/Dart-Code/Dart-Code/blob/67c5af59eadd6195438112a02cde6a00289c3192/src/utils/test.ts#L14-L19

Second Observation

Even though the No tests match regular expression appears in the console, the test still shows up in the test outline view.

If you right click on the test and run it from the outline view, it executes properly and even builds out the remaining test outline subgroups and tests.

2019-04-13 01 31 00

Third Observation

Possibly related, the outline in the file explorer does not show the nested groups and tests.

Screen Shot 2019-04-13 at 1 34 33 AM

@tatemz

Thanks for the extra digging!

First Observation

However, in my case, when I run a test group from the window editor, it attempts to put a $ at the end. (see GIF below)

I think that's probably https://github.com/Dart-Code/Dart-Code/issues/1492 (which was opened by @zenkimoto after the comments above) where groups were mis-tagged as groups. Could you try on the beta/dev channels of Flutter and confirm it fixes that issue?

Second Observation

Even though the No tests match regular expression appears in the console, the test still shows up in the test outline view.

This is kind-of expected. It's the file that's showing up rather than the test. The file gets added because the test runner says it's loading that file. However it fails to find/run a test (which is why the test node doesn't appear under it). When you're right-clicking and telling it to run the file, it runs the whole file (similar to pressing F5 from within the test file) which will then run all tests, and add them all to the tree.

Third Observation

Possibly related, the outline in the file explorer does not show the nested groups and tests.

I think this is likely the same as the first issue, so let me know if this is also fixed (or not) if you switch to a newer Flutter branch (you can just do it temporarily if you don't want to stick on it).

Thanks!

I think the issues described here are fixed by #1492, #2055 and #2362. If you're still seeing any issues, please let me know and/or raise a new issue. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

e200 picture e200  路  3Comments

mccadi picture mccadi  路  3Comments

jascodes picture jascodes  路  4Comments

lukepighetti picture lukepighetti  路  4Comments

FeimiSzy picture FeimiSzy  路  4Comments