Skip to content

Commit

Permalink
chore(shorebird_cli): improve error message when Flutter project does…
Browse files Browse the repository at this point in the history
… not support macOS (#2777)
  • Loading branch information
felangel authored Jan 16, 2025
1 parent a5c9edf commit 048ec1b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.''',
),
);
});
});
});
Expand Down

0 comments on commit 048ec1b

Please sign in to comment.