Files
3x-ui/frontend/vitest.config.ts
T
MHSanaei 89e200ead4 fix(frontend): key geo entries by page position and clear test-suite noise
Zod 4: use the `error` param instead of the deprecated `message`.
lint:deprecated missed these because tsgolint's no-deprecated does not
resolve object-literal properties on a `string | Params` union.

Geodata: key geo entry rows by page position. antd deprecates rowKey's
index argument, and kind:value repeats within a page because the reader
drops domain attributes (22 pairs in geosite_IR.dat, 108 in geosite_RU).

Nord/PIA: the "All cities/regions" option used a null value, which antd
warns on. Map it through a sentinel at the Select boundary so form state
stays null, with tests that fail when the sentinel is not mapped back.

Tests:
- Run the oxlint guard through node; .bin/oxlint is a sh shim Windows
  cannot spawn, and the swallowed error left both guard cases vacuous.
- Start unit workers with --no-experimental-webstorage; msw's localStorage
  probe made Node 25+ warn once per forked worker.
- Set IS_REACT_ACT_ENVIRONMENT, which RTL never sets with globals: false,
  and settle the async updates it exposed inside act(). The row-cells
  memo test now fails when memo is removed.
- Disable antd's click wave in Storybook; it re-rendered inside the next
  story's act() and tripped "not configured to support act".
- Assert InboundFormModal's validation log instead of leaking it, and
  give the rule-form test a well-formed clients/list response.
2026-09-25 21:21:03 +02:00

61 lines
1.7 KiB
TypeScript

import path from 'node:path';
import react from '@vitejs/plugin-react';
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
import { playwright } from '@vitest/browser-playwright';
import { defineConfig } from 'vitest/config';
const dirname = import.meta.dirname;
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@': path.resolve(dirname, 'src'),
},
},
test: {
globals: false,
// Keep jsdom-heavy form tests within the memory budget of local and CI runners.
maxWorkers: 2,
projects: [
{
extends: true,
test: {
name: 'unit',
include: ['src/test/**/*.test.ts'],
environment: 'node',
// msw probes localStorage on load; Node 25+'s file-less one warns per worker.
execArgv: ['--no-experimental-webstorage'],
setupFiles: ['./src/test/setup.ts', './src/test/setup.msw.ts'],
},
},
{
extends: true,
test: {
name: 'components',
include: ['src/test/**/*.test.tsx'],
environment: 'jsdom',
setupFiles: ['./src/test/setup.ts', './src/test/setup.components.ts'],
},
},
{
extends: true,
optimizeDeps: {
include: ['aria-query', 'lz-string', 'pretty-format', 'dom-accessibility-api'],
},
plugins: [storybookTest({ configDir: path.join(dirname, '.storybook') })],
test: {
name: 'storybook',
browser: {
enabled: true,
headless: true,
provider: playwright({}),
instances: [{ browser: 'chromium' }],
},
},
},
],
},
});