Always fake ProcessManager when you fake Filesystem in tests (#42369)
...because otherwise, processes that think they're manipulating your
filesystem will be doing crazy things the test is ignoring, leading to
(at best) failures and (at worst) flakes or disk corruption.
diff --git a/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart b/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart
index 57ca558..f4079cd 100644
--- a/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart
+++ b/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart
@@ -166,9 +166,9 @@
pretendPodVersionIs('1.8.0');
expect(await cocoaPodsUnderTest.isCocoaPodsInitialized, isTrue);
}, overrides: <Type, Generator>{
- ProcessManager: () => mockProcessManager,
Platform: () => FakePlatform(),
FileSystem: () => fs,
+ ProcessManager: () => mockProcessManager,
});
});
@@ -179,6 +179,7 @@
expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Objective-C iOS podfile template');
}, overrides: <Type, Generator>{
FileSystem: () => fs,
+ ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
});
testUsingContext('creates swift Podfile if swift', () async {
@@ -194,6 +195,7 @@
expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Swift iOS podfile template');
}, overrides: <Type, Generator>{
FileSystem: () => fs,
+ ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
XcodeProjectInterpreter: () => mockXcodeProjectInterpreter,
});
@@ -204,6 +206,7 @@
expect(projectUnderTest.macos.podfile.readAsStringSync(), 'macOS podfile template');
}, overrides: <Type, Generator>{
FileSystem: () => fs,
+ ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
});
testUsingContext('does not recreate Podfile when already present', () async {
@@ -215,6 +218,7 @@
expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Existing Podfile');
}, overrides: <Type, Generator>{
FileSystem: () => fs,
+ ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
});
testUsingContext('does not create Podfile when we cannot interpret Xcode projects', () async {
@@ -226,6 +230,7 @@
expect(projectUnderTest.ios.podfile.existsSync(), false);
}, overrides: <Type, Generator>{
FileSystem: () => fs,
+ ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
XcodeProjectInterpreter: () => mockXcodeProjectInterpreter,
});
@@ -251,6 +256,7 @@
expect(releaseContents, contains('Existing release config'));
}, overrides: <Type, Generator>{
FileSystem: () => fs,
+ ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
});
});
@@ -279,6 +285,7 @@
expect(releaseContents, contains('Existing release config'));
}, overrides: <Type, Generator>{
FileSystem: () => fs,
+ ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
});
});