Repository navigation
test: ensure cross-platform environment isolation in isolateHome - #133
Open
reginaldalfret wants to merge 1 commit into
Open
reginaldalfret wants to merge 1 commit into
reginaldalfret wants to merge 1 commit into
Conversation
Stub both HOME and USERPROFILE in isolateHome to ensure Node's os.homedir() is properly redirected to the isolated temporary directory across all operating systems. On Windows, os.homedir() prioritizes USERPROFILE over HOME, which previously led to tests writing to the host user's actual ~/.cursor configuration. Also: - Add unit tests for isolateHome in packages/testing - Enable vitest runner in @spotify-confidence/testing - Skip POSIX permission bit checks on Windows in store.test.ts - Normalize path resolution assertions for --dir in CLI tests Signed-off-by: reginaldalfret <reginaldalfret@gmail.com>
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
PR #116 introduced
isolateHomein@spotify-confidence/testingto isolate test runs from developer config directories like~/.cursor/. However, it only stubbedprocess.env.HOME.On Windows, Node.js
os.homedir()evaluatesprocess.env.USERPROFILEfirst before falling back toHOME. As a result, tests usingisolateHomeon Windows did not redirectos.homedir()to the isolated temporary directory, causing tests (such ascursor disconnectMcpServer) to access and mutate the developer's real host machine configs.Changes
packages/testing/src/scaffold/home-scaffold.ts: Stub bothHOMEandUSERPROFILEto ensureos.homedir()correctly resolves to the temporary test directory across all platforms.packages/testing/__tests__/home-scaffold.test.ts: Add unit tests verifying environment isolation and cleanup across platforms.packages/testing/package.json: Add missing"test": "vitest run"script so testing package utilities are exercised.packages/core/__tests__/auth/credentials/store.test.ts: Skip POSIX permission checks (0700/0600) on Windows using existingisWindowshelper, as Windows filesystem does not support POSIX permission bits.packages/cli/__tests__/commands/mcp.test.ts&plugin.test.ts: Useresolve()for--dirassertion paths to support cross-platform path separators consistently withplugin install.Validation
pnpm typecheck: Passed across all packages.pnpm --filter @spotify-confidence/testing test: Passed (4/4 tests).pnpm --filter @spotify-confidence/core test: Passed (156 passed, 2 skipped).pnpm --filter @spotify-confidence/cli test: Passed (257/257 tests).