From 434db8405cec022890e847bf193f095d1c67e397 Mon Sep 17 00:00:00 2001 From: Bart Vermeulen Date: Mon, 14 Mar 2022 22:32:55 +0100 Subject: [PATCH] Added path support --- .flutter-plugins | 2 +- .flutter-plugins-dependencies | 2 +- example_with_integration_test/pubspec.lock | 31 ++++++++++++------- .../gherkin_suite_test_generator.dart | 20 +++--------- pubspec.lock | 31 ++++++++++++------- pubspec.yaml | 10 +++--- 6 files changed, 50 insertions(+), 46 deletions(-) diff --git a/.flutter-plugins b/.flutter-plugins index 272ca46..b3be2c7 100644 --- a/.flutter-plugins +++ b/.flutter-plugins @@ -1,2 +1,2 @@ # This is a generated file; do not edit or check into version control. -integration_test=C:\\Google\\flutter\\packages\\integration_test\\ +integration_test=C:\\flutter\\packages\\integration_test\\ diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 37517a0..91bb86c 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"C:\\\\Google\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"C:\\\\Google\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]}],"date_created":"2021-11-24 07:12:59.207785","version":"2.5.3"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"C:\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"C:\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]}],"date_created":"2022-03-14 22:27:08.904781","version":"2.10.3"} \ No newline at end of file diff --git a/example_with_integration_test/pubspec.lock b/example_with_integration_test/pubspec.lock index 938c21f..4c3cef1 100644 --- a/example_with_integration_test/pubspec.lock +++ b/example_with_integration_test/pubspec.lock @@ -21,7 +21,7 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.1.2" + version: "3.1.6" args: dependency: transitive description: @@ -35,7 +35,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.8.2" boolean_selector: dependency: transitive description: @@ -105,7 +105,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: @@ -246,9 +246,9 @@ packages: gherkin: dependency: transitive description: - name: gherkin - url: "https://pub.dartlang.org" - source: hosted + path: "../../dart_gherkin" + relative: true + source: path version: "2.0.8" glob: dependency: transitive @@ -324,7 +324,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" meta: dependency: transitive description: @@ -380,7 +387,7 @@ packages: name: platform url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.1.0" plugin_platform_interface: dependency: transitive description: @@ -401,7 +408,7 @@ packages: name: process url: "https://pub.dartlang.org" source: hosted - version: "4.2.3" + version: "4.2.4" pub_semver: dependency: transitive description: @@ -553,7 +560,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.4.8" timing: dependency: transitive description: @@ -581,14 +588,14 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" vm_service: dependency: transitive description: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "7.1.1" + version: "7.5.0" watcher: dependency: transitive description: diff --git a/lib/src/flutter/code_generation/generators/gherkin_suite_test_generator.dart b/lib/src/flutter/code_generation/generators/gherkin_suite_test_generator.dart index 8102099..6bcc4c5 100644 --- a/lib/src/flutter/code_generation/generators/gherkin_suite_test_generator.dart +++ b/lib/src/flutter/code_generation/generators/gherkin_suite_test_generator.dart @@ -10,8 +10,7 @@ import 'package:source_gen/source_gen.dart'; class NoOpReporter extends Reporter {} -class GherkinSuiteTestGenerator - extends GeneratorForAnnotation { +class GherkinSuiteTestGenerator extends GeneratorForAnnotation { static const String TEMPLATE = ''' class _CustomGherkinIntegrationTestRunner extends GherkinIntegrationTestRunner { _CustomGherkinIntegrationTestRunner( @@ -46,21 +45,14 @@ void executeTestSuite( _languageService.initialise( annotation.read('featureDefaultLanguage').literalValue.toString(), ); - final idx = annotation - .read('executionOrder') - .objectValue - .getField('index')! - .toIntValue()!; + final idx = annotation.read('executionOrder').objectValue.getField('index')!.toIntValue()!; final executionOrder = ExecutionOrder.values[idx]; final featureFiles = annotation .read('featurePaths') .listValue .map((path) => Glob(path.toStringValue()!)) .map( - (glob) => glob - .listSync() - .map((entity) => File(entity.path).readAsStringSync()) - .toList(), + (glob) => glob.listSync().map((entity) => File(entity.path).readAsStringSync()).toList(), ) .reduce((value, element) => value..addAll(element)); @@ -88,10 +80,7 @@ void executeTestSuite( } } - return TEMPLATE - .replaceAll('{{feature_functions}}', - featureExecutionFunctionsBuilder.toString()) - .replaceAll( + return TEMPLATE.replaceAll('{{feature_functions}}', featureExecutionFunctionsBuilder.toString()).replaceAll( '{{features_to_execute}}', featuresToExecute.toString(), ); @@ -218,6 +207,7 @@ class FeatureFileTestGeneratorVisitor extends FeatureFileVisitor { Iterable tags, bool isFirst, bool isLast, + String path, ) async { _flushScenario(); _currentScenarioCode = _replaceVariable( diff --git a/pubspec.lock b/pubspec.lock index 06031d1..519f7eb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -21,7 +21,7 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.1.2" + version: "3.1.6" args: dependency: transitive description: @@ -35,7 +35,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.8.2" boolean_selector: dependency: transitive description: @@ -63,7 +63,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: @@ -157,9 +157,9 @@ packages: gherkin: dependency: "direct main" description: - name: gherkin - url: "https://pub.dartlang.org" - source: hosted + path: "../dart_gherkin" + relative: true + source: path version: "2.0.8" glob: dependency: "direct main" @@ -193,7 +193,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" meta: dependency: "direct dev" description: @@ -228,14 +235,14 @@ packages: name: platform url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.1.0" process: dependency: transitive description: name: process url: "https://pub.dartlang.org" source: hosted - version: "4.2.3" + version: "4.2.4" pub_semver: dependency: transitive description: @@ -310,7 +317,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.4.8" typed_data: dependency: transitive description: @@ -324,14 +331,14 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" vm_service: dependency: transitive description: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "7.1.1" + version: "7.5.0" watcher: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 563ce82..9eae6db 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ version: 3.0.0-rc.9 homepage: https://github.com/jonsamwell/flutter_gherkin environment: - sdk: '>=2.12.3 <3.0.0' + sdk: ">=2.12.3 <3.0.0" flutter: ">=2.2.0" dependencies: @@ -18,15 +18,15 @@ dependencies: sdk: flutter analyzer: ">=1.7.1 <3.0.0" collection: ^1.15.0 - gherkin: ^2.0.8 + # gherkin: ^2.0.8 source_gen: ^1.1.1 build: ^2.1.1 glob: ^2.0.2 - # gherkin: - # path: ../dart_gherkin + gherkin: + path: ../dart_gherkin dev_dependencies: - meta: ^1.7.0 + meta: ^1.7.0 pedantic: ^1.11.1 build_config: ^1.0.0