mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-23 20:40:41 -07:00
fix(core): handle Windows paths and update test assertions
This commit is contained in:
@@ -75,9 +75,9 @@ describe('forbiddenResourceService', () => {
|
||||
|
||||
expect(resources).toEqual(
|
||||
expect.arrayContaining([
|
||||
{ path: '/workspace/node_modules', isDirectory: true },
|
||||
{ path: '/workspace/.env', isDirectory: false },
|
||||
{ path: '/workspace/secrets', isDirectory: true },
|
||||
{ absolutePath: '/workspace/node_modules', isDirectory: true },
|
||||
{ absolutePath: '/workspace/.env', isDirectory: false },
|
||||
{ absolutePath: '/workspace/secrets', isDirectory: true },
|
||||
]),
|
||||
);
|
||||
expect(resources).toHaveLength(3);
|
||||
|
||||
@@ -139,8 +139,11 @@ function isResourceForbidden(
|
||||
isDirectory: boolean,
|
||||
ignoreManager: IgnoreManager,
|
||||
): boolean {
|
||||
// The `ignore` package expects paths to be relative to the workspace root.
|
||||
let relativePath = path.relative(workspacePath, resourcePath);
|
||||
// The `ignore` package expects paths to be relative to the workspace root
|
||||
// and strictly uses forward slashes (/) as directory separators.
|
||||
let relativePath = path
|
||||
.relative(workspacePath, resourcePath)
|
||||
.replace(/\\/g, '/');
|
||||
|
||||
// Directories must end with a trailing slash to correctly match
|
||||
// directory-only rules.
|
||||
|
||||
Reference in New Issue
Block a user