Skip to content

Commit 83560b3

Browse files
authored
feat: use vitest instead of playwright (#763)
1 parent f1584f9 commit 83560b3

20 files changed

Lines changed: 2745 additions & 216 deletions

.github/workflows/build.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Check
1+
name: Build
22

33
on:
44
push:
@@ -14,12 +14,14 @@ jobs:
1414
name: Lint
1515
uses: ./.github/workflows/re-lint.yml
1616

17-
# test:
17+
test:
18+
name: Test
19+
uses: ./.github/workflows/re-test.yml
1820

1921
build:
2022
name: Build
2123
runs-on: ubuntu-latest
22-
needs: lint
24+
needs: [lint, test]
2325
env:
2426
CI: true
2527

.github/workflows/re-lint.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ jobs:
4949
run: |
5050
pnpm install --frozen-lockfile
5151
52-
- name: Install dependencies and lint
52+
- name: Lint
5353
run: |
54-
pnpm install
5554
pnpm lint
56-
env:
57-
CI: true
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
name: Playwright Tests
2-
on:
3-
push:
4-
pull_request:
5-
branches:
6-
- main
1+
# This is a reusable workflow that can be called from other workflows
2+
name: Test
3+
4+
on: [workflow_call]
5+
76
jobs:
87
test:
98
name: Test
109
runs-on: ubuntu-latest
10+
1111
env:
1212
CI: true
1313

1414
strategy:
1515
matrix:
1616
node-version: [22.x]
17+
1718
steps:
1819
- name: Checkout
1920
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
@@ -23,9 +24,6 @@ jobs:
2324
with:
2425
node-version: ${{ matrix.node-version }}
2526

26-
- name: Set Environment Variables
27-
run: cp sample.env .env
28-
2927
- name: Install pnpm
3028
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4
3129
id: pnpm-install
@@ -49,24 +47,16 @@ jobs:
4947
5048
- name: Install dependencies
5149
run: |
52-
pnpm install
50+
pnpm install --frozen-lockfile
5351
54-
- name: Install Playwright Browsers
52+
- name: Test
5553
run: |
56-
npx playwright install --with-deps
57-
58-
- name: Build
59-
run: |
60-
pnpm build
61-
62-
- name: Run Playwright tests
63-
run: |
64-
pnpm exec playwright test
65-
66-
- name: Upload Artifact
67-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
68-
if: ${{ !cancelled() }}
69-
with:
70-
name: playwright-report
71-
path: playwright-report/
72-
retention-days: 7
54+
pnpm test
55+
56+
# - name: Upload coverage reports
57+
# uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
58+
# if: ${{ !cancelled() }}
59+
# with:
60+
# name: vitest-coverage
61+
# path: coverage/
62+
# retention-days: 7

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"preview": "pnpm build && wrangler pages dev",
1111
"format": "prettier . --write --cache && eslint . --cache --fix",
1212
"lint": "prettier . --check --cache && eslint . --cache",
13-
"playwright:run": "playwright test",
14-
"playwright:watch": "playwright test --ui"
13+
"test": "vitest run",
14+
"test:update": "vitest --update"
1515
},
1616
"lint-staged": {
1717
"**/*.{astro,mjs,cjs,js,jsx,ts,tsx,yaml,yml}": [
@@ -32,7 +32,7 @@
3232
"typescript": "5.8.3"
3333
},
3434
"devDependencies": {
35-
"@playwright/test": "1.53.2",
35+
"@types/jsdom": "^21.1.7",
3636
"@types/node": "22.16.0",
3737
"@typescript-eslint/eslint-plugin": "7.18.0",
3838
"@typescript-eslint/parser": "7.18.0",
@@ -43,10 +43,12 @@
4343
"eslint-plugin-prettier": "5.5.1",
4444
"husky": "9.1.7",
4545
"is-ci": "4.1.0",
46+
"jsdom": "^26.1.0",
4647
"lint-staged": "16.1.2",
4748
"prettier": "3.6.2",
4849
"prettier-plugin-astro": "0.14.1",
4950
"sharp": "0.34.2",
51+
"vitest": "3.2.4",
5052
"wrangler": "^4.0.0"
5153
},
5254
"packageManager": "pnpm@10.12.4"

playwright.config.ts

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)