diff --git a/docs/getting-started.mdx b/docs/getting-started.mdx index 0cf9ab025..a9c781c00 100644 --- a/docs/getting-started.mdx +++ b/docs/getting-started.mdx @@ -4,6 +4,10 @@ title: Getting started # Getting started +Check out our video version of this tutorial on YouTube! + + + If you want to use Patrol finders in your existing widget or golden tests, go to [Using Patrol finders in widget tests]. diff --git a/packages/patrol_cli/CHANGELOG.md b/packages/patrol_cli/CHANGELOG.md index 1d0c5915e..9bac1f17e 100644 --- a/packages/patrol_cli/CHANGELOG.md +++ b/packages/patrol_cli/CHANGELOG.md @@ -1,3 +1,11 @@ +## 2.6.4 + +- Fix compatibility_checker getting stuck (#2091). + +## 2.6.3 + +- Fix invalid JSON output of version check command (#2087). + ## 2.6.2 - Print link to devtools regardless of open-devtools flag (#2076). diff --git a/packages/patrol_cli/lib/src/analytics/analytics.dart b/packages/patrol_cli/lib/src/analytics/analytics.dart index dc6308422..bb4f6830a 100644 --- a/packages/patrol_cli/lib/src/analytics/analytics.dart +++ b/packages/patrol_cli/lib/src/analytics/analytics.dart @@ -195,8 +195,16 @@ FlutterVersion _getFlutterVersion() { runInShell: true, ); - final versionData = jsonDecode(result.stdOut) as Map; + final versionData = + jsonDecode(cleanJsonResult(result)) as Map; final frameworkVersion = versionData['frameworkVersion'] as String; final channel = versionData['channel'] as String; return FlutterVersion(frameworkVersion, channel); } + +// Workaround for https://github.com/flutter/flutter/issues/122814 +String cleanJsonResult(io.ProcessResult result) { + final parts = result.stdOut.split('}')..removeLast(); + final cleanedString = parts.join('}'); + return '$cleanedString}'; +} diff --git a/packages/patrol_cli/lib/src/base/constants.dart b/packages/patrol_cli/lib/src/base/constants.dart index deb56214d..330111869 100644 --- a/packages/patrol_cli/lib/src/base/constants.dart +++ b/packages/patrol_cli/lib/src/base/constants.dart @@ -1,3 +1,3 @@ /// Version of Patrol CLI. Must be kept in sync with pubspec.yaml. /// If you update this, make sure that compatibility-table.mdx is updated (if needed) -const version = '2.6.2'; +const version = '2.6.4'; diff --git a/packages/patrol_cli/lib/src/compatibility_checker.dart b/packages/patrol_cli/lib/src/compatibility_checker.dart index c3f655a38..996a6ada1 100644 --- a/packages/patrol_cli/lib/src/compatibility_checker.dart +++ b/packages/patrol_cli/lib/src/compatibility_checker.dart @@ -53,24 +53,27 @@ class CompatibilityChecker { ) ..disposedBy(scope); - process.listenStdOut((line) async { - if (line.startsWith('- patrol ')) { - packageCompleter.complete(line.split(' ').last); - } - }).disposedBy(scope); + process.listenStdOut( + (line) async { + if (line.startsWith('- patrol ')) { + packageCompleter.complete(line.split(' ').last); + } + }, + onDone: () { + if (!packageCompleter.isCompleted) { + throwToolExit( + 'Failed to read patrol version. Make sure you have patrol ' + 'dependency in your pubspec.yaml file', + ); + } + }, + ).disposedBy(scope); }); packageVersion = await packageCompleter.future; - if (packageVersion == null) { - throwToolExit( - 'Failed to read patrol version. Make sure you have patrol ' - 'dependency in your pubspec.yaml file', - ); - } - final cliVersion = Version.parse(constants.version); - final patrolVersion = Version.parse(packageVersion); + final patrolVersion = Version.parse(packageVersion!); final isCompatible = cliVersion.isCompatibleWith(patrolVersion); diff --git a/packages/patrol_cli/pubspec.yaml b/packages/patrol_cli/pubspec.yaml index 21e6f31f3..408e45ee4 100644 --- a/packages/patrol_cli/pubspec.yaml +++ b/packages/patrol_cli/pubspec.yaml @@ -1,7 +1,7 @@ name: patrol_cli description: > Command-line tool for Patrol, a powerful Flutter-native UI testing framework. -version: 2.6.2 # Must be kept in sync with constants.dart +version: 2.6.4 # Must be kept in sync with constants.dart homepage: https://patrol.leancode.co repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol_cli issue_tracker: https://github.com/leancodepl/patrol/issues?q=is%3Aopen+is%3Aissue+label%3A%22package%3A+patrol_cli%22