Skip to content

Commit 52b2461

Browse files
committed
1. 撰寫 pages 頁面下的測試案例
2. 在 GitHub Action 增加自動測試的流程
1 parent 7e1a59a commit 52b2461

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Automate Test & Coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Run tests with coverage
26+
run: npm run test:coverage
27+
28+
- name: Upload coverage report
29+
if: always() # Upload even if tests fail, though usually we want to see it only on success. But request implies "after testing". Let's keep default behavior (success) or explicitly simple. The user asked "testing finished, then generate report". Usually implies success.
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: coverage-report
33+
path: coverage/

0 commit comments

Comments
 (0)