Skip to content

Commit 0087af8

Browse files
committed
⚙️ 优化 CI 流水线和测试配置
- 缓存 Playwright 浏览器避免重复下载 - 测试失败时上传截图/视频/报告等调试产物 - Playwright CI 环境启用 HTML+list 双 reporter、失败截图和视频 - 各工具链配置屏蔽 .claude 目录
1 parent 216a78c commit 0087af8

File tree

5 files changed

+29
-3
lines changed

5 files changed

+29
-3
lines changed

.github/workflows/test.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,31 @@ jobs:
6969
- name: Install dependencies
7070
run: pnpm i --frozen-lockfile
7171

72+
- name: Cache Playwright browsers
73+
id: playwright-cache
74+
uses: actions/cache@v4
75+
with:
76+
path: ~/.cache/ms-playwright
77+
key: playwright-${{ hashFiles('pnpm-lock.yaml') }}
78+
restore-keys: |
79+
playwright-
80+
7281
- name: Install Playwright Chromium
82+
if: steps.playwright-cache.outputs.cache-hit != 'true'
7383
run: npx playwright install chromium
7484

7585
- name: Build extension
7686
run: pnpm build
7787

7888
- name: Run E2E tests
7989
run: pnpm test:e2e
90+
91+
- name: Upload test artifacts
92+
if: failure()
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: e2e-test-results
96+
path: |
97+
test-results/
98+
playwright-report/
99+
retention-days: 14

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
package-lock.json
33
pnpm-lock.yaml
44
yarn.lock
5+
6+
# Claude Code
7+
.claude

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@ export default [
6969
"react-hooks/rules-of-hooks": "off",
7070
},
7171
},
72-
{ ignores: ["dist/", "example/"] },
72+
{ ignores: ["dist/", "example/", ".claude/"] },
7373
];

playwright.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ export default defineConfig({
1010
forbidOnly: !!process.env.CI,
1111
retries: process.env.CI ? 1 : 0,
1212
workers: 1,
13-
reporter: "list",
13+
reporter: process.env.CI ? [["html", { open: "never" }], ["list"]] : "list",
14+
outputDir: "test-results",
1415
use: {
1516
actionTimeout: 10_000,
1617
trace: "on-first-retry",
18+
screenshot: "only-on-failure",
19+
video: "retain-on-failure",
1720
},
1821
});

vitest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default defineConfig({
2525
],
2626
test: {
2727
environment: "jsdom",
28-
exclude: ["e2e/**", "node_modules/**"],
28+
exclude: ["e2e/**", "node_modules/**", ".claude/**"],
2929
// List setup file
3030
setupFiles: ["./tests/vitest.setup.ts"],
3131
env: {

0 commit comments

Comments
 (0)