Files
TREK/client/vitest.config.ts
T
Maurice 35dbcc2103 chore(deps): bump npm dependencies, jsdom 31, isomorphic-dompurify 4 and dotenv 18
The minor and patch group of #3108 without MikroORM: 7.2.9 refuses to set
the OAuth client reference from its client_id (the Postgres probe fails on
OauthTokens.insertToken and OauthConsents.upsertGrant), so MikroORM stays on
7.2.8 and with it better-sqlite3 and kysely, which it pins exactly.

mapbox-gl 3.33 shapes right-to-left text itself and removed setRTLTextPlugin,
so the engine registers nothing any more and @mapbox/mapbox-gl-rtl-text, its
Vite alias and the registration guard go. The WebAssembly module it loads
instead comes from api.mapbox.com, which the CSP already allows.

jsdom 31 and isomorphic-dompurify 4 move together, since the sanitizer needs
jsdom 31. jsdom is also a root devDependency now: listed only in the client,
npm nests it under client/ where vitest's built-in jsdom environment does not
find it.

dotenv 18 is loaded through `import 'dotenv/config'` only, which stays quiet.

Closes #3108, closes #3109, closes #3110, closes #3112
2026-11-16 21:20:33 +01:00

54 lines
2.1 KiB
TypeScript

import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import { plyrSpriteAlias } from './plyrSpriteAlias.js';
import { readFileSync } from 'node:fs';
const UI_VERSION = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')).version;
export default defineConfig({
define: { __TREK_UI_VERSION__: JSON.stringify(UI_VERSION) },
plugins: [react()],
test: {
alias: [plyrSpriteAlias],
root: '.',
globals: true,
environment: './tests/environment/jsdom-native-abort.ts',
include: [
'tests/**/*.test.{ts,tsx}',
'src/**/*.test.{ts,tsx}',
],
setupFiles: ['tests/setup.ts'],
testTimeout: 15000,
hookTimeout: 15000,
pool: 'forks',
// Console output is kept for failing tests and dropped for passing ones: a
// green run used to print ~30k lines of MSW and act() warnings. `default`
// prints one line per file and the full detail only for failures; on CI the
// github-actions reporter adds inline annotations on the PR.
silent: 'passed-only',
reporters: process.env.CI ? ['default', 'github-actions'] : ['default'],
coverage: {
provider: 'v8',
reporter: ['lcov', 'text'],
reportsDirectory: './coverage',
include: ['src/**/*.{ts,tsx}'],
// All .d.ts, not just vite-env: declaration files carry no executable
// code, and their lcov entries can't resolve on the Sonar side (its
// **/*.d.ts exclusion removes them from analysis), which surfaced as
// "Could not resolve 2 file paths" warnings in every scan.
exclude: ['src/main.tsx', 'src/**/*.d.ts'],
// Without these the Client Tests job produced a report, uploaded it and
// passed no matter what the number was — which is how coverage drifted
// down to ~48% unnoticed. 85 across the board is the floor we do not want
// to fall through, not a target: the suite currently sits well above it.
thresholds: {
statements: 85,
branches: 85,
functions: 85,
lines: 85,
},
},
css: false,
},
});