mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-15 00:21:09 -07:00
address feedback
This commit is contained in:
@@ -22,14 +22,14 @@ describe('getPackageJson', () => {
|
||||
});
|
||||
|
||||
it('should return packageJson when found', async () => {
|
||||
const mockPackageJson = { name: 'test-pkg', version: '1.2.3' };
|
||||
const expectedPackageJsonResult = { name: 'test-pkg', version: '1.2.3' };
|
||||
vi.mocked(readPackageUp).mockResolvedValue({
|
||||
packageJson: mockPackageJson,
|
||||
packageJson: expectedPackageJsonResult,
|
||||
path: '/path/to/package.json',
|
||||
});
|
||||
|
||||
const result = await getPackageJson('/some/path');
|
||||
expect(result).toEqual(mockPackageJson);
|
||||
expect(result).toEqual(expectedPackageJsonResult);
|
||||
expect(readPackageUp).toHaveBeenCalledWith({
|
||||
cwd: '/some/path',
|
||||
normalize: false,
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
readPackageUp,
|
||||
type PackageJson as BasePackageJson,
|
||||
} from 'read-package-up';
|
||||
import { debugLogger } from './debugLogger.js';
|
||||
|
||||
export type PackageJson = BasePackageJson & {
|
||||
config?: {
|
||||
@@ -39,7 +40,8 @@ export async function getPackageJson(
|
||||
}
|
||||
|
||||
return result.packageJson;
|
||||
} catch (_error) {
|
||||
} catch (error) {
|
||||
debugLogger.error('Error occurred while reading package.json', error);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user