Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on:
push:
branches: [main]
pull_request:

permissions:
contents: read
pull-requests: write

jobs:
test:
name: Test & coverage
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- name: Install dependencies
run: npm ci

- name: Run tests with coverage
run: >
npx vitest run --coverage
--coverage.reporter=json
--coverage.reporter=json-summary
--coverage.reporter=text-summary
--coverage.reportOnFailure

# Posts/updates a coverage comment on PRs and writes a coverage summary
# to the job summary on every run (incl. pushes to main).
- name: Coverage report
if: ${{ !cancelled() }}
uses: davelosert/vitest-coverage-report-action@v2
8 changes: 8 additions & 0 deletions tests/setup.ts
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
import '@testing-library/jest-dom'

// Make unit tests hermetic. The app reads VITE_SIMPLICATE_BASE_URL from
// import.meta.env at module-load time. Locally a developer's (gitignored) .env
// supplies it, but CI has no .env, leaving the value `undefined` and breaking
// tests that assert a base URL was passed. Pin a deterministic fallback so the
// suite never depends on a local .env. A real env value (if set) still wins.
import.meta.env.VITE_SIMPLICATE_BASE_URL ??=
'https://test.simplicate.test/api/v2'
Loading