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

Absolute folder path filters trigger "no test found" #1667

Closed
rrousselGit opened this issue Feb 11, 2022 · 10 comments · Fixed by #1668
Closed

Absolute folder path filters trigger "no test found" #1667

rrousselGit opened this issue Feb 11, 2022 · 10 comments · Fixed by #1668
Labels
closed-cannot-reproduce Closed as we were unable to reproduce the reported issue

Comments

@rrousselGit
Copy link
Contributor

It seems like if dart test folderPath is executed an absolute path instead of a relative path, then dart test will somehow fail to execute the tests

Example:

$ pwd
/Users/remirousselet/dev/invertase/fest/packages/spec_cli

$ dart test .
< works just fine > 

$ dart test /Users/remirousselet/dev/invertase/fest/packages/spec_cli
No tests ran.
No tests were found.
@jakemac53
Copy link
Contributor

This seems to work fine for me on linux, can you clarify what platform you are on or provide any additional info you think might be relevant?

@rrousselGit
Copy link
Contributor Author

It happened on Mac for me.

I'm not exactly sure what else to say

@jakemac53
Copy link
Contributor

Ok, I don't have a mac to test this on, but I think @natebosch does. Although I would be very surprised if it works on linux but not mac...

@rrousselGit
Copy link
Contributor Author

Haha, I'm not quite sure either.

In any case, since this was triggered by my custom test renderer, I used a workaround and converted paths to relative ones.

@natebosch
Copy link
Member

I can't reproduce this behavior. I'm on mac with the latest stable SDK (2.16.1) and latest test (1.20.1)

I get the same results whether I run with no argument, ., or an absolute path to the directory with or without a trailing /.

[11:08]»  dart test
Building package executable... (7.7s)
Built test:test.
00:04 +394: All tests passed!
[11:08]»  dart test .
00:03 +394: All tests passed!
[11:08]»  dart test /Users/nbosch/repos/stream_transform
00:03 +394: All tests passed!
[11:08]»  dart test /Users/nbosch/repos/stream_transform/
00:03 +394: All tests passed!

@jakemac53 jakemac53 added the closed-cannot-reproduce Closed as we were unable to reproduce the reported issue label Feb 14, 2022
@jakemac53
Copy link
Contributor

I am going to close this as not reproducible for now, if you can figure out a way to reproduce it we can take another look

@rrousselGit
Copy link
Contributor Author

If that helps here's my dart version

Dart SDK version: 2.16.0-144.0.dev (dev) (Thu Dec 30 11:53:00 2021 -0800) on "macos_x64"

on macos 12.2:

Here's a video too:

Screen.Recording.2022-02-14.at.20.28.27.mov

@natebosch
Copy link
Member

We must still have some code treating packages as a special directory name. I can repro this if I move my packages into a directory with /packages/ somewhere on the path.

@natebosch natebosch reopened this Feb 14, 2022
@rrousselGit
Copy link
Contributor Author

rrousselGit commented Feb 14, 2022

Upgrading Dart to 2.17.0-104.0.dev and test to 1.20.1 (from 1.17.12) changed nothing by the way.

I created a brand new project, and for some reason with that project, absolute paths works.
It seems related to projects with a packages folder from my tests

edit I'm too slow apparently haha

@natebosch
Copy link
Member

natebosch commented Feb 14, 2022

Stream<LoadSuite> loadDir(String dir, SuiteConfiguration suiteConfig) {
return StreamGroup.merge(
Directory(dir).listSync(recursive: true).map((entry) {
if (entry is! File ||
!_config.filename.matches(p.basename(entry.path)) ||
p.split(entry.path).contains('packages')) {
return Stream.empty();
}

natebosch added a commit that referenced this issue Feb 14, 2022
Fixes #1667

The special treatment of `packages` as a directory name was from when
`pub` would create a directory with that name under the package root. I
think the intention was to avoid loading in tests from the packages pub
downloaded.

There are still cases where a directory named `packages` is created and
treated specially by Dart tooling, but those use cases are limited to
the web and should no longer have their `test` directories retained.
natebosch added a commit that referenced this issue Feb 14, 2022
Fixes #1667

The special treatment of `packages` as a directory name was from when
`pub` would create a directory with that name under the package root. I
think the intention was to avoid loading in tests from the packages pub
downloaded.

There are still cases where a directory named `packages` is created and
treated specially by Dart tooling, but those use cases are limited to
the web and should no longer have their `test` directories retained.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-cannot-reproduce Closed as we were unable to reproduce the reported issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants