Skip to content

Commit 2564db3

Browse files
committed
ci(test): update test actions
1 parent b8d8e77 commit 2564db3

File tree

5 files changed

+35
-21
lines changed

5 files changed

+35
-21
lines changed

.github/workflows/release.yaml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ jobs:
3333

3434
# Install dependencies
3535
- name: 📦 Install dependencies
36-
run: |
37-
npm ci
36+
run: npm ci
3837

3938
# Lint code
4039
- name: 🧹 Lint code
@@ -45,8 +44,28 @@ jobs:
4544
run: npm run format:check
4645

4746
# Run tests
48-
- name: 🧪 Run tests
49-
run: npm test
47+
- name: 🧪 Run unit tests
48+
run: npm run test:unit
49+
50+
# Setup PocketBase
51+
- name: 🗄️ Download and setup PocketBase
52+
run: npm run test:e2e:setup
53+
54+
# Start PocketBase
55+
- name: 🚀 Start PocketBase
56+
run: ./.pocketbase/pocketbase serve &
57+
58+
# Wait for PocketBase to be ready
59+
- name: ⏳ Wait for PocketBase
60+
run: |
61+
until curl -s --fail http://localhost:8090/api/health; do
62+
echo 'Waiting for PocketBase...'
63+
sleep 5
64+
done
65+
66+
# Run tests
67+
- name: 🧪 Run e2e tests
68+
run: npm run test:e2e
5069

5170
# Create release
5271
- name: 🚀 Create release

.github/workflows/test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ jobs:
4545
run: npm run format:check
4646

4747
# Run tests
48-
- name: 🧪 Run tests
49-
run: npm test
48+
- name: 🧪 Run unit tests
49+
run: npm run test:unit
5050

5151
# Setup PocketBase
5252
- name: 🗄️ Download and setup PocketBase

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
"prepare": "husky",
2121
"test": "vitest run",
2222
"test:watch": "vitest watch",
23-
"test:ui": "vitest --ui",
24-
"test:e2e": "vitest run --config vitest.config-e2e.ts",
25-
"test:e2e:watch": "vitest watch --config vitest.config-e2e.ts",
26-
"test:e2e:ui": "vitest --ui --config vitest.config-e2e.ts",
23+
"test:unit": "vitest run $(find test -name '*.spec.ts')",
24+
"test:unit:watch": "vitest watch $(find test -name '*.spec.ts')",
25+
"test:e2e": "vitest run $(find test -name '*.e2e-spec.ts')",
26+
"test:e2e:watch": "vitest watch $(find test -name '*.e2e-spec.ts')",
2727
"test:e2e:setup": "./scripts/setup-pocketbase.sh",
28-
"test:e2e:pocketbase": "./.pocketbase/pocketbase serve"
28+
"test:e2e:pocketbase": "npm run test:e2e:setup && ./.pocketbase/pocketbase serve"
2929
},
3030
"peerDependencies": {
3131
"astro": "^5.0.0"

vitest.config-e2e.ts

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

vitest.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import { defineConfig } from "vite";
22

33
export default defineConfig({
44
test: {
5-
include: ["test/**/*.spec.ts"],
6-
silent: true
5+
include: ["test/**/*.spec.ts", "test/**/*.e2e-spec.ts"],
6+
silent: true,
7+
coverage: {
8+
include: ["src/**/*.ts"]
9+
}
710
}
811
});

0 commit comments

Comments
 (0)