mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-09 09:30:41 -07:00
fix(cli): resolve devtools build issues and update third-party notices
This commit is contained in:
@@ -3292,9 +3292,8 @@ describe('AppContainer State Management', () => {
|
||||
|
||||
describe('Permission Handling', () => {
|
||||
it('shows permission dialog when checkPermissions returns paths', async () => {
|
||||
const { checkPermissions } = await import(
|
||||
'./hooks/atCommandProcessor.js'
|
||||
);
|
||||
const { checkPermissions } =
|
||||
await import('./hooks/atCommandProcessor.js');
|
||||
vi.mocked(checkPermissions).mockResolvedValue(['/test/file.txt']);
|
||||
|
||||
let unmount: () => void;
|
||||
@@ -3316,9 +3315,8 @@ describe('AppContainer State Management', () => {
|
||||
it.each([true, false])(
|
||||
'handles permissions when allowed is %s',
|
||||
async (allowed) => {
|
||||
const { checkPermissions } = await import(
|
||||
'./hooks/atCommandProcessor.js'
|
||||
);
|
||||
const { checkPermissions } =
|
||||
await import('./hooks/atCommandProcessor.js');
|
||||
vi.mocked(checkPermissions).mockResolvedValue(['/test/file.txt']);
|
||||
const addReadOnlyPathSpy = vi.spyOn(
|
||||
mockConfig.getWorkspaceContext(),
|
||||
|
||||
@@ -1392,9 +1392,9 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
}, []);
|
||||
const shouldShowIdePrompt = Boolean(
|
||||
currentIDE &&
|
||||
!config.getIdeMode() &&
|
||||
!settings.merged.ide.hasSeenNudge &&
|
||||
!idePromptAnswered,
|
||||
!config.getIdeMode() &&
|
||||
!settings.merged.ide.hasSeenNudge &&
|
||||
!idePromptAnswered,
|
||||
);
|
||||
|
||||
const [showErrorDetails, setShowErrorDetails] = useState<boolean>(false);
|
||||
@@ -1656,9 +1656,8 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
if (keyMatchers[Command.SHOW_ERROR_DETAILS](key)) {
|
||||
if (settings.merged.general.devtools) {
|
||||
void (async () => {
|
||||
const { toggleDevToolsPanel } = await import(
|
||||
'../utils/devtoolsService.js'
|
||||
);
|
||||
const { toggleDevToolsPanel } =
|
||||
await import('../utils/devtoolsService.js');
|
||||
await toggleDevToolsPanel(
|
||||
config,
|
||||
showErrorDetails,
|
||||
@@ -2073,11 +2072,9 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
let isMounted = true;
|
||||
|
||||
const fetchBannerTexts = async () => {
|
||||
const [defaultBanner, warningBanner] = await Promise.all([
|
||||
// TODO: temporarily disabling the banner, it will be re-added.
|
||||
'',
|
||||
config.getBannerTextCapacityIssues(),
|
||||
]);
|
||||
// TODO: temporarily disabling the banner, it will be re-added.
|
||||
const defaultBanner = '';
|
||||
const warningBanner = await config.getBannerTextCapacityIssues();
|
||||
|
||||
if (isMounted) {
|
||||
setDefaultBannerText(defaultBanner);
|
||||
|
||||
@@ -73,9 +73,8 @@ describe('authCommand', () => {
|
||||
const logoutCommand = authCommand.subCommands?.[1];
|
||||
expect(logoutCommand?.name).toBe('logout');
|
||||
|
||||
const { clearCachedCredentialFile } = await import(
|
||||
'@google/gemini-cli-core'
|
||||
);
|
||||
const { clearCachedCredentialFile } =
|
||||
await import('@google/gemini-cli-core');
|
||||
|
||||
await logoutCommand!.action!(mockContext, '');
|
||||
|
||||
|
||||
@@ -1048,9 +1048,8 @@ describe('extensionsCommand', () => {
|
||||
const prompts = (await import('prompts')).default;
|
||||
vi.mocked(prompts).mockResolvedValue({ overwrite: true });
|
||||
|
||||
const { getScopedEnvContents } = await import(
|
||||
'../../config/extensions/extensionSettings.js'
|
||||
);
|
||||
const { getScopedEnvContents } =
|
||||
await import('../../config/extensions/extensionSettings.js');
|
||||
vi.mocked(getScopedEnvContents).mockResolvedValue({});
|
||||
});
|
||||
|
||||
|
||||
@@ -142,15 +142,15 @@ const inScreen = (): boolean =>
|
||||
const isSSH = (): boolean =>
|
||||
Boolean(
|
||||
process.env['SSH_TTY'] ||
|
||||
process.env['SSH_CONNECTION'] ||
|
||||
process.env['SSH_CLIENT'],
|
||||
process.env['SSH_CONNECTION'] ||
|
||||
process.env['SSH_CLIENT'],
|
||||
);
|
||||
|
||||
const isWSL = (): boolean =>
|
||||
Boolean(
|
||||
process.env['WSL_DISTRO_NAME'] ||
|
||||
process.env['WSLENV'] ||
|
||||
process.env['WSL_INTEROP'],
|
||||
process.env['WSLENV'] ||
|
||||
process.env['WSL_INTEROP'],
|
||||
);
|
||||
|
||||
const isWindowsTerminal = (): boolean =>
|
||||
|
||||
@@ -220,9 +220,8 @@ describe('rewindFileOps', () => {
|
||||
});
|
||||
|
||||
it('reverts exact match', async () => {
|
||||
const { getFileDiffFromResultDisplay } = await import(
|
||||
'@google/gemini-cli-core'
|
||||
);
|
||||
const { getFileDiffFromResultDisplay } =
|
||||
await import('@google/gemini-cli-core');
|
||||
vi.mocked(getFileDiffFromResultDisplay).mockReturnValue({
|
||||
filePath: '/abs/path/test.ts',
|
||||
fileName: 'test.ts',
|
||||
@@ -270,9 +269,8 @@ describe('rewindFileOps', () => {
|
||||
});
|
||||
|
||||
it('deletes new file on revert', async () => {
|
||||
const { getFileDiffFromResultDisplay } = await import(
|
||||
'@google/gemini-cli-core'
|
||||
);
|
||||
const { getFileDiffFromResultDisplay } =
|
||||
await import('@google/gemini-cli-core');
|
||||
vi.mocked(getFileDiffFromResultDisplay).mockReturnValue({
|
||||
filePath: '/abs/path/new.ts',
|
||||
fileName: 'new.ts',
|
||||
@@ -317,9 +315,8 @@ describe('rewindFileOps', () => {
|
||||
});
|
||||
|
||||
it('handles smart revert (patching) successfully', async () => {
|
||||
const { getFileDiffFromResultDisplay } = await import(
|
||||
'@google/gemini-cli-core'
|
||||
);
|
||||
const { getFileDiffFromResultDisplay } =
|
||||
await import('@google/gemini-cli-core');
|
||||
vi.mocked(getFileDiffFromResultDisplay).mockReturnValue({
|
||||
filePath: '/abs/path/test.ts',
|
||||
fileName: 'test.ts',
|
||||
@@ -369,9 +366,8 @@ describe('rewindFileOps', () => {
|
||||
});
|
||||
|
||||
it('emits warning on smart revert failure', async () => {
|
||||
const { getFileDiffFromResultDisplay } = await import(
|
||||
'@google/gemini-cli-core'
|
||||
);
|
||||
const { getFileDiffFromResultDisplay } =
|
||||
await import('@google/gemini-cli-core');
|
||||
vi.mocked(getFileDiffFromResultDisplay).mockReturnValue({
|
||||
filePath: '/abs/path/test.ts',
|
||||
fileName: 'test.ts',
|
||||
@@ -421,9 +417,8 @@ describe('rewindFileOps', () => {
|
||||
});
|
||||
|
||||
it('emits error if fs.readFile fails with a generic error', async () => {
|
||||
const { getFileDiffFromResultDisplay } = await import(
|
||||
'@google/gemini-cli-core'
|
||||
);
|
||||
const { getFileDiffFromResultDisplay } =
|
||||
await import('@google/gemini-cli-core');
|
||||
vi.mocked(getFileDiffFromResultDisplay).mockReturnValue({
|
||||
filePath: '/abs/path/test.ts',
|
||||
fileName: 'test.ts',
|
||||
|
||||
@@ -47,13 +47,14 @@ describe('textUtils', () => {
|
||||
describe('getCachedStringWidth', () => {
|
||||
it('should handle unicode characters that crash string-width', () => {
|
||||
// U+0602 caused string-width to crash (see #16418)
|
||||
// Newer versions of string-width correctly identify it as width 0.
|
||||
const char = '';
|
||||
expect(getCachedStringWidth(char)).toBe(1);
|
||||
expect(getCachedStringWidth(char)).toBe(0);
|
||||
});
|
||||
|
||||
it('should handle unicode characters that crash string-width with ANSI codes', () => {
|
||||
const charWithAnsi = '\u001b[31m' + '' + '\u001b[0m';
|
||||
expect(getCachedStringWidth(charWithAnsi)).toBe(1);
|
||||
expect(getCachedStringWidth(charWithAnsi)).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user