Skip to content

Commit

Permalink
Stop treating /packages/ specially (#1668)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
natebosch committed Feb 14, 2022
1 parent 5bbe1a8 commit e0be5ec
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
1 change: 1 addition & 0 deletions pkgs/test/CHANGELOG.md
@@ -1,6 +1,7 @@
## 1.20.2-dev

* Drop `dart2js-path` command line argument.
* Allow loading tests under a path with the directory named `packages`.

## 1.20.1

Expand Down
6 changes: 0 additions & 6 deletions pkgs/test/test/runner/loader_test.dart
Expand Up @@ -90,12 +90,6 @@ void main() {
completion(isEmpty));
});

test('ignores files in packages/ directories', () async {
await d.dir('packages', [d.file('a_test.dart', _tests)]).create();
expect(_loader.loadDir(d.sandbox, SuiteConfiguration.empty).toList(),
completion(isEmpty));
});

test("ignores files that don't end in _test.dart", () async {
await d.file('test.dart', _tests).create();
expect(_loader.loadDir(d.sandbox, SuiteConfiguration.empty).toList(),
Expand Down
1 change: 1 addition & 0 deletions pkgs/test_core/CHANGELOG.md
Expand Up @@ -2,6 +2,7 @@

* Remove wait for VM platform isolate exits.
* Drop `dart2jsPath` configuration support.
* Allow loading tests under a path with the directory named `packages`.

## 0.4.11

Expand Down
4 changes: 1 addition & 3 deletions pkgs/test_core/lib/src/runner/loader.dart
Expand Up @@ -140,9 +140,7 @@ class Loader {
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')) {
if (entry is! File || !_config.filename.matches(p.basename(entry.path))) {
return Stream.empty();
}

Expand Down

0 comments on commit e0be5ec

Please sign in to comment.