mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 13:36:48 +00:00
8f6ed02cff
After an update the service worker keeps serving the previous bundle until the new one is installed. That shell announces the release layout too, so the layout alone let it draw the notice with its own older texts and use it up for the version now running with one click on X. The bundle now sends the version it was built as (client/package.json, baked in by define), and the server compares it with its own before it hands a notice with a release block over. A shell of another version is told nothing and gets the notice after the reload, from the bundle that can draw it. This holds for every update, not only the one that introduced the parameter.
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 } 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],
|
|
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,
|
|
},
|
|
});
|