ds_tools_testing library

Classes

BazelResolver
Bazel URI resolver.
CustomMatcher
A base class for Matcher instances that match based on some feature of the value under test.
Description
Matchers build up their error messages by appending to Description objects.
Fake
A stand-in for another object which cannot be used except for specifically overridden methods.
FakeWatcher
A fake DirectoryWatcher.
Formatter
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.
HitMap
Contains line and function hit information for a single script.
isInstanceOf<T>
DEPRECATED Use isA instead.
LcovFormatter
Converts the given hitmap to lcov format and appends the result to env.output.
Loader
Loads the lines of imported resources.
Matcher
The base class for all matchers.
MissingDummyValueError
Mock
Extend or mixin this class to mark the implementation as a Mock.
MockClient
A mock HTTP client designed for use when testing code that uses BaseClient.
OnPlatform
An annotation for platform-specific customizations for a test suite.
PackageAssetReader
Resolves using a PackageConfig before reading from the file system.
PostExpectation<T>
PrettyPrintFormatter
Converts the given hitmap to a pretty-print format and appends the result to env.output.
ReaderWriterTesting
Access to TestReaderWriter state for testing.
Resolver
Resolver resolves imports with respect to a given environment.
Retry
An annotation for marking a test suite to be retried.
Skip
An annotation for marking a test suite as skipped.
SmartFake
A slightly smarter fake to be used for return value on missing stubs. Shows a more descriptive error message to the user that mentions not only a place where a fake was used but also why it was created (i.e. which stub needs to be added).
StdoutLog
StreamMatcher
A matcher that matches events from Streams or StreamQueues.
StringDescription
The default implementation of Description. This should rarely need substitution, although conceivably it is a place where other languages could be supported.
Tags
An annotation for applying a set of user-defined tags to a test suite.
TestBuilder
A test Builder.
TestBuilderResult
TestLocation
The location of a test or group.
TestOn
An annotation indicating which platforms a test suite supports.
TestReaderWriter
In-memory implementation of AssetReader and AssetWriter.
Throws
Use the throwsA function instead.
Timeout
A class representing a modification to the default timeout for a test.
TypeMatcher<T>
A Matcher subclass that supports validating the Type of the target object.
VerificationResult
Information about a stub call verification.

Constants

anything → const Matcher
A matcher that matches any value.
isArgumentError → const TypeMatcher<ArgumentError>
A matcher for ArgumentError.
isCastError → const TypeMatcher<TypeError>
A matcher for TypeError.
isConcurrentModificationError → const TypeMatcher<ConcurrentModificationError>
A matcher for ConcurrentModificationError.
isCyclicInitializationError → const TypeMatcher<Error>
A matcher for Error.
isEmpty → const Matcher
Returns a matcher that matches the isEmpty property.
isException → const TypeMatcher<Exception>
A matcher for Exception.
isFalse → const Matcher
A matcher that matches anything except the Boolean value true.
isFormatException → const TypeMatcher<FormatException>
A matcher for FormatException.
isList → const TypeMatcher<List>
A matcher for List.
isMap → const TypeMatcher<Map>
A matcher for Map.
isNaN → const Matcher
A matcher that matches the numeric value NaN.
isNegative → const Matcher
A matcher which matches if the match argument is negative.
isNonNegative → const Matcher
A matcher which matches if the match argument is zero or positive.
isNonPositive → const Matcher
A matcher which matches if the match argument is zero or negative.
isNonZero → const Matcher
A matcher which matches if the match argument is non-zero.
isNoSuchMethodError → const TypeMatcher<NoSuchMethodError>
A matcher for NoSuchMethodError.
isNotEmpty → const Matcher
Returns a matcher that matches the isNotEmpty property.
isNotNaN → const Matcher
A matcher that matches any non-NaN value.
isNotNull → const Matcher
A matcher that matches any non-null value.
isNull → const Matcher
A matcher that matches any null value.
isNullThrownError → const TypeMatcher<TypeError>
A matcher for TypeError.
isPositive → const Matcher
A matcher which matches if the match argument is positive.
isRangeError → const TypeMatcher<RangeError>
A matcher for RangeError.
isStateError → const TypeMatcher<StateError>
A matcher for StateError.
isTrue → const Matcher
A matcher that matches the Boolean value true.
isUnimplementedError → const TypeMatcher<UnimplementedError>
A matcher for UnimplementedError.
isUnsupportedError → const TypeMatcher<UnsupportedError>
A matcher for UnsupportedError.
isZero → const Matcher
A matcher which matches if the match argument is zero.
returnsNormally → const Matcher
A matcher that matches a function call against no exception.
throws → const Matcher
This function is deprecated.
throwsArgumentError → const Matcher
A matcher for functions that throw ArgumentError.
throwsConcurrentModificationError → const Matcher
A matcher for functions that throw ConcurrentModificationError.
throwsCyclicInitializationError → const Matcher
A matcher for functions that throw CyclicInitializationError.
throwsException → const Matcher
A matcher for functions that throw Exception.
throwsFormatException → const Matcher
A matcher for functions that throw FormatException.
throwsNoSuchMethodError → const Matcher
A matcher for functions that throw NoSuchMethodError.
throwsNullThrownError → const Matcher
A matcher for functions that throw NullThrownError.
throwsRangeError → const Matcher
A matcher for functions that throw RangeError.
throwsStateError → const Matcher
A matcher for functions that throw StateError.
throwsUnimplementedError → const Matcher
A matcher for functions that throw Exception.
throwsUnsupportedError → const Matcher
A matcher for functions that throw UnsupportedError.
useAssetReader → const String
Marker constant that may be used in combination with resolveSources.

Properties

any Null
An argument matcher that matches any argument passed in this argument position.
no setter
assetNotFoundException TypeMatcher<AssetNotFoundException>
Matches instance of AssetNotFoundException.
final
captureAny Null
An argument matcher that matches any argument passed in this argument position, and captures the argument for later access with VerificationResult.captured.
no setter
completes Matcher
Matches a Future that completes successfully with any value.
final
doesNotComplete Matcher
Matches a Future that does not complete.
final
emitsDone StreamMatcher
Returns a StreamMatcher that asserts that the stream emits a "done" event.
final
invalidInputException TypeMatcher<InvalidInputException>
Matches instance of InvalidInputException.
final
invalidOutputException TypeMatcher<InvalidOutputException>
Matches instance of InvalidOutputException.
final
neverCalled Null Function([Object?, Object?, Object?, Object?, Object?, Object?, Object?, Object?, Object?, Object?])
Returns a function that causes the test to fail if it's called.
no setter
packageNotFoundException TypeMatcher<PackageNotFoundException>
Matches instance of PackageNotFoundException.
final
untilCalled → InvocationLoader
Returns a future Invocation that will complete upon the first occurrence of the given invocation.
no setter
verify Verification
Verify that a method on a mock object was called with the given arguments.
no setter
verifyInOrder List<VerificationResult> Function<T>(List<T> recordedInvocations)
Verifies that a list of methods on a mock object have been called with the given arguments. For example:
no setter
verifyNever Verification
Verify that a method on a mock object was never called with the given arguments.
no setter
when Expectation
Create a stub method response.
no setter

Functions

addAssets(Map<AssetId, dynamic> assets, TestReaderWriter writer) → void
addStateInfo(Map matchState, Map values) → void
Useful utility for nesting match states.
addTearDown(FutureOr callback()) → void
Registers a function to be run after the current test.
allOf(Object? arg0, [Object? arg1, Object? arg2, Object? arg3, Object? arg4, Object? arg5, Object? arg6]) Matcher
This returns a matcher that matches if all of the matchers passed as arguments (up to 7) match.
anyElement(Object? valueOrMatcher) Matcher
Returns a matcher which matches Iterables in which at least one element matches the given valueOrMatcher.
anyLogOf(dynamic messageOrMatcher) Matcher
Matches LogRecord of any level whose message is messageOrMatcher.
anyNamed(String named) Null
An argument matcher that matches any named argument passed in for the parameter named named.
anyOf(Object? arg0, [Object? arg1, Object? arg2, Object? arg3, Object? arg4, Object? arg5, Object? arg6]) Matcher
Matches if any of the given matchers evaluate to true.
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.
argThat(Matcher matcher, {String? named}) Null
An argument matcher that matches an argument (named or positional) that matches matcher. When capturing a named argument, the name of the argument must be passed via named.
captureAnyNamed(String named) Null
An argument matcher that matches any named argument passed in for the parameter named named, and captures the argument for later access with VerificationResult.captured.
captureThat(Matcher matcher, {String? named}) Null
An argument matcher that matches an argument (named or positional) that matches matcher, and captures the argument for later access with VerificationResult.captured. When capturing a named argument, the name of the argument must be passed via named.
checkOutputs(Map<String, Object>? outputs, Iterable<AssetId> actualAssets, TestReaderWriter writer, {AssetId mapAssetIds(AssetId id) = _passThrough}) → void
Validates that actualAssets matches the expected outputs.
clearInteractions(dynamic mock) → void
Clear the collected interactions with mock.
closeTo(num value, num delta) Matcher
Returns a matcher which matches if the match argument is within delta of some value.
collapseWhitespace(String string) String
Utility function to collapse whitespace runs to single spaces and strip leading/trailing whitespace.
collect(Uri serviceUri, bool resume, bool waitPaused, bool includeDart, Set<String>? scopedOutput, {Set<String>? isolateIds, Duration? timeout, bool functionCoverage = false, bool branchCoverage = false, Map<String, Set<int>>? coverableLineCache, VmService? serviceOverrideForTesting}) Future<Map<String, dynamic>>
Collects coverage for all isolates in the running VM.
completion(Object? matcher, [String? description]) Matcher
Matches a Future that completes successfully with a value that matches matcher.
contains(Object? expected) Matcher
Returns a matcher that matches if the match argument contains the expected value.
containsAll(Iterable expected) Matcher
Matches Iterables which contain an element matching every value in expected in any order, and may contain additional values.
containsAllInOrder(Iterable expected) Matcher
Matches Iterables which contain an element matching every value in expected in the same order, but may contain additional values interleaved throughout.
containsOnce(Object? expected) Matcher
Matches Iterables where exactly one element matches the expected value, and all other elements don't match.
containsPair(Object? key, Object? valueOrMatcher) Matcher
Returns a matcher which matches maps containing the key-value pair with key => valueOrMatcher.
containsValue(Object? value) Matcher
Returns a matcher which matches maps containing the given value.
copyFrom(AssetId assetId) BuildBehavior
A build behavior which reads assetId and copies it's content into every output.
createHitmap(List<Map<String, dynamic>> jsonResult, {bool checkIgnoredLines = false, String? packagesPath, String? packagePath}) Future<Map<String, Map<int, int>>>
Creates a single hitmap from a raw json object.
decodedMatches(dynamic expected, {Encoding? encoding}) TypeMatcher<List<int>>
Decodes the value using encoding and matches it against expected.
emits(Object? matcher) StreamMatcher
Returns a StreamMatcher for matcher.
emitsAnyOf(Iterable matchers) StreamMatcher
Returns a StreamMatcher that matches the stream if at least one of matchers matches.
emitsError(Object? matcher) StreamMatcher
Returns a StreamMatcher that matches a single error event that matches matcher.
emitsInAnyOrder(Iterable matchers) StreamMatcher
Returns a StreamMatcher that matches the stream if each matcher in matchers matches, in any order.
emitsInOrder(Iterable matchers) StreamMatcher
Returns a StreamMatcher that matches the stream if each matcher in matchers matches, one after another.
emitsThrough(Object? matcher) StreamMatcher
Returns a StreamMatcher that matches any number of events followed by events that match matcher.
endsWith(String suffixString) Matcher
Returns a matcher that matches if the match argument is a string and ends with suffixString.
equals(Object? expected, [int limit = 100]) Matcher
Returns a matcher that matches if the value is structurally equal to expected.
equalsIgnoringCase(String value) Matcher
Returns a matcher which matches if the match argument is a string and is equal to value when compared case-insensitively.
equalsIgnoringWhitespace(String value) Matcher
Returns a matcher which matches if the match argument is a string and is equal to value, ignoring whitespace.
escape(String str) String
Returns str with all whitespace characters represented as their escape sequences.
everyElement(Object? valueOrMatcher) Matcher
Returns a matcher which matches Iterables in which all elements match the given valueOrMatcher.
expect(dynamic actual, dynamic matcher, {String? reason, Object? skip, bool verbose = false, ErrorFormatter? formatter}) → void
Assert that actual matches matcher.
expectAsync(Function callback, {int count = 1, int max = 0, String? id, String? reason}) Function
This function is deprecated because it doesn't work well with strong mode. Use expectAsync0, expectAsync1, expectAsync2, expectAsync3, expectAsync4, expectAsync5, or expectAsync6 instead.
expectAsync0<T>(T callback(), {int count = 1, int max = 0, String? id, String? reason}) Func0<T>
Informs the framework that the given callback of arity 0 is expected to be called count number of times (by default 1).
expectAsync1<T, A>(T callback(A), {int count = 1, int max = 0, String? id, String? reason}) Func1<T, A>
Informs the framework that the given callback of arity 1 is expected to be called count number of times (by default 1).
expectAsync2<T, A, B>(T callback(A, B), {int count = 1, int max = 0, String? id, String? reason}) Func2<T, A, B>
Informs the framework that the given callback of arity 2 is expected to be called count number of times (by default 1).
expectAsync3<T, A, B, C>(T callback(A, B, C), {int count = 1, int max = 0, String? id, String? reason}) Func3<T, A, B, C>
Informs the framework that the given callback of arity 3 is expected to be called count number of times (by default 1).
expectAsync4<T, A, B, C, D>(T callback(A, B, C, D), {int count = 1, int max = 0, String? id, String? reason}) Func4<T, A, B, C, D>
Informs the framework that the given callback of arity 4 is expected to be called count number of times (by default 1).
expectAsync5<T, A, B, C, D, E>(T callback(A, B, C, D, E), {int count = 1, int max = 0, String? id, String? reason}) Func5<T, A, B, C, D, E>
Informs the framework that the given callback of arity 5 is expected to be called count number of times (by default 1).
expectAsync6<T, A, B, C, D, E, F>(T callback(A, B, C, D, E, F), {int count = 1, int max = 0, String? id, String? reason}) Func6<T, A, B, C, D, E, F>
Informs the framework that the given callback of arity 6 is expected to be called count number of times (by default 1).
expectAsyncUntil0<T>(T callback(), bool isDone(), {String? id, String? reason}) Func0<T>
Informs the framework that the given callback of arity 0 is expected to be called until isDone returns true.
expectAsyncUntil1<T, A>(T callback(A), bool isDone(), {String? id, String? reason}) Func1<T, A>
Informs the framework that the given callback of arity 1 is expected to be called until isDone returns true.
expectAsyncUntil2<T, A, B>(T callback(A, B), bool isDone(), {String? id, String? reason}) Func2<T, A, B>
Informs the framework that the given callback of arity 2 is expected to be called until isDone returns true.
expectAsyncUntil3<T, A, B, C>(T callback(A, B, C), bool isDone(), {String? id, String? reason}) Func3<T, A, B, C>
Informs the framework that the given callback of arity 3 is expected to be called until isDone returns true.
expectAsyncUntil4<T, A, B, C, D>(T callback(A, B, C, D), bool isDone(), {String? id, String? reason}) Func4<T, A, B, C, D>
Informs the framework that the given callback of arity 4 is expected to be called until isDone returns true.
expectAsyncUntil5<T, A, B, C, D, E>(T callback(A, B, C, D, E), bool isDone(), {String? id, String? reason}) Func5<T, A, B, C, D, E>
Informs the framework that the given callback of arity 5 is expected to be called until isDone returns true.
expectAsyncUntil6<T, A, B, C, D, E, F>(T callback(A, B, C, D, E, F), bool isDone(), {String? id, String? reason}) Func6<T, A, B, C, D, E, F>
Informs the framework that the given callback of arity 6 is expected to be called until isDone returns true.
expectLater(dynamic actual, dynamic matcher, {String? reason, Object? skip}) Future
Just like expect, but returns a Future that completes when the matcher has finished matching.
fail(String message) → Never
Convenience method for throwing a new TestFailure with the provided message.
greaterThan(Object value) Matcher
Returns a matcher which matches if the match argument is greater than the given value.
greaterThanOrEqualTo(Object value) Matcher
Returns a matcher which matches if the match argument is greater than or equal to the given value.
group(Object? description, void body(), {String? testOn, Timeout? timeout, Object? skip, Object? tags, Map<String, dynamic>? onPlatform, int? retry, TestLocation? location, bool solo = false}) → void
Creates a group of tests.
hasLength(Object? matcher) Matcher
Returns a matcher that matches if an object has a length property that matches matcher.
inClosedOpenRange(num low, num high) Matcher
Returns a matcher which matches if the match argument is greater than or equal to a low and less than high.
inExclusiveRange(num low, num high) Matcher
Returns a matcher which matches if the match argument is greater than low and less than high.
infoLogOf(dynamic messageOrMatcher) Matcher
Matches LogRecord of Level.INFO where message is messageOrMatcher.
inInclusiveRange(num low, num high) Matcher
Returns a matcher which matches if the match argument is greater than or equal to low and less than or equal to high.
inOpenClosedRange(num low, num high) Matcher
Returns a matcher which matches if the match argument is greater than low and less than or equal to high.
isA<T>() TypeMatcher<T>
Returns a matcher that matches objects with type T.
isIn(Object? expected) Matcher
Returns a matcher that matches if the match argument is in the expected value. This is the converse of contains.
isNot(Object? valueOrMatcher) Matcher
Returns a matcher that inverts valueOrMatcher to its logical negation.
isSorted<T extends Comparable<T>>() Matcher
Matches Iterables which are sorted.
isSortedBy<T, K extends Comparable<K>>(K keyOf(T)) Matcher
Matches Iterables which are sorted by the keyOf property.
isSortedByCompare<T, K>(K keyOf(T), Comparator<K> compare) Matcher
Matches Iterables which are compare-sorted by their keyOf property.
isSortedUsing<T>(Comparator<T> compare) Matcher
Matches Iterables which are compare-sorted.
lessThan(Object value) Matcher
Returns a matcher which matches if the match argument is less than the given value.
lessThanOrEqualTo(Object value) Matcher
Returns a matcher which matches if the match argument is less than or equal to the given value.
logInvocations(List<Mock> mocks) → void
Print all collected invocations of any mock methods of mocks.
makeAssetId([String? assetIdString]) → AssetId
markTestSkipped(String message) → void
Marks the current test as skipped.
matches(Pattern re) Matcher
Returns a matcher that matches if the match argument is a string and matches the regular expression given by re.
mayEmit(Object? matcher) StreamMatcher
Returns a StreamMatcher that allows (but doesn't require) matcher to match the stream.
mayEmitMultiple(Object? matcher) StreamMatcher
Returns a StreamMatcher that matches any number of events that match matcher.
mergeHitmaps(Map<String, Map<int, int>> newMap, Map<String, Map<int, int>> result) → void
Merges newMap into result.
named<T extends Mock>(T mock, {String? name, int? hashCode}) → T
neverEmits(Object? matcher) StreamMatcher
Returns a StreamMatcher that matches a stream that never matches matcher.
orderedEquals(Iterable expected) Matcher
Returns a matcher which matches Iterables that have the same length and the same elements as expected, in the same order.
pairwiseCompare<S, T>(Iterable<S> expected, bool comparator(S, T), String description) Matcher
A pairwise matcher for Iterables.
parseChromeCoverage(List<Map<String, dynamic>> preciseCoverage, Future<String?> sourceProvider(String scriptId), Future<String?> sourceMapProvider(String scriptId), Future<Uri?> sourceUriProvider(String sourceUrl, String scriptId)) Future<Map<String, dynamic>>
Returns a Dart based hit-map containing coverage report for the provided Chrome preciseCoverage.
parseCoverage(Iterable<File> files, int _, {bool checkIgnoredLines = false, String? packagesPath, String? packagePath}) Future<Map<String, Map<int, int>>>
Generates a merged hitmap from a set of coverage JSON files.
predicate<T>(bool f(T), [String description = 'satisfies function']) Matcher
Returns a matcher that uses an arbitrary function that returns whether the value is considered a match.
printOnFailure(String message) → void
Prints message if and when the current test fails.
prints(Object? matcher) Matcher
Matches a Function that prints text that matches matcher.
provideDummy<T>(T dummy) → void
Provide a dummy value for T to be used both while adding expectations and as a default value for unstubbed methods, if using a nice mock.
provideDummyBuilder<T>(DummyBuilder<T> dummyBuilder) → void
Provide a builder for that could create a dummy value of type T. This could be useful for nice mocks, such that information about the specific invocation that caused the creation of a dummy value could be preserved.
pumpEventQueue({int times = 20}) Future
Returns a Future that completes after the event loop has run the given number of times (20 by default).
recordLogs(dynamic run(), {String name = ''}) Stream<LogRecord>
Executes run with a new Logger, returning the resulting log records.
registerException(Object error, [StackTrace stackTrace = StackTrace.empty]) → void
Registers an exception that was caught for the current test.
replaceExtension(String from, String to) Map<String, List<String>>
reset(dynamic mock) → void
Clear stubs of, and collected interactions with mock.
resetMockitoState() → void
Reset the state of Mockito, typically for use between tests.
resolveAsset<T>(AssetId inputId, FutureOr<T> action(Resolver resolver), {PackageConfig? packageConfig, Set<AssetId>? nonInputsToReadFromFilesystem, bool? readAllSourcesFromFilesystem, 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, Set<AssetId>? nonInputsToReadFromFilesystem, bool? readAllSourcesFromFilesystem, 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, Set<AssetId>? nonInputsToReadFromFilesystem, bool? readAllSourcesFromFilesystem, String? resolverFor, String? rootPackage, FutureOr<void> assetReaderChecks(TestReaderWriter)?, Future<void>? tearDown, Resolvers? resolvers}) Future<T>
Resolves and runs action using a created resolver for inputs.
runAndCollect(String scriptPath, {List<String>? scriptArgs, bool checked = false, bool includeDart = false, Duration? timeout}) Future<Map<String, dynamic>>
same(Object? expected) Matcher
Returns a matches that matches if the value is the same instance as expected, using identical.
setUp(FutureOr callback()) → void
Registers a function to be run before tests.
setUpAll(FutureOr callback(), {TestLocation? location}) → void
Registers a function to be run once before all tests.
severeLogOf(dynamic messageOrMatcher) Matcher
Matches LogRecord of Level.SEVERE where message is messageOrMatcher.
spawnHybridCode(String dartCode, {Object? message, bool stayAlive = false}) → StreamChannel
Spawns a VM isolate that runs the given dartCode, which is loaded as the contents of a Dart library.
spawnHybridUri(Object uri, {Object? message, bool stayAlive = false}) → StreamChannel
Spawns a VM isolate for the given uri, which may be a Uri or a String.
startsWith(String prefixString) Matcher
Returns a matcher that matches if the match argument is a string and starts with prefixString.
stringContainsInOrder(List<String> substrings) Matcher
Returns a matcher that matches if the match argument is a string and contains a given list of substrings in relative order.
tearDown(FutureOr callback()) → void
Registers a function to be run after tests.
tearDownAll(FutureOr callback(), {TestLocation? location}) → void
Registers a function to be run once after all tests.
test(Object? description, FutureOr body(), {String? testOn, Timeout? timeout, Object? skip, Object? tags, Map<String, dynamic>? onPlatform, int? retry, TestLocation? location, bool solo = false}) → void
Creates a new test case with the given description (converted to a string) and body.
testBuilder(Builder builder, Map<String, Object> sourceAssets, {Set<String>? generateFor, bool isInput(String assetId)?, String? rootPackage, Map<String, Object>? outputs, void onLog(LogRecord log)?, void reportUnusedAssetsForInput(AssetId, Iterable<AssetId>)?, PackageConfig? packageConfig, Resolvers? resolvers, TestReaderWriter? readerWriter, bool verbose = false, bool enableLowResourceMode = false, bool flattenOutput = false}) Future<TestBuilderResult>
Runs builder in a test environment.
testBuilderFactories(Iterable<BuilderFactory> builderFactories, Map<String, Object> sourceAssets, {Iterable<PostProcessBuilderFactory> postProcessBuilderFactories = const [], Set<String>? generateFor, bool isInput(String assetId)?, String? rootPackage, Map<String, Object>? outputs, void onLog(LogRecord log)?, void reportUnusedAssetsForInput(AssetId, Iterable<AssetId>)?, PackageConfig? packageConfig, Resolvers? resolvers, Set<BuilderFactory> optionalBuilderFactories = const {}, Set<BuilderFactory> visibleOutputBuilderFactories = const {}, Map<BuilderFactory, List<String>> appliesBuilders = const {}, bool testingBuilderConfig = true, TestReaderWriter? readerWriter, bool verbose = false, bool enableLowResourceMode = false, bool flattenOutput = false}) Future<TestBuilderResult>
Runs builders from builderFactories and postProcessBuilderFactories in a test environment.
testBuilders(Iterable<Builder> builders, Map<String, Object> sourceAssets, {Iterable<PostProcessBuilder> postProcessBuilders = const [], Set<String>? generateFor, bool isInput(String assetId)?, String? rootPackage, Map<String, Object>? outputs, void onLog(LogRecord log)?, void reportUnusedAssetsForInput(AssetId, Iterable<AssetId>)?, PackageConfig? packageConfig, Resolvers? resolvers, Set<Builder> optionalBuilders = const {}, Set<Builder> visibleOutputBuilders = const {}, Map<Builder, List<String>> appliesBuilders = const {}, bool testingBuilderConfig = true, TestReaderWriter? readerWriter, bool verbose = false, bool enableLowResourceMode = false, bool flattenOutput = false}) Future<TestBuilderResult>
Runs builders and postProcessBuilders in a test environment.
throwOnMissingStub(Mock mock, {void exceptionBuilder(Invocation)?}) → void
Opt-into Mock throwing NoSuchMethodError for unimplemented methods.
throwsA(Object? matcher) Matcher
This can be used to match three kinds of objects:
toScriptCoverageJson(Uri scriptUri, Map<int, int> hitMap) Map<String, dynamic>
Returns a JSON hit map backward-compatible with pre-1.16.0 SDKs.
unorderedEquals(Iterable expected) Matcher
Returns a matcher which matches Iterables that have the same length and the same elements as expected, but not necessarily in the same order.
unorderedMatches(Iterable expected) Matcher
Returns a matcher which matches Iterables whose elements match the matchers in expected, but not necessarily in the same order.
verifyNoMoreInteractions(dynamic mock) → void
verifyZeroInteractions(dynamic mock) → void
warningLogOf(dynamic messageOrMatcher) Matcher
Matches LogRecord of Level.WARNING where message is messageOrMatcher.
wrapMatcher(Object? valueOrMatcher) Matcher
Takes an argument and returns an equivalent Matcher.
writeCanRead(AssetId assetId) BuildBehavior
A build behavior which writes either 'true' or 'false' depending on whether assetId can be read.

Typedefs

Answering<T> = T Function(Invocation realInvocation)
BuildBehavior = FutureOr Function(BuildStep buildStep, Map<String, List<String>> buildExtensions)
Overridable behavior for a Builder.build method.
ErrorFormatter = String Function(Object? actual, Matcher matcher, String? reason, Map matchState, bool verbose)
The type used for functions that can be used to build up error reports upon failures in expect.
Expectation = PostExpectation<T> Function<T>(T x)
Func0<T> = T Function()
Func1<T, A> = T Function([A a])
Func2<T, A, B> = T Function([A a, B b])
Func3<T, A, B, C> = T Function([A a, B b, C c])
Func4<T, A, B, C, D> = T Function([A a, B b, C c, D d])
Func5<T, A, B, C, D, E> = T Function([A a, B b, C c, D d, E e])
Func6<T, A, B, C, D, E, F> = T Function([A a, B b, C c, D d, E e, F f])
Verification = VerificationResult Function<T>(T matchingInvocations)

Exceptions / Errors

FakeFunctionUsedError
FakeUsedError
MissingStubError
An error which is thrown when no stub is found which matches the arguments of a real method call on a mock object.
TestFailure
An exception thrown when a test assertion fails.