[flutter_tools] throw a tool exit if pub cannot be run (#83293)
This commit is contained in:
@@ -22,6 +22,31 @@ void main() {
|
||||
Cache.flutterRoot = '';
|
||||
});
|
||||
|
||||
testWithoutContext('Throws a tool exit if pub cannot be run', () async {
|
||||
final FakeProcessManager processManager = FakeProcessManager.empty();
|
||||
final BufferLogger logger = BufferLogger.test();
|
||||
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
|
||||
processManager.excludedExecutables.add('bin/cache/dart-sdk/bin/pub');
|
||||
|
||||
fileSystem.file('pubspec.yaml').createSync();
|
||||
|
||||
final Pub pub = Pub(
|
||||
fileSystem: fileSystem,
|
||||
logger: logger,
|
||||
processManager: processManager,
|
||||
usage: TestUsage(),
|
||||
platform: FakePlatform(
|
||||
environment: const <String, String>{},
|
||||
),
|
||||
botDetector: const BotDetectorAlwaysNo(),
|
||||
);
|
||||
|
||||
await expectLater(() => pub.get(
|
||||
context: PubContext.pubGet,
|
||||
checkUpToDate: true,
|
||||
), throwsToolExit(message: 'Your Flutter SDK download may be corrupt or missing permissions to run'));
|
||||
});
|
||||
|
||||
testWithoutContext('checkUpToDate skips pub get if the package config is newer than the pubspec '
|
||||
'and the current framework version is the same as the last version', () async {
|
||||
final FakeProcessManager processManager = FakeProcessManager.empty();
|
||||
|
||||
Reference in New Issue
Block a user