test: migrate adapter tests off process.platform/version mutation (#186)#189
Merged
Conversation
Extends the #183 seam pattern to the adapter packages so no test redefines process.platform or process.version on the shared fork-worker process object (68 mutation sites across 8 test files). Production seams added, all defaulting to the real value so behavior is unchanged when omitted: - shared: AdapterPolicy.getAdapterSpawnConfig gains optional platform/arch params; RustAdapterPolicy implements them - adapter-rust: RustDebugAdapter constructor-injects platform (GenericAdapterManager precedent); getRustBinaryPath and findDlltoolExecutable gain trailing platform params - adapter-python: findPythonExecutable and CommandFinder.find gain trailing platform params; WhichCommandFinder branches on the param - adapter-dotnet: listDotnetProcesses, getProcessExecutablePath, getProcessExecutableDir, getProcessArchitecture gain trailing platform params - adapter-ruby: getRubySearchPaths, getRdbgSearchPaths, findRubyExecutable, findRdbgExecutable gain trailing platform params - adapter-javascript: JavascriptAdapterFactory.validate gains a trailing nodeVersion param Tests now pass 'win32'/'linux'/'darwin' (or a version string) explicitly; all defineProperty/spyOn save-restore machinery deleted. Fixes #186 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #186 — removes all 68
Object.defineProperty(process, 'platform'|'version')/vi.spyOn(process, 'platform')mutation sites across 8 adapter-package test files by extending the seam pattern #183 (PR #185) established. No production behavior changes: every new parameter defaults to the realprocess.platform/process.arch/process.version.Production seams added
AdapterPolicy.getAdapterSpawnConfiginterface gains optional trailingplatform/archparams (mirrors the existingresolveExecutablePathprecedent);RustAdapterPolicyimplements them. Source-compatible: the 7 other policy implementations and both call sites indap-proxy-worker.tsneed no changes.RustDebugAdapterconstructor-injects platform (mirrorsGenericAdapterManager); all 10 method-body reads usethis.platform.getRustBinaryPath/findDlltoolExecutablegain trailing platform params.findPythonExecutablegains a trailing platform param, threaded intoCommandFinder.find(cmd, platform?);WhichCommandFinderbranches on the param (ComSpec fallback, Path→PATH copy, Store-alias filter).listDotnetProcesses,getProcessExecutablePath,getProcessExecutableDir,getProcessArchitecturegain trailing platform params (the latter two thread through).getRubySearchPaths,getRdbgSearchPaths,findRubyExecutable,findRdbgExecutablegain trailing platform params (completes the filebuildRdbgInvocationstarted in #183).JavascriptAdapterFactory.validategains a trailingnodeVersionparam (override-compatible withIAdapterFactory.validate()).Tests now pass
'win32'/'linux'/'darwin'(or'v12.22.0') explicitly; all save/restore machinery is deleted (−184 net lines). The rust toolchain tests construct per-test adapters with an explicit platform instead of mutating thebeforeEachone. A side benefit: thewin32-x64codelldb assertion inadapter-policy-rust.test.tsnow passes an explicit'x64'arch, making it hermetic on arm64 hosts.Acceptance (from the issue)
rg -n "defineProperty\(process|spyOn\(process,\s*'platform'|spyOn\(process,\s*'version'"over the whole repo returns nothing (baseline: 68 hits in 8 files)Verification
LEAK_GUARD_STRICT=1: 154 files / 2488 tests passpnpm run build(full workspace typecheck) clean; lint cleanRefs #183, #159.
🤖 Generated with Claude Code