fake<T> static method
Future<T>
fake<T>(
- Future<
T> body(- ProcessFake fake
- Map<
String, ProcessResultData> stubs = const {},
Runs body with no real processes: stubs answer commands that match,
where * is anything, and the others succeed with no output. It lives
in the zone, so parallel tests do not see each other's.
Implementation
static Future<T> fake<T>(
Future<T> Function(ProcessFake fake) body, {
Map<String, ProcessResultData> stubs = const {},
}) {
final fake = ProcessFake(stubs);
return runZoned(() => body(fake), zoneValues: {_fakeKey: fake});
}