NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
pub.dev · #850 most downloaded on pub.dev
Utilities for writing unit tests of Builders.
Last release 1 months ago
02 Sep 2026
Ships fairly regularly
a new release about every 3 weeks
Nearly every release is documented
notes for 58 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
117 releases · first in 2016
Removed dependency on package:package_resolver, changed to package:package_config.
package:package_resolver, changed to
package:package_config.
PackageResolver now take a PackageConfig.2.7.0.Allow the latest test_core package (0.3.x).
0.3.x).One column per quarter.
Fix a bug with the resolve* apis where they would leak unhandled async errors to client code if the provided action callback threw an error.
resolve* apis where they would leak unhandled async
errors to client code if the provided action callback threw an error.This is being released as a non-breaking change because the only expected use cases already would have been broken - findAssets calls already required…
$package$ placeholder.findAssets calls already
required a root package.Allow reading of assets written from the same build step.
2.6.0 to enable extension methods.Fix the DebugTestBuilder on windows.
DebugTestBuilder on windows.PackageAssetReader on windows.Allow tracking of reported unused assets in testBuilder calls with the reportUnusedAssetsForInput(AssetId input, Iterable unused) callback.
testBuilder calls with the
reportUnusedAssetsForInput(AssetId input, Iterable<AssetId> unused)
callback.Allow a custom AssetReader to be passed to testBuilder. This will be used as a fallback for any sources that don't exist in the sourceAssets map.
testBuilder. This will be used
as a fallback for any sources that don't exist in the sourceAssets map.- Allow build_config 0.4.x.
build_config 0.4.x.Avoid throwing for missing files from PackageAssetReader.canRead.
PackageAssetReader.canRead.Handle the case where the root package in a PackageAssetReader is a fake package.
PackageAssetReader is a fake
package.Support the latest version of package:html.
package:html.TestOn
annotations.Allow build_resolvers version 1.0.0.
1.0.0.Improve error messages for unresolvable URIs in the PackageAssetReader.
Allow using PackageAssetReader when the current working directory is not the root package directory as long as it uses a pub layout.
PackageAssetReader when the current working directory is not the
root package directory as long as it uses a pub layout.Increased the upper bound for the sdk to <3.0.0.
<3.0.0.Declare support for package:build version 1.0.0.
package:build version 1.0.0.Increased the upper bound for package:analyzer to '<0.34.0'.
package:analyzer to '<0.34.0'.Increased the upper bound for package:analyzer to <0.35.0.
package:analyzer to <0.35.0.Require test version ^0.12.42 and use TypeMatcher.
TypeMatcher.Resolver by keeping a cached
instance of AnalyzerResolvers.Add back an implementation of findAssets in PackageAssetReader.
findAssets in PackageAssetReader.Avoid looking for files from Uri.path paths.
Uri.path paths.Remove package:build_barback dependency, and use public apis from package:test to directly do the bootstrapping instead of wrapping the transformer.
- Allow the latest build_config.
Nothing published for this version
Added a DebugIndexBuilder, which by default generates a test/index.html with links to debug tests in your test/_test.dart folder, linking to the gener
DebugIndexBuilder, which by default generates a test/index.html
with links to debug tests in your test/**_test.dart folder, linking to the
generated *_test.debug.html files. NOTE: This only works for web-based
tests.PackageAssetReader when running with a package map pointing to a
"packages" directory structure, as is generated by build_runner. Drop
support for a broken findAssets implementation.Replace BarbackResolvers with AnalyzerResolvers from build_resolvers by default.
BarbackResolvers with AnalyzerResolvers from build_resolvers by
default.Allow overriding the Resolvers used for resolve* utilities.
Resolvers used for resolve* utilities.action multiple times when there are multiple
sources passed to resolve*.For an example see test/test_builder_test.dart. Note that this is technically a BREAKING CHANGE, as additional inputs will be matched for overzealous…
.debug.html files for all tests, which can
be loaded in the browser to directly run tests and debug them without going
through the package:test runner.0.12.0.CopyBuilder in favor of TestBuilder which takes closures to
change behavior rather than adding configuration for every possible
modification.{$lib/$test/$web} assets
supported by the build_runner and bazel_codegen implementations of
package:build. For an example see test/test_builder_test.dart. Note that
this is technically a BREAKING CHANGE, as additional inputs will be
matched for overzealous builders (like TestBuilder).resolverFor as an optional parameter to resolveSources. By default
a Resolver is returned for the first asset provided; to modify that the
name of another asset may be provided. This is a BREAKING CHANGE, as
previously the last asset was used.This is technically breaking but should not affect any real users and is not being released as a breaking change.
InMemoryAssetReader.shareAssetCache constructor. This is useful for the
case where the reader should be kept up to date as assets are written through
a writer.buildInputs stream to CopyBuilder which emits an event for each
BuildStep.inputId at the top of the build method.CopyBuilder automatically skips the placeholder files (any file ending in
$). This is technically breaking but should not affect any real users and is
not being released as a breaking change.TestBootstrapBuilder to only target _test.dart files.Added resolveSources, a way to resolve multiple libraries for testing, including any combination of fake files (in-memory, created in the test) and re
resolveSources, a way to resolve multiple libraries for testing,
including any combination of fake files (in-memory, created in the test) and
real ones (from on-disk packages):test('multiple assets, some mock, some on disk', () async {
final real = 'build_test|test/_files/example_lib.dart';
final mock = 'build_test|test/_files/not_really_here.dart';
final library = await resolveSources(
{
real: useAssetReader,
mock: r'''
// This is a fake library that we're mocking.
library example;
// This is a real on-disk library we are using.
import 'example_lib.dart';
class ExamplePrime extends Example {}
''',
},
(resolver) => resolver.findLibraryByName('example'),
);
final type = library.getType('ExamplePrime');
expect(type, isNotNull);
expect(type.supertype.name, 'Example');
});
Add inputExtension argument to CopyBuilder. When used the builder with throw if any assets are provided that don't match the input extension.
inputExtension argument to CopyBuilder. When used the builder with
throw if any assets are provided that don't match the input extension.Allow build_barback version 0.5.x. The breaking behavior change should not impact test uses that don't already have a version constraint on that packa
build_barback version 0.5.x. The breaking behavior change should not
impact test uses that don't already have a version constraint on that package.Added the TestBootstrapBuilder under the builder.dart library. This can be used to bootstrap tests similar to the test/pub_serve Transformer.
TestBootstrapBuilder under the builder.dart library. This can
be used to bootstrap tests similar to the test/pub_serve Transformer.
AssetReader#findAssets implementations now return a
Stream<AssetId> to match the latest build package.DatedValue, DatedString, and DatedBytes apis are now
gone, since timestamps are no longer used by package:build. Instead the
InMemoryAssetReader and other apis take a Map<AssetId, dynamic>, and will
automatically convert any String values into List<int> values.outputs map of testBuilder works a little bit
differently due to the removal of DatedValue and DatedString.
String, then the asset is by default decoded
using UTF8, and matched against the string.matcher, it will match againt the actual bytes of the
asset (in List<int> form).decodedMatches, which can be combined with other
matchers to match against the string contents. For example, to match a
string containing a substring, you would do
decodedMatches(contains('some substring')).InMemoryAssetReader, MultiAssetReader, StubAssetReader and PackageAssetReader now implement the MultiPackageAssetReader interface.
InMemoryAssetReader, MultiAssetReader, StubAssetReader and
PackageAssetReader now implement the MultiPackageAssetReader interface.testBuilder now supports Builders that call findAssets in non-root
packages.GlobbingBuilder which globs files in a package.RecordingAssetReader interface, which adds the
Iterable<AssetId> get assetsRead getter.InMemoryAssetReader now implements RecordingAssetReader.MultiAssetReader now requires all its wrapped readers to
implement the MultiPackageAssetReader interface.
Add mapAssetIds argument to checkOutputs for cases where the logical asset location recorded by the builder does not match the written location.
Add mapAssetIds argument to checkOutputs for cases where the logical asset
location recorded by the builder does not match the written location.
Add recordLogs, a top-level function that invokes scopeLog and captures
the resulting Stream<LogRecord> for testing. Can be used with the provided
anyLogOf, infoLogOf, warningLogOf, severeLogOf matchers in order to
test a build process:
test('should log "uh oh!"', () async {
final logs = recordLogs(() => runBuilder());
expect(logs, emitsInOrder([
anyLogOf('uh oh!'),
]);
});
forPackages and forPackageRoot to
PackageAssetReader - these are convenience constructors for pointing to a
small set of packages (fake or real) for testing purposes. For example:test('should resolve multiple libraries', () async {
reader = new PackageAssetReader.forPackages({
'example_a': '_libs/example_a',
'example_b': '_libs/example_b',
});
expect(await reader.canRead(fileFromExampleLibA), isTrue);
expect(await reader.canRead(fileFromExampleLibB), isTrue);
expect(await reader.canRead(fileFromExampleLibC), isFalse);
});
Switch to a typedef from function type syntax for compatibility with older SDKs.
Breaking: resolveSource and resolveAsset now take an action to perform with the Resolver instance.
resolveSource and resolveAsset now take an action to
perform with the Resolver instance.Allow package:build_barback v0.4.x
package:build_barback v0.4.xAssetReader implementations always return Future from canRead
package:build v0.10.xAssetReader implementations always return Future from canReadAdded resolveAsset, which is similar to resolveSource but specifies a real asset that lives on the file system. For example, to resolve the main libra
resolveAsset, which is similar to resolveSource but specifies a
real asset that lives on the file system. For example, to resolve the main
library of package:collection:var pkgCollection = new AssetId('collection', 'lib/collection.dart');
var resolver = await resolveAsset(pkgCollection);
// ...
package:build_barback >=0.2.0 <0.4.0.- Internal version bump.
Declare an output extension in _ResolveSourceBuilder so it is not skipped
_ResolveSourceBuilder so it is not skippedRename hasInput to canRead in AssetReader implementations
hasInput to canRead in AssetReader implementationsdeclareOutputs with buildExtensions in Builder implementationsCopyBuilder no longer has an outputPackage field since outputs
can only ever be in the same package as inputs.Add MultiAssetReader to the public API.
MultiAssetReader to the public API.Add PackageAssetReader, a standalone asset reader that uses a PackageResolver to map an AssetId to a location on disk.
PackageAssetReader, a standalone asset reader that uses a
PackageResolver to map an AssetId to a location on disk.resolveSource, a top-level function that can resolve arbitrary Dart
source code. This can be useful in testing your own code that uses a
Resolver to do type checks.Make scopeLog visible so tests can be run with an available log without going through runBuilder.
scopeLog visible so tests can be run with an available log without
going through runBuilder.Bug Fix: Correctly identify missing outputs in testBuilder
Updates to work with build version 0.7.0.
Updates to work with build version 0.7.0.
testBuilder method now accepts List<int> values for both
sourceAssets and outputs.checkOutputs method is now public.testBuilder method now requires a RecordingAssetWriter instead of
just an AssetWriter for the writer parameter.Matcher is provided as a value in outputs, then it will match against
the same value that was written. For example if your builder uses
writeAsString then it will match against that string. If you use
writeAsBytes then it will match against those bytes. It will not
automatically convert to/from bytes and strings.makeAsset and makeAssets methods. There is no more Asset
class so these don't really have any value any more.addAssets has changed to
void addAssets(Map<AssetId, dynamic> assets, InMemoryAssetWriter writer).
Values of the map may be either String or List<int>.InMemoryAssetReader#assets and InMemoryAssetWriter#assets have changed to
a type of Map<AssetId, DatedValue> from a type of
Map<AssetId, DatedString>. DatedValue has both a stringValue and
bytesValue getter.InMemoryAssetReader and InMemoryAssetWriter have been updated to implement
the new AssetReader and AssetWriter interfaces (see the build package
CHANGELOG for more details).InMemoryAssetReader#cacheAsset has been changed to two separate methods,
void cacheStringAsset(AssetId id, String contents) and
void cacheBytesAsset(AssetId id, List<int> bytes).equalsAsset matcher has been removed, since there is no more Asset
class.Additional capabilities in testBuilder:
isInputoutputs is nullwriterBREAKING removed testPhases utility. Tests should be using testBuilder
Support the package split into build/build_runner/build_barback
Nothing published for this version
Delete now unnecessary GenericBuilderTransformer and use BuilderTransformer in the tests.
GenericBuilderTransformer and use
BuilderTransformer in the tests.Add logLevel and onLog named args to testPhases. These can be used to test your log messages, see test/utils_test.dart for an example.
logLevel and onLog named args to testPhases. These can be used
to test your log messages, see test/utils_test.dart for an example.Allow String or Matcher for expected output values in testPhases.
testPhases.Initial version, exposes many basic utilities for testing Builders using in memory data structures. Most notably, the testPhases method.
Builders using in
memory data structures. Most notably, the testPhases method.Your coding agent can read these notes before it upgrades. Set up the MCP server →