Skip to content

Commit

Permalink
fix: lint and shard tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone committed Nov 1, 2024
1 parent 94d1ebf commit c5af678
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions packages/maintenance/src/refactorTests.01.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down

0 comments on commit c5af678

Please sign in to comment.