mirror of
https://github.com/hanzoai/extension.git
synced 2026-10-31 19:52:25 +00:00
The package's `npm test` has been broken-by-construction for years: tsconfig excluded src/test entirely (out/test/runTest.js never existed), tsconfig.test.json inherited the exclude that negated its include, the runner pointed at a ./suite/index path that never existed, two suites used BDD describe/it under the tdd-configured mocha, a vitest file sat in the mocha glob, `ws` was never declared (it resolved only cross-package), and 154 eslint errors blocked pretest. Lint 154 → 0 with real fixes: the ban-types autofix damage reverted properly (the local `Symbol` interface shadowing the ES built-in — the actual footgun — is now `CodeSymbol` everywhere), case bodies braced via AST codemod, empty catches annotated, `Function` types replaced with real signatures, hasOwnProperty via Object.prototype, and @typescript-eslint/no-var-requires off — CJS lazy requires are the intentional activation-perf idiom (the rule is retired to stylistic in typescript-eslint v8). Harness: tests compile via tsconfig.test.json in pretest; runner path fixed; BDD→TDD; glob v10 promise API; esModuleInterop default imports. Two harnesses, one directory each: vitest owns src/test/vitest/ (scoped vitest.config, excluded from the mocha compile), mocha owns the rest; posttest runs the vitest side so `npm test` is the whole gate. Suites modernized against current tool contracts (34 passing / 64 failing → 152 passing / 0 failing / 12 pending): web-fetch rewritten against the real http(s) path via loopback server, mode against list/activate/show/ current, mcp-tools against config-driven getAllTools filtering, extension pins the shipped manifest contract, shell/process/git-search/filesystem/ config/bash/mcp-runner exercise real commands, files, repos and spawns. Dead-subject suites removed; network-dependent integration tests gated on HANZO_E2E_LIVE with visible skip reasons (12 pending). Tests-only — the one suspected product bug was an unfaithful Memento mock, and a real cross-suite settings leak was fixed by making suites hermetic. CI: cli-tools and vscode test steps lose continue-on-error and become hard gates (vscode under xvfb-run, same as the E2E job).
20 lines
593 B
TypeScript
20 lines
593 B
TypeScript
import { defineConfig } from 'vitest/config';
|
|
import path from 'path';
|
|
|
|
// Two harnesses live in this package: the mocha/vscode-test extension-host
|
|
// suites (src/test/**, compiled via tsconfig.test.json, run by `npm test`)
|
|
// and plain-node vitest suites. Each owns exactly one directory — vitest
|
|
// files go in src/test/vitest/ and are excluded from the mocha compile.
|
|
export default defineConfig({
|
|
test: {
|
|
globals: true,
|
|
environment: 'node',
|
|
include: ['src/test/vitest/**/*.test.ts'],
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src')
|
|
}
|
|
}
|
|
});
|