mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 12:11:09 +00:00
Merge branch 'main' into feat/sandbox-config-improvements
This commit is contained in:
commit
3a549419ba
363 changed files with 37015 additions and 6989 deletions
|
|
@ -242,9 +242,14 @@ describe('parseArguments', () => {
|
|||
});
|
||||
|
||||
it('should allow -r flag as alias for --resume', async () => {
|
||||
process.argv = ['node', 'script.js', '-r', 'session-123'];
|
||||
process.argv = [
|
||||
'node',
|
||||
'script.js',
|
||||
'-r',
|
||||
'123e4567-e89b-12d3-a456-426614174000',
|
||||
];
|
||||
const argv = await parseArguments();
|
||||
expect(argv.resume).toBe('session-123');
|
||||
expect(argv.resume).toBe('123e4567-e89b-12d3-a456-426614174000');
|
||||
});
|
||||
|
||||
it('should allow -c flag as alias for --continue', async () => {
|
||||
|
|
@ -543,6 +548,43 @@ describe('loadCliConfig', () => {
|
|||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('should reset context file names to QWEN.md and AGENTS.md by default', async () => {
|
||||
process.argv = ['node', 'script.js'];
|
||||
const argv = await parseArguments();
|
||||
const settings: Settings = {};
|
||||
const setGeminiMdFilenameSpy = vi.spyOn(
|
||||
ServerConfig,
|
||||
'setGeminiMdFilename',
|
||||
);
|
||||
|
||||
await loadCliConfig(settings, argv);
|
||||
|
||||
expect(setGeminiMdFilenameSpy).toHaveBeenCalledTimes(1);
|
||||
expect(setGeminiMdFilenameSpy).toHaveBeenCalledWith([
|
||||
ServerConfig.DEFAULT_CONTEXT_FILENAME,
|
||||
ServerConfig.AGENT_CONTEXT_FILENAME,
|
||||
]);
|
||||
});
|
||||
|
||||
it('should use configured context file name when settings.context.fileName is set', async () => {
|
||||
process.argv = ['node', 'script.js'];
|
||||
const argv = await parseArguments();
|
||||
const settings: Settings = {
|
||||
context: {
|
||||
fileName: 'CUSTOM_AGENTS.md',
|
||||
},
|
||||
};
|
||||
const setGeminiMdFilenameSpy = vi.spyOn(
|
||||
ServerConfig,
|
||||
'setGeminiMdFilename',
|
||||
);
|
||||
|
||||
await loadCliConfig(settings, argv);
|
||||
|
||||
expect(setGeminiMdFilenameSpy).toHaveBeenCalledTimes(1);
|
||||
expect(setGeminiMdFilenameSpy).toHaveBeenCalledWith('CUSTOM_AGENTS.md');
|
||||
});
|
||||
|
||||
it('should propagate stream-json formats to config', async () => {
|
||||
process.argv = [
|
||||
'node',
|
||||
|
|
@ -562,6 +604,35 @@ describe('loadCliConfig', () => {
|
|||
expect(config.getIncludePartialMessages()).toBe(true);
|
||||
});
|
||||
|
||||
it('should reset context filenames to defaults when context.fileName is not configured', async () => {
|
||||
process.argv = ['node', 'script.js'];
|
||||
const argv = await parseArguments();
|
||||
const settings: Settings = {};
|
||||
const defaultContextFiles = ['QWEN.md', 'AGENTS.md'];
|
||||
const getAllSpy = vi
|
||||
.spyOn(ServerConfig, 'getAllGeminiMdFilenames')
|
||||
.mockReturnValue(defaultContextFiles);
|
||||
const setFilenameSpy = vi.spyOn(ServerConfig, 'setGeminiMdFilename');
|
||||
|
||||
await loadCliConfig(settings, argv);
|
||||
|
||||
expect(getAllSpy).toHaveBeenCalledTimes(1);
|
||||
expect(setFilenameSpy).toHaveBeenCalledWith(defaultContextFiles);
|
||||
});
|
||||
|
||||
it('should use context.fileName from settings when provided', async () => {
|
||||
process.argv = ['node', 'script.js'];
|
||||
const argv = await parseArguments();
|
||||
const settings: Settings = { context: { fileName: 'CUSTOM_CONTEXT.md' } };
|
||||
const getAllSpy = vi.spyOn(ServerConfig, 'getAllGeminiMdFilenames');
|
||||
const setFilenameSpy = vi.spyOn(ServerConfig, 'setGeminiMdFilename');
|
||||
|
||||
await loadCliConfig(settings, argv);
|
||||
|
||||
expect(setFilenameSpy).toHaveBeenCalledWith('CUSTOM_CONTEXT.md');
|
||||
expect(getAllSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should initialize native LSP service when enabled', async () => {
|
||||
process.argv = ['node', 'script.js', '--experimental-lsp'];
|
||||
const argv = await parseArguments();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue