-
Notifications
You must be signed in to change notification settings - Fork 594
73 lines (64 loc) · 2.21 KB
/
vitest.yml
File metadata and controls
73 lines (64 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# ===============================================================
# 🧪 JavaScript Unit Tests (Vitest)
# ===============================================================
# Authors: Gabriel Costa, Mihai Criveti
# - runs Vitest unit tests for browser-side JavaScript
# - uses jsdom environment to test non-modular browser scripts
# - installs dependencies from package.json / package-lock.json
# ---------------------------------------------------------------
name: JavaScript Tests (Vitest)
on:
push:
branches: ["main"]
paths:
- "mcpgateway/static/**"
- "tests/**"
- "package.json"
- "package-lock.json"
- ".github/workflows/vitest.yml"
pull_request:
types: [opened, synchronize, ready_for_review]
branches: ["main"]
paths:
- "mcpgateway/static/**"
- "tests/**"
- "package.json"
- "package-lock.json"
- ".github/workflows/vitest.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
vitest:
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
name: vitest
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
# -----------------------------------------------------------
# 0️⃣ Checkout
# -----------------------------------------------------------
- name: ⬇️ Checkout source
uses: actions/checkout@v5
with:
fetch-depth: 1
# -----------------------------------------------------------
# 1️⃣ Node.js Setup
# -----------------------------------------------------------
- name: 📦 Set up Node.js
uses: actions/setup-node@v5
with:
node-version: '20'
cache: npm
# -----------------------------------------------------------
# 2️⃣ Install Dependencies
# -----------------------------------------------------------
- name: 📥 Install dependencies
run: npm ci
# -----------------------------------------------------------
# 3️⃣ Run Vitest
# -----------------------------------------------------------
- name: 🧪 Run Vitest
run: npx vitest run