mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-12-05 00:27:26 +00:00
Wait for the server verdict and propagate analyzer ERROR records even when the scanner exits successfully. Keep advisory warnings visible and require the scan only on eligible pull requests. Resolve the combined coverage report from the repository root, omit declaration-only files from instrumentation, and preserve malformed-input test cases without malformed strings in the parsed source. Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
343 lines
18 KiB
TypeScript
343 lines
18 KiB
TypeScript
import { defineConfig } from 'vitest/config';
|
|
import PerfSequencer from './test/helpers/perf-sequencer.js';
|
|
|
|
// Keep the native suite's serial include and parallel exclude in sync.
|
|
const multiRepoQueryTest = 'test/integration/mcp-multi-repo-query.test.ts';
|
|
|
|
// Keep native tests in exactly one project (TESTING.md).
|
|
const RESUMABLE_ANALYSIS_NATIVE_TESTS = [
|
|
'test/integration/embedding-input-isolation.test.ts',
|
|
'test/integration/embedding-vector-store.test.ts',
|
|
'test/integration/legacy-vector-reuse-index.test.ts',
|
|
'test/integration/legacy-vector-export.test.ts',
|
|
'test/integration/analysis-embedding-flow.test.ts',
|
|
'test/integration/analysis-generation-routing.test.ts',
|
|
'test/integration/analysis-publication-flow.test.ts',
|
|
'test/integration/embedding-job-controller.test.ts',
|
|
'test/integration/embedding-job-restart.test.ts',
|
|
'test/integration/embedding-native-release.test.ts',
|
|
'test/integration/legacy-embedding-controller.test.ts',
|
|
'test/integration/legacy-vector-source.test.ts',
|
|
];
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
// Shared settings — inherited by all projects via extends: true
|
|
testTimeout: 30000,
|
|
hookTimeout: 120000,
|
|
pool: 'forks',
|
|
globals: true,
|
|
// Keep the Vitest 4 mock lifecycle while upgrading the runner to Vitest 5.
|
|
clearMocks: false,
|
|
// Stable test identity across the Linux/macOS/Windows execution receipts.
|
|
includeTaskLocation: true,
|
|
teardownTimeout: 3000,
|
|
// E2E harnesses pin a small NODE_OPTIONS heap so spawned CLI children
|
|
// stay light; without this opt-out the #2649 auto-heap override would
|
|
// respawn every such child with a RAM-sized cap. Children inherit it via
|
|
// the harnesses' `{ ...process.env }` spreads. Tests that exercise the
|
|
// respawn behavior itself delete GITNEXUS_MEMORY in their own setup.
|
|
// Tests assert the English CLI contract unless a case opts into another
|
|
// language explicitly. Do not inherit a developer shell's CLI locale.
|
|
// GITNEXUS_ATOMIC_INCREMENTAL=0 is an operator off-switch that beats a
|
|
// caller's `atomicIncremental: true`, so an exported `=0` would silently
|
|
// turn off every staging test. Empty is neither '0' nor '1', i.e. unset;
|
|
// a test that needs a value stubs it.
|
|
// Config tests supply their own files; never read a developer's GITNEXUS_RC.
|
|
// CLAUDE_CONFIG_DIR relocates Claude Code's config root, and setup/uninstall
|
|
// honour it: inheriting a developer's value would point setup tests that
|
|
// sandbox HOME at that developer's real config. Empty means unset; cases
|
|
// that exercise the relocation set it themselves.
|
|
env: {
|
|
GITNEXUS_MEMORY: 'off',
|
|
GITNEXUS_LANG: 'en',
|
|
GITNEXUS_ATOMIC_INCREMENTAL: '',
|
|
GITNEXUS_RC: '',
|
|
CLAUDE_CONFIG_DIR: '',
|
|
},
|
|
// N-API destructors can crash worker forks on macOS during process exit.
|
|
// This is independent of the QueryResult lifetime fix in @ladybugdb/core 0.15.2 —
|
|
// it's a vitest forks + native addon interaction where destructors run in
|
|
// arbitrary order at exit. Tests themselves pass; only the exit crashes.
|
|
// TODO: remove once LadybugDB fixes all N-API destructor ordering issues.
|
|
dangerouslyIgnoreUnhandledErrors: true,
|
|
|
|
// Coverage stays at root (not supported in project configs)
|
|
coverage: {
|
|
provider: 'v8',
|
|
include: ['src/**/*.ts'],
|
|
exclude: [
|
|
'**/*.d.ts',
|
|
'src/cli/index.ts', // CLI entry point (commander wiring)
|
|
'src/core/wiki/**', // Wiki generation (requires LLM)
|
|
],
|
|
// Auto-ratchet: vitest bumps thresholds when coverage exceeds them.
|
|
// CI will fail if a PR drops below these floors.
|
|
thresholds: {
|
|
statements: 26,
|
|
branches: 23,
|
|
functions: 28,
|
|
lines: 27,
|
|
},
|
|
},
|
|
|
|
// Balance shards using vitest-shard-balancer and the frozen CI timing history.
|
|
// groupOrder and sort order are left to the base sequencer.
|
|
sequence: {
|
|
sequencer: PerfSequencer,
|
|
},
|
|
|
|
// LadybugDB's native mmap addon causes file-lock conflicts when vitest
|
|
// runs lbug test files in parallel forks on Windows. The 'lbug-db'
|
|
// project forces sequential execution (fileParallelism: false).
|
|
//
|
|
// Each file runs in its own fork — the fork exits after the file
|
|
// completes, triggering an N-API destructor segfault that is caught
|
|
// by dangerouslyIgnoreUnhandledErrors. Tests themselves pass; only
|
|
// the exit crashes. This is safer than isolate: false, which causes
|
|
// native state corruption after 2-3 open/close cycles in the same fork.
|
|
projects: [
|
|
{
|
|
extends: true,
|
|
test: {
|
|
name: 'lbug-db',
|
|
include: [
|
|
...RESUMABLE_ANALYSIS_NATIVE_TESTS,
|
|
'test/integration/analyze-dirty-snapshot.test.ts',
|
|
'test/integration/dangling-owner-edges.test.ts',
|
|
'test/integration/class-expression-owners.test.ts',
|
|
'test/integration/rename-provider-*.test.ts',
|
|
'test/integration/pdg-explicit-owner.test.ts',
|
|
'test/integration/skip-fts.test.ts',
|
|
'test/integration/impact-callable-value-references.test.ts',
|
|
'test/integration/impact-private-type-file-seed.test.ts',
|
|
'test/integration/impact-private-type-source.test.ts',
|
|
'test/integration/impact-context-integrity.test.ts',
|
|
'test/integration/incremental-worktree-context.test.ts',
|
|
'test/integration/incremental-method-integrity.test.ts',
|
|
'test/integration/go-incremental-method-owners.test.ts',
|
|
'test/integration/java-incremental-on-demand.test.ts',
|
|
'test/integration/r-namespace-edit-incremental.test.ts',
|
|
'test/integration/r-virtual-placeholder-incremental.test.ts',
|
|
'test/integration/server-route-hook-config.test.ts',
|
|
'test/integration/query-symbol-integrity.test.ts',
|
|
'test/integration/mcp-index-generation.test.ts',
|
|
multiRepoQueryTest,
|
|
'test/integration/mcp-refresh-index-e2e.test.ts',
|
|
'test/integration/fts-repair-warm-session.test.ts',
|
|
'test/integration/fts-empty-tables.test.ts',
|
|
'test/integration/persisted-mutation-rows.test.ts',
|
|
'test/integration/impact-epistemic-lower-bound.test.ts',
|
|
'test/integration/impact-scope-omission-persistence.test.ts',
|
|
'test/integration/lbug-core-adapter.test.ts',
|
|
'test/integration/lbug-vector-extension.test.ts',
|
|
'test/integration/lbug-pool.test.ts',
|
|
'test/integration/lbug-pool-stability.test.ts',
|
|
'test/integration/local-backend.test.ts',
|
|
'test/integration/bm25-symbol-hydration.test.ts',
|
|
'test/integration/local-backend-calltool.test.ts',
|
|
'test/integration/spring-aop-mcp.test.ts',
|
|
// Native @ladybugdb/core: loads a real graph through loadGraphToLbug
|
|
// and asserts the Destination NULL/join invariant on the stored rows.
|
|
'test/integration/spring-destinations-lbug.test.ts',
|
|
'test/integration/spring-destinations-incremental.test.ts',
|
|
'test/integration/search-core.test.ts',
|
|
'test/integration/search-pool.test.ts',
|
|
'test/integration/fts-description-search.test.ts',
|
|
'test/integration/fts-fullfile-search.test.ts',
|
|
'test/integration/fts-cjk-segmentation-search.test.ts',
|
|
'test/integration/augmentation.test.ts',
|
|
'test/integration/staleness-and-stability.test.ts',
|
|
'test/integration/lbug-lock-retry.test.ts',
|
|
'test/integration/lbug-open-retry.test.ts',
|
|
'test/integration/lbug-close-handle-release.test.ts',
|
|
'test/integration/api-impact-e2e.test.ts',
|
|
'test/integration/shape-check-regression.test.ts',
|
|
'test/integration/java-class-impact.test.ts',
|
|
'test/integration/java-overload-impact-persistence.test.ts',
|
|
'test/integration/class-impact-all-languages.test.ts',
|
|
'test/integration/lbug-orphan-sidecar-recovery.test.ts',
|
|
'test/integration/lbug-interrupted-checkpoint-recovery.test.ts',
|
|
'test/integration/lbug-checkpoint-accounting.test.ts',
|
|
'test/integration/lbug-rel-copy-page-padding.test.ts',
|
|
'test/integration/lbug-incremental-search.test.ts',
|
|
'test/integration/lbug-readonly-init.test.ts',
|
|
// Shared sibling store (#3352): each file runs real analyses and opens
|
|
// the resulting LadybugDB graphs.
|
|
'test/integration/shared-store-analyze.test.ts',
|
|
'test/integration/parse-cache-identity-lifecycle.test.ts',
|
|
'test/integration/parse-cache-identity-package.test.ts',
|
|
'test/integration/shared-store-seed.test.ts',
|
|
'test/integration/shared-store-cache.test.ts',
|
|
'test/integration/shared-store-clean.test.ts',
|
|
'test/integration/shared-store-clone-optin.test.ts',
|
|
'test/integration/shared-store-adoption.test.ts',
|
|
'test/integration/analyze-wal-checkpoint-failure.test.ts',
|
|
'test/integration/lbug-non-ascii-path.test.ts',
|
|
'test/integration/lbug-conn-serialization.test.ts',
|
|
'test/integration/lbug-load-overlap-errors.test.ts',
|
|
'test/integration/load-cached-embeddings-spill.test.ts',
|
|
'test/integration/embedding-chunking-lifecycle.test.ts',
|
|
'test/integration/group/manifest-resolve-symbol-2325.test.ts',
|
|
'test/integration/group/manifest-synthetic-impact-lbug.test.ts',
|
|
'test/integration/group/http-route-resolve-symbol.test.ts',
|
|
'test/integration/http-route-symbol-batch.test.ts',
|
|
'test/integration/group/graphql-resolve-symbol.test.ts',
|
|
'test/integration/fts-stemmer-sweep.test.ts',
|
|
'test/integration/lbug-multiwriter-deadlock.test.ts',
|
|
'test/integration/extension-binary-real.test.ts',
|
|
'test/integration/lbug-delete-nodes-for-files.test.ts',
|
|
'test/integration/lbug-query-importers-batch.test.ts',
|
|
'test/integration/impact-ambiguous-blast-radius.test.ts',
|
|
// #2915. Native @ladybugdb/core via withTestLbugDB(poolAdapter:true),
|
|
// and it drives detect_changes over a real git repo — the mmap
|
|
// file-lock exposure this project serializes (TESTING.md § Vitest
|
|
// projects), on the Windows/macOS platforms #2915 was reported from.
|
|
'test/integration/detect-changes-path-anchoring.test.ts',
|
|
// #2915. Native @ladybugdb/core via withTestLbugDB(poolAdapter:true) —
|
|
// the wiki's graph queries executed by a real engine rather than a
|
|
// fake that answers on `query.includes(...)`.
|
|
'test/integration/wiki-graph-queries-engine.test.ts',
|
|
'test/unit/incremental-dirty-recovery.test.ts',
|
|
// Publication reconciliation uses real native COPY/checkpoints.
|
|
'test/unit/incremental-write-integrity.test.ts',
|
|
'test/unit/incremental-orchestration.test.ts',
|
|
// #2841. Native @ladybugdb/core: it runs real analyses, reopens the
|
|
// DB under different extension-install policies, and reads
|
|
// SHOW_INDEXES on the writable connection — exactly the mmap
|
|
// file-lock exposure this project exists to serialize (TESTING.md
|
|
// § Vitest projects). Registering it here does NOT narrow where it
|
|
// runs: vitest applies `--shard` once to the combined cross-project
|
|
// spec list (PerfSequencer is a complete, disjoint
|
|
// partition), and run-cross-platform.ts hands vitest explicit file
|
|
// paths, which resolve against every project's include list. Its
|
|
// `incremental-vector-extension-ordering` /
|
|
// `incremental-fts-drop-ordering` siblings are equally native and
|
|
// still sit in `default` — pre-existing drift, deliberately left
|
|
// alone here.
|
|
'test/unit/incremental-index-extension-dml-gate.test.ts',
|
|
],
|
|
fileParallelism: false,
|
|
sequence: { groupOrder: 1 },
|
|
},
|
|
},
|
|
{
|
|
extends: true,
|
|
test: {
|
|
name: 'default',
|
|
sequence: { groupOrder: 3 },
|
|
include: ['test/**/*.test.ts'],
|
|
exclude: [
|
|
...RESUMABLE_ANALYSIS_NATIVE_TESTS,
|
|
'test/integration/analyze-dirty-snapshot.test.ts',
|
|
'test/integration/dangling-owner-edges.test.ts',
|
|
'test/integration/class-expression-owners.test.ts',
|
|
'test/integration/rename-provider-*.test.ts',
|
|
'test/integration/pdg-explicit-owner.test.ts',
|
|
'test/integration/skip-fts.test.ts',
|
|
'test/integration/impact-callable-value-references.test.ts',
|
|
'test/integration/impact-private-type-file-seed.test.ts',
|
|
'test/integration/impact-private-type-source.test.ts',
|
|
'test/integration/impact-context-integrity.test.ts',
|
|
'test/integration/incremental-worktree-context.test.ts',
|
|
'test/integration/incremental-method-integrity.test.ts',
|
|
'test/integration/go-incremental-method-owners.test.ts',
|
|
'test/integration/java-incremental-on-demand.test.ts',
|
|
'test/integration/r-namespace-edit-incremental.test.ts',
|
|
'test/integration/r-virtual-placeholder-incremental.test.ts',
|
|
'test/integration/server-route-hook-config.test.ts',
|
|
'test/integration/query-symbol-integrity.test.ts',
|
|
'test/integration/mcp-index-generation.test.ts',
|
|
multiRepoQueryTest,
|
|
'test/integration/mcp-refresh-index-e2e.test.ts',
|
|
'test/integration/fts-repair-warm-session.test.ts',
|
|
'test/integration/fts-empty-tables.test.ts',
|
|
'test/integration/persisted-mutation-rows.test.ts',
|
|
'test/integration/impact-epistemic-lower-bound.test.ts',
|
|
'test/integration/impact-scope-omission-persistence.test.ts',
|
|
'test/integration/lbug-core-adapter.test.ts',
|
|
'test/integration/lbug-vector-extension.test.ts',
|
|
'test/integration/lbug-pool.test.ts',
|
|
'test/integration/lbug-pool-stability.test.ts',
|
|
'test/integration/local-backend.test.ts',
|
|
'test/integration/bm25-symbol-hydration.test.ts',
|
|
'test/integration/local-backend-calltool.test.ts',
|
|
'test/integration/spring-aop-mcp.test.ts',
|
|
'test/integration/spring-destinations-lbug.test.ts',
|
|
'test/integration/spring-destinations-incremental.test.ts',
|
|
'test/integration/search-core.test.ts',
|
|
'test/integration/search-pool.test.ts',
|
|
'test/integration/fts-description-search.test.ts',
|
|
'test/integration/fts-fullfile-search.test.ts',
|
|
'test/integration/fts-cjk-segmentation-search.test.ts',
|
|
'test/integration/augmentation.test.ts',
|
|
'test/integration/staleness-and-stability.test.ts',
|
|
'test/integration/lbug-lock-retry.test.ts',
|
|
'test/integration/lbug-open-retry.test.ts',
|
|
'test/integration/lbug-close-handle-release.test.ts',
|
|
'test/integration/api-impact-e2e.test.ts',
|
|
'test/integration/shape-check-regression.test.ts',
|
|
'test/integration/java-class-impact.test.ts',
|
|
'test/integration/java-overload-impact-persistence.test.ts',
|
|
'test/integration/class-impact-all-languages.test.ts',
|
|
'test/integration/lbug-orphan-sidecar-recovery.test.ts',
|
|
'test/integration/lbug-interrupted-checkpoint-recovery.test.ts',
|
|
'test/integration/lbug-checkpoint-accounting.test.ts',
|
|
'test/integration/lbug-rel-copy-page-padding.test.ts',
|
|
'test/integration/lbug-incremental-search.test.ts',
|
|
'test/integration/lbug-readonly-init.test.ts',
|
|
'test/integration/analyze-wal-checkpoint-failure.test.ts',
|
|
'test/integration/lbug-non-ascii-path.test.ts',
|
|
'test/integration/lbug-conn-serialization.test.ts',
|
|
'test/integration/lbug-load-overlap-errors.test.ts',
|
|
'test/integration/load-cached-embeddings-spill.test.ts',
|
|
'test/integration/embedding-chunking-lifecycle.test.ts',
|
|
'test/integration/group/manifest-resolve-symbol-2325.test.ts',
|
|
'test/integration/group/manifest-synthetic-impact-lbug.test.ts',
|
|
'test/integration/group/http-route-resolve-symbol.test.ts',
|
|
'test/integration/http-route-symbol-batch.test.ts',
|
|
'test/integration/group/graphql-resolve-symbol.test.ts',
|
|
'test/integration/skills-e2e.test.ts',
|
|
'test/integration/fts-extension-e2e.test.ts',
|
|
'test/integration/fts-stemmer-sweep.test.ts',
|
|
'test/integration/lbug-multiwriter-deadlock.test.ts',
|
|
'test/integration/extension-binary-real.test.ts',
|
|
'test/integration/lbug-delete-nodes-for-files.test.ts',
|
|
'test/integration/lbug-query-importers-batch.test.ts',
|
|
'test/integration/impact-ambiguous-blast-radius.test.ts',
|
|
'test/integration/detect-changes-path-anchoring.test.ts',
|
|
'test/integration/wiki-graph-queries-engine.test.ts',
|
|
'test/unit/incremental-dirty-recovery.test.ts',
|
|
'test/unit/incremental-write-integrity.test.ts',
|
|
'test/unit/incremental-orchestration.test.ts',
|
|
// Excluded here because it is included by `lbug-db` above; a file
|
|
// in two projects would be collected (and run) twice.
|
|
'test/unit/incremental-index-extension-dml-gate.test.ts',
|
|
'test/integration/shared-store-analyze.test.ts',
|
|
'test/integration/parse-cache-identity-lifecycle.test.ts',
|
|
'test/integration/parse-cache-identity-package.test.ts',
|
|
'test/integration/shared-store-seed.test.ts',
|
|
'test/integration/shared-store-cache.test.ts',
|
|
'test/integration/shared-store-clean.test.ts',
|
|
'test/integration/shared-store-clone-optin.test.ts',
|
|
'test/integration/shared-store-adoption.test.ts',
|
|
],
|
|
},
|
|
},
|
|
{
|
|
extends: true,
|
|
test: {
|
|
name: 'cli-e2e',
|
|
include: [
|
|
'test/integration/skills-e2e.test.ts',
|
|
// Spawns the real CLI per test; runs sequentially (fileParallelism:
|
|
// false) so it doesn't aggravate the under-load timeout-flake class.
|
|
'test/integration/fts-extension-e2e.test.ts',
|
|
],
|
|
fileParallelism: false,
|
|
sequence: { groupOrder: 2 },
|
|
},
|
|
},
|
|
],
|
|
},
|
|
});
|