chore(shorebird_cli): improve error message when Flutter project does not support macOS (#2777)

This commit is contained in:
Felix Angelov
2025-01-16 16:04:22 -06:00
committed by GitHub
parent a5c9edf9bb
commit 048ec1b7ba
2 changed files with 13 additions and 2 deletions
@@ -48,8 +48,13 @@ class MacosNetworkEntitlementValidator extends Validator {
String get description => 'macOS app has Outgoing Connections entitlement';
@override
bool canRunInCurrentContext() =>
_macosDirectory != null && _macosDirectory!.existsSync();
bool canRunInCurrentContext() => _macosDirectory?.existsSync() ?? false;
@override
String? get incorrectContextMessage => '''
The ${_macosDirectory?.path ?? 'macos'} directory does not exist.
The command you are running must be run within a Flutter app project that supports the macOS platform.''';
@override
Future<List<ValidationIssue>> validate() async {
@@ -100,6 +100,12 @@ void main() {
runWithOverrides(() => validator.canRunInCurrentContext()),
isFalse,
);
expect(
runWithOverrides(() => validator.incorrectContextMessage),
contains(
'''The command you are running must be run within a Flutter app project that supports the macOS platform.''',
),
);
});
});
});