build_test library Null safety

Classes

FakeWatcher
A fake DirectoryWatcher. [...]
GlobbingBuilder
A simple builder which globs files in a package and outputs a file that lists each matching file in alphabetical order into another file, one per line.
InMemoryAssetReader
An implementation of AssetReader with primed in-memory assets.
InMemoryAssetWriter
An implementation of AssetWriter that writes outputs to memory.
MultiAssetReader
A MultiPackageAssetReader that delegates to multiple other asset readers. [...]
PackageAssetReader
Resolves using a PackageConfig before reading from the file system. [...]
RecordingAssetReader
An AssetReader that records which assets have been read to assetsRead.
RecordingAssetWriter
An implementation of AssetWriter that records outputs to assets.
StubAssetReader
A no-op implementation of AssetReader.
StubAssetWriter
A no-op implementation of AssetWriter.
TestBuilder
A Builder whose build method can be replaced with a closure.
WrittenAssetReader
A MultiPackageAssetReader which supports reads from previous outputs.

Constants

useAssetReader → const String
Marker constant that may be used in combination with resolveSources. [...]
'__useAssetReader__'

Properties

assetNotFoundException TypeMatcher<AssetNotFoundException>
Matches instance of AssetNotFoundException.
final
invalidInputException TypeMatcher<InvalidInputException>
Matches instance of InvalidInputException.
final
invalidOutputException TypeMatcher<InvalidOutputException>
Matches instance of InvalidOutputException.
final
packageNotFoundException TypeMatcher<PackageNotFoundException>
Matches instance of PackageNotFoundException.
final

Functions

addAssets(Map<AssetId, dynamic> assets, InMemoryAssetWriter writer) → void
anyLogOf(dynamic messageOrMatcher) Matcher
Matches LogRecord of any level whose message is messageOrMatcher. [...]
appendExtension(String postFix, {String from = '', int numCopies = 1}) Map<String, List<String>>
A Builder.buildExtensions which operats on assets ending in from and creates outputs with postFix appended as the extension. [...]
checkOutputs(Map<String, Object>? outputs, Iterable<AssetId> actualAssets, RecordingAssetWriter writer, {AssetId mapAssetIds(AssetId id) = _passThrough}) → void
Validates that actualAssets matches the expected outputs. [...]
copyFrom(AssetId assetId) BuildBehavior
A build behavior which reads assetId and copies it's content into every output.
decodedMatches(dynamic expected, {Encoding? encoding}) TypeMatcher<List<int>>
Decodes the value using encoding and matches it against expected.
infoLogOf(dynamic messageOrMatcher) Matcher
Matches LogRecord of Level.INFO where message is messageOrMatcher.
makeAssetId([String? assetIdString]) AssetId
recordLogs(dynamic run(), {String name = ''}) Stream<LogRecord>
Executes run with a new Logger, returning the resulting log records. [...]
replaceExtension(String from, String to) Map<String, List<String>>
resolveAsset<T>(AssetId inputId, FutureOr<T> action(Resolver resolver), {PackageConfig? packageConfig, Future<void>? tearDown, Resolvers? resolvers}) Future<T>
A convenience for using resolveSources with a single inputId from disk.
resolveSource<T>(String inputSource, FutureOr<T> action(Resolver resolver), {AssetId? inputId, PackageConfig? packageConfig, Future<void>? tearDown, Resolvers? resolvers}) Future<T>
A convenience method for using resolveSources with a single source file.
resolveSources<T>(Map<String, String> inputs, FutureOr<T> action(Resolver resolver), {PackageConfig? packageConfig, String? resolverFor, String? rootPackage, Future<void>? tearDown, Resolvers? resolvers}) Future<T>
Resolves and runs action using a created resolver for inputs. [...]
scopeLogAsync<T>(Future<T> fn(), Logger log) Future<T>
Runs fn in an error handling Zone. [...]
severeLogOf(dynamic messageOrMatcher) Matcher
Matches LogRecord of Level.SEVERE where message is messageOrMatcher.
testBuilder(Builder builder, Map<String, Object> sourceAssets, {Set<String>? generateFor, bool isInput(String assetId)?, String? rootPackage, MultiPackageAssetReader? reader, RecordingAssetWriter? writer, Map<String, Object>? outputs, void onLog(LogRecord log)?, void reportUnusedAssetsForInput(AssetId, Iterable<AssetId>)?, PackageConfig? packageConfig}) Future
Runs builder in a test environment. [...]
warningLogOf(dynamic messageOrMatcher) Matcher
Matches LogRecord of Level.WARNING where message is messageOrMatcher.
writeCanRead(AssetId assetId) BuildBehavior
A build behavior which writes either 'true' or 'false' depending on whether assetId can be read.

Typedefs

BuildBehavior = FutureOr Function(BuildStep buildStep, Map<String, List<String>> buildExtensions)
Overridable behavior for a Builder.build method.