mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
# 🚀 Sync Gemini CLI v0.2.1 - Major Feature Update (#483)
This commit is contained in:
@@ -12,15 +12,16 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { expect } from 'vitest';
|
||||
import { Assertion, expect } from 'vitest';
|
||||
import type { TextBuffer } from '../ui/components/shared/text-buffer.js';
|
||||
|
||||
// RegExp to detect invalid characters: backspace, and ANSI escape codes
|
||||
// eslint-disable-next-line no-control-regex
|
||||
const invalidCharsRegex = /[\b\x1b]/;
|
||||
|
||||
function toHaveOnlyValidCharacters(this: vi.Assertion, buffer: TextBuffer) {
|
||||
const { isNot } = this;
|
||||
function toHaveOnlyValidCharacters(this: Assertion, buffer: TextBuffer) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const { isNot } = this as any;
|
||||
let pass = true;
|
||||
const invalidLines: Array<{ line: number; content: string }> = [];
|
||||
|
||||
@@ -50,7 +51,8 @@ function toHaveOnlyValidCharacters(this: vi.Assertion, buffer: TextBuffer) {
|
||||
|
||||
expect.extend({
|
||||
toHaveOnlyValidCharacters,
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any);
|
||||
|
||||
// Extend Vitest's `expect` interface with the custom matcher's type definition.
|
||||
declare module 'vitest' {
|
||||
|
||||
@@ -54,7 +54,8 @@ export const createMockCommandContext = (
|
||||
loadHistory: vi.fn(),
|
||||
toggleCorgiMode: vi.fn(),
|
||||
toggleVimEnabled: vi.fn(),
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any,
|
||||
session: {
|
||||
sessionShellAllowlist: new Set<string>(),
|
||||
stats: {
|
||||
@@ -73,7 +74,6 @@ export const createMockCommandContext = (
|
||||
},
|
||||
promptCount: 0,
|
||||
} as SessionStatsState,
|
||||
resetSession: vi.fn(),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
18
packages/cli/src/test-utils/render.tsx
Normal file
18
packages/cli/src/test-utils/render.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { render } from 'ink-testing-library';
|
||||
import React from 'react';
|
||||
import { KeypressProvider } from '../ui/contexts/KeypressContext.js';
|
||||
|
||||
export const renderWithProviders = (
|
||||
component: React.ReactElement,
|
||||
): ReturnType<typeof render> =>
|
||||
render(
|
||||
<KeypressProvider kittyProtocolEnabled={true}>
|
||||
{component}
|
||||
</KeypressProvider>,
|
||||
);
|
||||
Reference in New Issue
Block a user