Skip to content

Commit

Permalink
Merge pull request #2243 from leancodepl/fix-dart-define-from-file-pa…
Browse files Browse the repository at this point in the history
…rsing

Fix parsing non string values from --dart-define-from-file
  • Loading branch information
pdenert authored Jun 25, 2024
2 parents 54a8fe6 + b2540ee commit d64c1b6
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 9 deletions.
3 changes: 2 additions & 1 deletion dev/e2e_app/defines_2.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"SECOND_KEY": "Second key from defines_2.json",
"THIRD_KEY": "Third key from defines_2.json",
"FOURTH_KEY": "Fourth key from defines_2.json"
"FOURTH_KEY": "Fourth key from defines_2.json",
"BOOL_DEFINED": false
}
1 change: 1 addition & 0 deletions dev/e2e_app/integration_test/define_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ void main() {
expect($('SECOND_KEY: Second key from defines_2.json'), findsOneWidget);
expect($('THIRD_KEY: Third key from defines_2.json'), findsOneWidget);
expect($('FIFTH_KEY: Fifth key from defines_3.env'), findsOneWidget);
expect($('BOOL_DEFINED: false'), findsOneWidget);
});
}
2 changes: 1 addition & 1 deletion dev/e2e_app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ SPEC CHECKSUMS:
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
flutter_timezone: ffb07bdad3c6276af8dada0f11978d8a1f8a20bb
geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
patrol: 3e21d514020dbee24b3e3383caac9e8e051292ac
patrol: 0564cee315ff6c86fb802b3647db05cc2d3d0624
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a

Expand Down
3 changes: 3 additions & 0 deletions dev/e2e_app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ class _ExampleHomePageState extends State<ExampleHomePage> {
),
const Text('THIRD_KEY: ${const String.fromEnvironment('THIRD_KEY')}'),
const Text('FIFTH_KEY: ${const String.fromEnvironment('FIFTH_KEY')}'),
const Text(
'BOOL_DEFINED: ${const String.fromEnvironment('BOOL_DEFINED')}',
),
const Text(
'You have pushed the button this many times:',
),
Expand Down
2 changes: 1 addition & 1 deletion dev/e2e_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ packages:
path: "../../packages/patrol"
relative: true
source: path
version: "3.8.0"
version: "3.9.0"
patrol_finders:
dependency: transitive
description:
Expand Down
4 changes: 4 additions & 0 deletions packages/patrol_cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.8.1

- Fix parsing non string values from --dart-define-from-file (#2243).

## 2.8.0

- Add support for --dart-define-from-file (#2232).
Expand Down
2 changes: 1 addition & 1 deletion packages/patrol_cli/lib/src/base/constants.dart
Original file line number Diff line number Diff line change
@@ -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.8.0';
const version = '2.8.1';
6 changes: 2 additions & 4 deletions packages/patrol_cli/lib/src/commands/dart_define_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ Map<String, String> mergeKeys({
required Map<String, dynamic> json,
required Map<String, dynamic> dartDefines,
}) {
final modified = Map<String, String>.from(json);
final modified = json.map((key, value) => MapEntry(key, value.toString()));

if (dartDefines.isNotEmpty) {
dartDefines.forEach((key, value) {
modified[key] = value as String;
});
dartDefines.forEach((key, value) => modified[key] = value.toString());
}
return modified;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/patrol_cli/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: patrol_cli
description: >
Command-line tool for Patrol, a powerful Flutter-native UI testing framework.
version: 2.8.0 # Must be kept in sync with constants.dart
version: 2.8.1 # 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
Expand Down

0 comments on commit d64c1b6

Please sign in to comment.