Follow-up from #739 / #741, which made tests/test-utils/helpers/test-utils.ts's createMockFileSystem() honest (no as any, all 16 IFileSystem members) but deliberately did not converge the four definitions that exist. They differ in ways their consumers rely on, so this is a ticket rather than a ride-along:
| Definition |
Type |
Defaults |
Consumers |
tests/test-utils/helpers/test-utils.ts |
@debugmcp/shared IFileSystem, no cast |
pre-configured: pathExists→true, existsSync→true, ensureDir→undefined, readTail/readFile→'', stat→{isDirectory:()=>false,isFile:()=>true}, … |
5 SessionManager-layer suites (proxy-failure-diagnostics, session-manager-attach-modes, -launch-gate, session-manager-test-utils, session-manager-operations-coverage); three carry a comment relying on pathExists→true |
tests/test-utils/helpers/test-dependencies.ts:63 |
same interface, no cast |
none — every member a bare vi.fn() |
proxy-manager-factory.test.ts, proxy-manager-message-handling.test.ts, and createMockDependencies() |
tests/test-utils/helpers/adapter-dependencies.ts:33 |
same interface, (overrides: Partial<IFileSystem> = {}) |
exists/pathExists/existsSync→**false**, spreads overrides |
tests/unit/test-utils/test-proxy-manager.ts (aliased createTypedMockFileSystem) |
tests/test-utils/mocks/dap-proxy-doubles.ts |
the worker-local four-member IFileSystem in src/proxy/dap-proxy-interfaces.ts |
— |
proxy-worker + go-initialized-fallback tests |
The fourth is a different interface on purpose (a wide double would hide a member the worker starts calling) and should stay. The first three are the same interface with three default policies: "everything exists", "nothing answers", "nothing exists + overrides". Consolidating onto any one of them silently changes what the other two's consumers see — test-dependencies.ts's bare version would break the three suites that rely on pathExists→true; adapter-dependencies.ts's false default would too.
Suggested shape: one createMockFileSystem(overrides?: Partial<IFileSystem>) with the "everything exists" defaults (the majority case) in helpers/test-dependencies.ts, createMockDependencies() using it, and the two other files re-exporting or deleted; the test-proxy-manager.ts caller passes { pathExists: vi.fn().mockResolvedValue(false), … } explicitly where it needs the negative. Gate: npx tsc -p tsconfig.spec.json silent and every listed consumer green in isolation.
Same class as #695 / #739 (drifted or duplicated test doubles).
Follow-up from #739 / #741, which made
tests/test-utils/helpers/test-utils.ts'screateMockFileSystem()honest (noas any, all 16IFileSystemmembers) but deliberately did not converge the four definitions that exist. They differ in ways their consumers rely on, so this is a ticket rather than a ride-along:tests/test-utils/helpers/test-utils.ts@debugmcp/sharedIFileSystem, no castpathExists→true,existsSync→true,ensureDir→undefined,readTail/readFile→'',stat→{isDirectory:()=>false,isFile:()=>true}, …SessionManager-layer suites (proxy-failure-diagnostics,session-manager-attach-modes,-launch-gate,session-manager-test-utils,session-manager-operations-coverage); three carry a comment relying onpathExists→truetests/test-utils/helpers/test-dependencies.ts:63vi.fn()proxy-manager-factory.test.ts,proxy-manager-message-handling.test.ts, andcreateMockDependencies()tests/test-utils/helpers/adapter-dependencies.ts:33(overrides: Partial<IFileSystem> = {})exists/pathExists/existsSync→**false**, spreads overridestests/unit/test-utils/test-proxy-manager.ts(aliasedcreateTypedMockFileSystem)tests/test-utils/mocks/dap-proxy-doubles.tsIFileSysteminsrc/proxy/dap-proxy-interfaces.tsThe fourth is a different interface on purpose (a wide double would hide a member the worker starts calling) and should stay. The first three are the same interface with three default policies: "everything exists", "nothing answers", "nothing exists + overrides". Consolidating onto any one of them silently changes what the other two's consumers see —
test-dependencies.ts's bare version would break the three suites that rely onpathExists→true;adapter-dependencies.ts'sfalsedefault would too.Suggested shape: one
createMockFileSystem(overrides?: Partial<IFileSystem>)with the "everything exists" defaults (the majority case) inhelpers/test-dependencies.ts,createMockDependencies()using it, and the two other files re-exporting or deleted; thetest-proxy-manager.tscaller passes{ pathExists: vi.fn().mockResolvedValue(false), … }explicitly where it needs the negative. Gate:npx tsc -p tsconfig.spec.jsonsilent and every listed consumer green in isolation.Same class as #695 / #739 (drifted or duplicated test doubles).