Skip to content

Commit 925752d

Browse files
authored
chore: add test check on PR (#109)
Upgrade vitest to 4.x
1 parent 4e7e396 commit 925752d

4 files changed

Lines changed: 293 additions & 563 deletions

File tree

‎.github/workflows/run-tests.yml‎

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,59 @@ on:
99
workflow_dispatch:
1010

1111
jobs:
12-
test:
13-
name: Run Test Suite
12+
unit-tests:
13+
name: Unit Tests
1414
runs-on: ubuntu-latest
15-
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
20+
- name: Install pnpm
21+
uses: pnpm/action-setup@v2
22+
with:
23+
version: 8
24+
run_install: false
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: '20'
30+
cache: 'pnpm'
31+
32+
- name: Get pnpm store directory
33+
id: pnpm-cache
34+
shell: bash
35+
run: |
36+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
37+
38+
- name: Setup pnpm cache
39+
uses: actions/cache@v3
40+
with:
41+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
42+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
43+
restore-keys: |
44+
${{ runner.os }}-pnpm-store-
45+
46+
- name: Install dependencies
47+
run: pnpm install
48+
49+
- name: Run unit tests
50+
run: pnpm test:unit
51+
52+
integration-tests:
53+
name: Integration Tests
54+
runs-on: ubuntu-latest
55+
1656
steps:
1757
- name: Checkout code
1858
uses: actions/checkout@v3
19-
59+
60+
- name: Verify Docker is available
61+
run: |
62+
docker --version
63+
docker info
64+
2065
- name: Install pnpm
2166
uses: pnpm/action-setup@v2
2267
with:
@@ -28,23 +73,23 @@ jobs:
2873
with:
2974
node-version: '20'
3075
cache: 'pnpm'
31-
76+
3277
- name: Get pnpm store directory
3378
id: pnpm-cache
3479
shell: bash
3580
run: |
3681
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
37-
82+
3883
- name: Setup pnpm cache
3984
uses: actions/cache@v3
4085
with:
4186
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
4287
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
4388
restore-keys: |
4489
${{ runner.os }}-pnpm-store-
45-
90+
4691
- name: Install dependencies
4792
run: pnpm install
48-
49-
- name: Run tests
50-
run: pnpm test
93+
94+
- name: Run integration tests
95+
run: pnpm test:integration

‎package.json‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
"dev": "NODE_ENV=development tsx src/index.ts",
2323
"crossdev": "cross-env NODE_ENV=development tsx src/index.ts",
2424
"test": "vitest run",
25+
"test:unit": "vitest run --project unit",
2526
"test:watch": "vitest",
26-
"test:integration": "vitest run --testNamePattern='Integration Tests'"
27+
"test:integration": "vitest run --project integration"
2728
},
2829
"keywords": [],
2930
"author": "",
@@ -60,7 +61,7 @@
6061
"tsup": "^8.4.0",
6162
"tsx": "^4.19.3",
6263
"typescript": "^5.8.2",
63-
"vitest": "^1.6.1"
64+
"vitest": "^4.0.6"
6465
},
6566
"compilerOptions": {
6667
"target": "ES2020",

0 commit comments

Comments
 (0)