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
12 changes: 11 additions & 1 deletion .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ jobs:
- name: Install ripgrep
run: command -v rg || (sudo apt-get update && sudo apt-get install -y ripgrep)

- name: Run tests with coverage
# Named for what it does: `bun run test` is `vitest run`, with no
# `--coverage`. See the Codecov note below.
- name: Run tests
env:
NODE_OPTIONS: '--no-warnings --max-old-space-size=8192'
NEXT_PUBLIC_APP_URL: 'https://www.sim.ai'
Expand All @@ -199,6 +201,14 @@ jobs:
fi
echo "✅ Schema and migrations are in sync"

# DEAD PATH: nothing generates `apps/sim/coverage`. The test step runs
# `vitest run` without `--coverage`, and vitest.config.ts declares no
# coverage provider, so this uploads nothing and still reports success in
# ~1s (`fail_ci_if_error: false` hides it). `@vitest/coverage-v8` IS
# installed, so wiring it up is possible — but coverage instrumentation
# costs test time and nothing gates on the result today. Left in place
# pending a decision to either enable coverage or drop this step; do not
# read its green tick as "coverage was published".
- name: Upload coverage to Codecov
uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5
with:
Expand Down
10 changes: 9 additions & 1 deletion apps/sim/vitest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ import {
workflowAuthzMock,
} from '@sim/testing'
import { afterAll, vi } from 'vitest'
import '@testing-library/jest-dom/vitest'

/**
* jest-dom only registers DOM matchers (`toBeVisible`, `toHaveTextContent`, …),
* so it is dead weight in a `node` environment — which is 985 of the 1,219 test
* files here. Loading it unconditionally made every one of them pay for it.
*/
if (typeof document !== 'undefined') {
await import('@testing-library/jest-dom/vitest')
}

setupGlobalFetchMock()
setupGlobalStorageMocks()
Expand Down
Loading