From c5af6784e20c1e584d138998deaeb84879a0b092 Mon Sep 17 00:00:00 2001 From: Dominic Griesel Date: Fri, 1 Nov 2024 22:45:21 +0100 Subject: [PATCH] fix: lint and shard tests --- .github/workflows/test-and-release.yml | 24 +++++++++++++------- package.json | 2 +- packages/maintenance/src/refactorTests.01.ts | 6 ++--- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index 1bb21e198af2..7d47d64d2562 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -194,11 +194,13 @@ jobs: # =================== # Runs unit tests on all supported node versions and OSes unit-tests: + name: "Unit tests: ${{ matrix.os }}, Node.js ${{ matrix.node-version }} (part ${{ matrix.shard }})" runs-on: ${{ matrix.os }} strategy: matrix: node-version: [18, 20] os: [ubuntu-latest] + shard: [1/4, 2/4, 3/4, 4/4] steps: - name: Checkout code @@ -214,18 +216,18 @@ jobs: - name: Perform code generation run: yarn turbo run codegen - # For pull requests, only run tests for changed files - - name: Run component tests (changes) - if: github.event_name == 'pull_request' - run: | - git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1 - yarn run test:dirty --resolve --base origin/${{ github.event.pull_request.base.ref }} + # # For pull requests, only run tests for changed files + # - name: Run component tests (changes) + # if: github.event_name == 'pull_request' + # run: | + # git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1 + # yarn run test:dirty --resolve --base origin/${{ github.event.pull_request.base.ref }} # For all other events, especially on master and releases, run the full test suite # Run the full test suite on master, release branches and tags - name: Run component tests (full) if: github.event_name != 'pull_request' - run: yarn run test:ts $TURBO_FLAGS + run: yarn run test:ts --shard ${{ matrix.shard }} # =================== # Test if the transformers are working @@ -382,7 +384,13 @@ jobs: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') - needs: [build, lint, lint-zwave, unit-tests, test-packages] + needs: + - build + - lint + - lint-zwave + - unit-tests + - test-transformers + - test-packages runs-on: ubuntu-latest strategy: diff --git a/package.json b/package.json index dde67c18a63e..c655bf9f8281 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "build": "yarn turbo run build:turbo --", "build:turbo": "yarn ts maintenance/build.ts", "watch": "yarn w build", - "test:ts": "FORCE_COLOR=1 yarn turbo run test:ts ${TURBO_FLAGS:-'--concurrency=1'} --", + "test:ts": "vitest run", "test": "yarn ts maintenance/test.mts", "test:dirty:resolve": "yarn ts packages/maintenance/src/resolveDirtyTests.ts", "test:dirty": "yarn ts packages/maintenance/src/resolveDirtyTests.ts --run", diff --git a/packages/maintenance/src/refactorTests.01.ts b/packages/maintenance/src/refactorTests.01.ts index b858f9f1e1e5..4c2aa6983ce0 100644 --- a/packages/maintenance/src/refactorTests.01.ts +++ b/packages/maintenance/src/refactorTests.01.ts @@ -1,9 +1,9 @@ import fs from "node:fs/promises"; import { - CallExpression, - Identifier, + type CallExpression, + type Identifier, Project, - PropertyAccessExpression, + type PropertyAccessExpression, SyntaxKind, } from "ts-morph";