From 6e77d2d30c46b48c25e5d85406714f942891804d Mon Sep 17 00:00:00 2001 From: Alex Li Date: Thu, 27 Jun 2024 21:30:00 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20--?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 1 - melos.yaml | 24 ++++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b3ba25448..1fcccb2d3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,7 +40,6 @@ jobs: flutter-version: ${{ matrix.sdk == 'min' && '3.3.0' || '' }} channel: ${{ matrix.sdk == 'min' && '' || matrix.channel }} - run: | - echo COVERAGE_ENABLED=${{ matrix.sdk == 'stable' && '1' || '' }} >> $GITHUB_ENV echo TARGET_DART_SDK=${{ matrix.sdk }} >> $GITHUB_ENV - name: Prepare dependencies for the project management run: dart pub get diff --git a/melos.yaml b/melos.yaml index 364385087..52b6bd711 100644 --- a/melos.yaml +++ b/melos.yaml @@ -58,11 +58,14 @@ scripts: test:vm: name: Dart VM tests exec: | - COVERAGE_PATH="coverage/vm" - if ["$COVERAGE_ENABLED" != "1"]; then - COVERAGE_PATH="" + if ["$TARGET_DART_SDK" == "stable"]; then + dart test --preset=${TEST_PRESET:-default},${TARGET_DART_SDK:-stable} \ + --coverage=coverage/vm \ + --chain-stack-traces + else + dart test --preset=${TEST_PRESET:-default},${TARGET_DART_SDK:-stable} \ + --chain-stack-traces fi - dart test --preset=${TEST_PRESET:-default},${TARGET_DART_SDK:-stable} --coverage=$COVERAGE_PATH --chain-stack-traces packageFilters: flutter: false dirExists: test @@ -87,11 +90,16 @@ scripts: test:web:single: name: Dart Web tests in a browser exec: | - COVERAGE_PATH="coverage/${TEST_PLATFORM}" - if ["$COVERAGE_ENABLED" != "1"]; then - COVERAGE_PATH="" + if ["$TARGET_DART_SDK" == "stable"]; then + dart test --platform ${TEST_PLATFORM} \ + --coverage="coverage/${TEST_PLATFORM}" \ + --preset=${TEST_PRESET:-default},${TARGET_DART_SDK:-stable} \ + --chain-stack-traces + else + dart test --platform ${TEST_PLATFORM} \ + --preset=${TEST_PRESET:-default},${TARGET_DART_SDK:-stable} \ + --chain-stack-traces fi - dart test --platform ${TEST_PLATFORM} --coverage=$COVERAGE_PATH --preset=${TEST_PRESET:-default},${TARGET_DART_SDK:-stable} --chain-stack-traces packageFilters: flutter: false dirExists: test