mirror of
https://github.com/proffesor-for-testing/agentic-qe.git
synced 2026-09-19 08:45:47 +08:00
2253d05618
Remove the nested v3/ subdirectory by moving all active source code, tests, configs, and assets directly to the project root. Archive v2/ (dead code, 847MB) to v2-archive.tar.gz. Key changes: - Move v3/src/ → src/, v3/tests/ → tests/, v3/packages/ → packages/ - Move v3/tsconfig.json, v3/vitest.config.ts to root - Merge v3/package.json into root package.json (ESM, scripts, deps, exports) - Merge v3/scripts/ into scripts/, v3/implementation/ into docs/implementation/ - Update all CI workflows to remove "cd v3 &&" and v3/ path prefixes - Fix all init installer path resolution (3-level-up → 2-level-up) - Fix hooks to use "node ./dist/cli/bundle.js" instead of bare "aqe" - Update settings.json ADR/DDD directories to docs/implementation/ - Fix helper scripts (statusline, adr-compliance, ddd-tracker, guidance-hooks) - Update 58 agent definitions: aqe/v3/ → aqe/ memory namespaces - Update 15 guidance shards: v3/src/ → src/ path references - Fix sync interfaces: remove v3/ and v2/ path references - Fix test path calculations (process.cwd() + '..' no longer needed) - Fix flaky perf test threshold (500ms → 1000ms for CI environments) - Fix complexity-analyzer test to match ADR-051 keyword-based eligibility Build passes, 17,901 tests pass, CLI and MCP bundles verified. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
63 lines
2.1 KiB
TypeScript
63 lines
2.1 KiB
TypeScript
/**
|
|
* Integration Test DB Isolation
|
|
*
|
|
* Import this in integration test files that use services with KV persistence
|
|
* (e.g., ComplianceReporter, EvolutionPipeline, ContinueGate).
|
|
*
|
|
* Creates an isolated temp database per test file so tests never touch
|
|
* the main .agentic-qe/memory.db. The temp directory is created before
|
|
* all tests and destroyed after all tests complete.
|
|
*
|
|
* Usage in test files:
|
|
* import '../setup'; // at the top of the test file
|
|
*/
|
|
|
|
import { beforeAll, afterAll } from 'vitest';
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import os from 'os';
|
|
|
|
let testProjectRoot: string | null = null;
|
|
let originalProjectRoot: string | undefined;
|
|
|
|
beforeAll(() => {
|
|
// Save original value to restore in afterAll
|
|
originalProjectRoot = process.env.AQE_PROJECT_ROOT;
|
|
|
|
// Reset any existing singleton from a previous test file in the same worker
|
|
try {
|
|
const { UnifiedMemoryManager } = require('../../src/kernel/unified-memory');
|
|
UnifiedMemoryManager.resetInstance();
|
|
} catch {
|
|
// Not available — no singleton to reset
|
|
}
|
|
|
|
// Create a temp directory that mimics a project root with .agentic-qe/
|
|
testProjectRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'aqe-test-'));
|
|
fs.mkdirSync(path.join(testProjectRoot, '.agentic-qe'), { recursive: true });
|
|
|
|
// Override the project root so all DB access goes to the temp directory
|
|
process.env.AQE_PROJECT_ROOT = testProjectRoot;
|
|
});
|
|
|
|
afterAll(() => {
|
|
// Reset the singleton so it doesn't hold a connection to the temp DB
|
|
try {
|
|
const { UnifiedMemoryManager } = require('../../src/kernel/unified-memory');
|
|
UnifiedMemoryManager.resetInstance();
|
|
} catch {
|
|
// May not be available in all test environments
|
|
}
|
|
|
|
// Restore original project root
|
|
if (originalProjectRoot !== undefined) {
|
|
process.env.AQE_PROJECT_ROOT = originalProjectRoot;
|
|
}
|
|
|
|
// Clean up the temp directory
|
|
if (testProjectRoot && fs.existsSync(testProjectRoot)) {
|
|
fs.rmSync(testProjectRoot, { recursive: true, force: true });
|
|
}
|
|
testProjectRoot = null;
|
|
});
|