mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
8138c83558
Plyr's defaults point at its CDN twice: the icon sprite for the controls is fetched over XHR, and on teardown the element is pointed at a blank clip there to abort the stream. connect-src and media-src both refuse that host, so the clip played but every button in the player was blank, and each close of the lightbox logged a blocked request and an uncaught XHR error. The sprite ships with the bundle now, served from this origin, which Plyr then references directly instead of loading it. plyr's exports field hides the file, so it goes through the same resolver alias the rtl-text plugin already needed. The teardown source is empty: that aborts the stream just the same, and the element is unmounted in the same tick. Refs #2341
50 lines
1.7 KiB
TypeScript
50 lines
1.7 KiB
TypeScript
import { defineConfig } from 'vitest/config';
|
|
import react from '@vitejs/plugin-react';
|
|
import { rtlTextAlias, plyrSpriteAlias } from './rtlTextAlias.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: [rtlTextAlias, 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',
|
|
silent: false,
|
|
reporters: ['verbose'],
|
|
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,
|
|
},
|
|
});
|