Skip to content

Commit 56fceb9

Browse files
authored
Merge pull request #173 from koji/feat/add-vitest-testing-library
Feat/add vitest testing library
2 parents 9b2d7cb + dbd0bc4 commit 56fceb9

File tree

23 files changed

+1013
-2
lines changed

23 files changed

+1013
-2
lines changed

.github/workflows/test.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches: [ main ] # Or your default branch
6+
pull_request:
7+
branches: [ main ] # Or your default branch
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: '18' # Specify a Node.js version compatible with your project
21+
22+
# It's good practice to cache dependencies to speed up workflows.
23+
- name: Cache pnpm modules
24+
uses: actions/cache@v3
25+
with:
26+
path: ~/.pnpm-store
27+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
28+
restore-keys: |
29+
${{ runner.os }}-pnpm-
30+
31+
- name: Install pnpm
32+
run: npm install -g pnpm@10.11.1 # Using a specific version that was problematic locally, good to test in CI
33+
34+
- name: Install dependencies
35+
run: pnpm install
36+
37+
- name: Run tests
38+
run: pnpm test

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
"preview": "vite preview",
3535
"storybook": "storybook dev -p 6006",
3636
"build-storybook": "storybook build",
37-
"init-msw": "msw init public/"
37+
"init-msw": "msw init public/",
38+
"test": "vitest",
39+
"test:ui": "vitest --ui"
3840
},
3941
"devDependencies": {
4042
"@eslint/js": "^9.9.0",
@@ -60,7 +62,12 @@
6062
"typescript": "^5.5.3",
6163
"typescript-eslint": "^8.0.1",
6264
"vite": "^5.4.1",
63-
"vite-plugin-dts": "^4.5.4"
65+
"vite-plugin-dts": "^4.5.4",
66+
"vitest": "^1.6.0",
67+
"@vitest/ui": "^1.6.0",
68+
"jsdom": "^24.1.0",
69+
"@testing-library/react": "^16.0.0",
70+
"@testing-library/jest-dom": "^6.4.6"
6471
},
6572
"resolutions": {
6673
"jackspeak": "2.1.1"

0 commit comments

Comments
 (0)