Skip to content

Tests and console enhancements #46

Tests and console enhancements

Tests and console enhancements #46

Workflow file for this run

name: Run Unit Tests
on:
push:
branches: [main]
paths:
- 'src/**' # app code
- 'public/**' # static assets
- 'index.html' # Vite entry
- 'vite.config.ts' # build config
- 'package.json' # deps/scripts can change output
- 'package-lock.json' # lockfile updates can change output
- 'tsconfig*.json' # TS config may affect build
- 'tests/**' # tests change
pull_request:
types: [opened, synchronize, ready_for_review]
branches: [main]
paths:
- 'src/**' # app code
- 'public/**' # static assets
- 'index.html' # Vite entry
- 'vite.config.ts' # build config
- 'package.json' # deps/scripts can change output
- 'package-lock.json' # lockfile updates can change output
- 'tsconfig*.json' # TS config may affect build
- 'tests/**' # tests change
workflow_dispatch: {} # manual run when needed
# auto-cancels older runs if new commits are pushed to the same PR
concurrency:
group: tests-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('ref-{0}', github.ref) }}
cancel-in-progress: true
jobs:
test:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
strategy:
matrix:
project: [backend, frontend]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run ${{ matrix.project }} tests
run: |
if [ "${{ matrix.project }}" = "backend" ]; then
npx vitest run tests/backend
else
npx vitest run tests/frontend
fi