Repository: VeryGoodOpenSource/very_good_cli (dart)

Issue:
ci: add e2e test for test command validating a sucessful test run on the minial sdk version supported by the cli
**Description**

#673 and #675 exposed a potential usage problem of the optimizer hook: even dev dependencies declared on the hooks `pubspec.yaml` have to respect the CLIs dev dependency constraints. 

That happens because the Mason generator runs `dart pub get` on the hooks before the tests are run. 

E2E workflow description

Run an e2e test that runs the `very_good test` in the minimal dart SDK version and validate a successful result.

Pull request:
<!--
  Thanks for contributing!

  Provide a description of your changes below and a general summary in the title

  Please look at the following checklist to ensure that your PR can be accepted quickly:
-->

## Description

Resolves #676 

## Type of Change

<!--- Put an `x` in all the boxes that apply: -->

- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 🛠️ Bug fix (non-breaking change which fixes an issue)
- [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change)
- [ ] 🧹 Code refactor
- [X] ✅ Build configuration change
- [ ] 📝 Documentation
- [ ] 🗑️ Chore
- [ ] 🧪 Test

Patch:
diff --git a/.github/workflows/very_good_cli.yaml b/.github/workflows/very_good_cli.yaml
index 52103575a..61be9d5bd 100644
--- a/.github/workflows/very_good_cli.yaml
+++ b/.github/workflows/very_good_cli.yaml
@@ -50,9 +50,14 @@ jobs:
 
     strategy:
       matrix:
+        flutter-version:
+          # The version of Flutter to use should use the minimum Dart SDK version supported by the package,
+          # refer to https://docs.flutter.dev/development/tools/sdk/releases.
+          - "3.3.0"
         test:
           # E2E tests for the test command
-          - test/src/commands/test/e2e
+          - test/src/commands/test/e2e/
+
           # E2E tests for the create command
           - test/src/commands/create/e2e/flutter_app/core_test.dart
           - test/src/commands/create/e2e/dart_cli/dart_cli_test.dart
@@ -70,14 +75,18 @@ jobs:
           - test/src/commands/create/e2e/legacy/flutter_pkg_test.dart
 
     steps:
-      - uses: actions/checkout@v3.1.0
+      - name: 📚 Git Checkout
+        uses: actions/checkout@v3.1.0
 
-      - uses: subosito/flutter-action@v2.8.0
+      - name: 🐦 Setup Flutter
+        uses: subosito/flutter-action@v2
+        with:
+          flutter-version: ${{ matrix.flutter-version }}
 
       - name: Install LCOV
         run: sudo apt-get install -y lcov
 
-      - name: Install Dependencies
+      - name: 📦 Install Dependencies
         run: flutter pub get
 
       - name: Run Tests
diff --git a/analysis_options.yaml b/analysis_options.yaml
index 67187e19c..b9099ad72 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,4 +1,4 @@
-include: package:very_good_analysis/analysis_options.4.0.0.yaml
+include: package:very_good_analysis/analysis_options.3.1.0.yaml
 analyzer:
   exclude:
     - "**/version.dart"
diff --git a/lib/src/cli/cli.dart b/lib/src/cli/cli.dart
index 601df9fff..3f62c1845 100644
--- a/lib/src/cli/cli.dart
+++ b/lib/src/cli/cli.dart
@@ -165,7 +165,11 @@ bool _isPubspec(FileSystemEntity entity) {
   return p.basename(entity.path) == 'pubspec.yaml';
 }
 
-extension on Set<String> {
+// The extension is intended to be unnamed, but it's not possible due to
+// an issue with Dart SDK 2.18.0.
+//
+// Once the min Dart SDK is bumped, this extension can be unnamed again.
+extension _Set on Set<String> {
   bool excludes(FileSystemEntity entity) {
     final segments = p.split(entity.path).toSet();
     if (segments.intersection(_ignoredDirectories).isNotEmpty) return true;
diff --git a/lib/src/cli/flutter_cli.dart b/lib/src/cli/flutter_cli.dart
index f53c6cb4e..736f7ec7a 100644
--- a/lib/src/cli/flutter_cli.dart
+++ b/lib/src/cli/flutter_cli.dart
@@ -517,7 +517,11 @@ final int _lineLength = () {
   }
 }();
 
-extension on TestEvent {
+// The extension is intended to be unnamed, but it's not possible due to
+// an issue with Dart SDK 2.18.0.
+//
+// Once the min Dart SDK is bumped, this extension can be unnamed again.
+extension _TestEvent on TestEvent {
   bool shouldCancelTimer() {
     final event = this;
     if (event is MessageTestEvent) return true;
diff --git a/pubspec.yaml b/pubspec.yaml
index 28638c730..6e7464261 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -30,7 +30,7 @@ dev_dependencies:
   build_version: ^2.0.0
   mocktail: ^0.3.0
   test: ^1.17.0
-  very_good_analysis: ^4.0.0
+  very_good_analysis: ^3.1.0
 
 executables:
   very_good:


Test patch:
diff --git a/dart_test.yaml b/dart_test.yaml
index cb8e0ab86..8ce109a0c 100644
--- a/dart_test.yaml
+++ b/dart_test.yaml
@@ -2,4 +2,4 @@ tags:
   pull-request-only:
     skip: "Should only be run during pull request"
   e2e:
-    skip: "End to end tests should be run in parallel with other unit tests"
\ No newline at end of file
+    skip: "End to end tests should be run in parallel with other unit tests"