Skip to content

Commit ea90252

Browse files
LaZzyManclaude
andcommitted
test(core): fix autoMode test fixture on Windows
The fixture's mock isPathWithinWorkspace used path.sep to join the root prefix, but the hard-coded test paths use forward slashes regardless of OS. On Windows path.sep is '\\', so prefix matching failed and L5.1 fast-path tests returned false (and the L5.1-gating test then fell into the classifier branch, hitting an undefined getToolRegistry mock). Hard-code '/' in the fixture — it controls only intra-file consistency between mock roots and mock paths, not real workspace behavior. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 13a4421 commit ea90252

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

packages/core/src/permissions/autoMode.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
import { describe, it, expect, vi } from 'vitest';
8-
import * as path from 'node:path';
98
import {
109
SAFE_TOOL_ALLOWLIST,
1110
evaluateAutoMode,
@@ -108,10 +107,10 @@ describe('isInSafeToolAllowlist', () => {
108107
function makeConfig(workspaceRoots: string[]): Config {
109108
return {
110109
getWorkspaceContext: () => ({
110+
// Test fixture: roots and paths in this file use POSIX-style separators
111+
// regardless of OS, so hard-code '/' (not path.sep) for the prefix check.
111112
isPathWithinWorkspace: (p: string) =>
112-
workspaceRoots.some(
113-
(root) => p === root || p.startsWith(root + path.sep),
114-
),
113+
workspaceRoots.some((root) => p === root || p.startsWith(root + '/')),
115114
}),
116115
} as unknown as Config;
117116
}

0 commit comments

Comments
 (0)