Files
jsonPrism/vitest.config.ts
T
poli0981andClaude Opus 5.5 532b5cfd82 JSONPrism 2.0.0: Cloudflare Workers, TypeScript 7 and a full audit (#151)
- Web app moves to https://jsonprism.poli0981.dev on Cloudflare Workers
  (static assets + /api/turnstile/verify + /api/health), with security
  headers, redirects for the old /jsonPrism paths, previews for
  non-production branches and a production smoke workflow. GitHub Pages
  only redirects now.
- Web-only Turnstile human check (server-verified, 7-day pass) and
  cookieless Web Analytics (after consent, opt-out, off under GPC);
  Privacy Policy and Terms 2.0, consent version 2.
- Node 26, TypeScript 7 with the TS 6 API alias for typescript-eslint,
  dependencies on current majors (ends the ERESOLVE that kept main red).
- Converter fixes: CSV columns, binary ZIP entries, MySQL backslash
  escaping, RESX/XML validity, BSON size, YAML quoting and alias limits,
  TOML nulls and big integers, JSON error positions, JSONL/BOM linting.
- Web Worker conversion, faster editor, technical UI refresh with an
  Appearance menu and custom scrollbars, accessibility and i18n gaps.
- Tauri least-privilege capabilities, hardened CSP, Tauri 2.12.
- CI: SHA-pinned least-privilege workflows, SonarQube Cloud, Rust job,
  verifiable releases (SHA256SUMS + provenance); Dependabot grouping.
- 864 tests (97% line coverage), SonarCloud quality gate passing; docs,
  legal and CLAUDE.md refreshed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 23:05:14 +07:00

66 lines
1.7 KiB
TypeScript

import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import path from 'node:path';
import pkg from './package.json' with { type: 'json' };
const alias = { '@': path.resolve(import.meta.dirname, './src') };
export default defineConfig({
plugins: [react()],
define: {
__APP_VERSION__: JSON.stringify(pkg.version),
__IS_TAURI_BUILD__: 'false',
__IS_ANDROID_BUILD__: 'false',
__TAURI_PLATFORM__: '"web"',
__APP_COMMIT__: '"test"',
__APP_BUILD_DATE__: '"1970-01-01"',
},
resolve: { alias },
test: {
projects: [
{
extends: true,
test: {
name: 'app',
include: ['src/**/*.test.{ts,tsx}'],
environment: 'jsdom',
// jsdom binds localStorage to the document origin; the default
// `about:blank` returns a stripped Storage shim. A proper http URL
// gives the full API.
environmentOptions: {
jsdom: {
url: 'http://localhost/',
},
},
setupFiles: ['./src/test/setup.ts'],
css: false,
},
},
{
extends: true,
test: {
name: 'worker',
include: ['worker/**/*.test.ts'],
environment: 'node',
},
},
],
// Vitest 5 clears mocks between tests by default; keep that explicit.
clearMocks: true,
coverage: {
provider: 'v8',
reporter: ['text', 'html', 'lcov'],
include: ['src/**/*.{ts,tsx}', 'worker/**/*.ts'],
exclude: [
'src/**/*.test.{ts,tsx}',
'src/**/__tests__/**',
'worker/**/*.test.ts',
'src/test/**',
'src/main.tsx',
'src/vite-env.d.ts',
'src/components/ui/**',
],
},
},
});