Skip to content

Commit b9d301b

Browse files
authored
testBuilders default package setup. (#4071)
1 parent efd9a13 commit b9d301b

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

build_test/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 3.2.1
2+
3+
- Files loaded from disk for `resolveSources` and `testBuilders` that are in
4+
the same package as explicitly-passed test inputs are now loaded if they
5+
match the default globs, such as `lib/**`, instead of ignored. This more
6+
closely matches version 2 behavior.
7+
18
## 3.2.0
29

310
- Fixes when passing a `readerWriter` to `testBuilders`: don't count initial

build_test/lib/src/test_builder.dart

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import 'package:build_resolvers/build_resolvers.dart';
1111
import 'package:build_runner_core/build_runner_core.dart';
1212
// ignore: implementation_imports
1313
import 'package:build_runner_core/src/generate/build_series.dart';
14+
// ignore: implementation_imports
15+
import 'package:build_runner_core/src/generate/options.dart';
1416
import 'package:glob/glob.dart';
1517
import 'package:logging/logging.dart';
1618
import 'package:package_config/package_config.dart';
@@ -305,10 +307,10 @@ Future<TestBuilderResult> testBuilders(
305307
reportUnusedAssetsForInput: reportUnusedAssetsForInput,
306308
resolvers: resolvers,
307309
overrideBuildConfig:
308-
// Override sources to all inputs, optionally restricted by
309-
// [inputFilter] or [generateFor]. Or if [testingBuilderConfig] is
310-
// false, use the defaults. These skip some files, for example
311-
// picking up `lib/**` but not all files in the package root.
310+
// Override sources to defaults plus all explicitly passed inputs,
311+
// optionally restricted by [inputFilter] or [generateFor]. Or if
312+
// [testingBuilderConfig] is false, use the defaults. These skip some
313+
// files, for example picking up `lib/**` but not all files in the package root.
312314
testingBuilderConfig
313315
? {
314316
for (final package in inputPackages)
@@ -320,6 +322,10 @@ Future<TestBuilderResult> testBuilders(
320322
r'lib/$lib$',
321323
r'test/$test$',
322324
r'web/$web$',
325+
if (package == rootPackage)
326+
...defaultRootPackageSources,
327+
if (package != rootPackage)
328+
...defaultNonRootVisibleAssets,
323329
...inputIds
324330
.where((id) => id.package == package)
325331
.map((id) => Glob.quote(id.path)),

build_test/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: build_test
22
description: Utilities for writing unit tests of Builders.
3-
version: 3.2.0
3+
version: 3.2.1
44
repository: https://github.com/dart-lang/build/tree/master/build_test
55
resolution: workspace
66

0 commit comments

Comments
 (0)