mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
fix: change .geminiignore to .qwenignore
This commit is contained in:
@@ -138,7 +138,7 @@ describe('bfsFileSearch', () => {
|
||||
});
|
||||
|
||||
it('should ignore geminiignored files', async () => {
|
||||
await createTestFile('node_modules/', 'project', '.geminiignore');
|
||||
await createTestFile('node_modules/', 'project', '.qwenignore');
|
||||
await createTestFile('content', 'project', 'node_modules', 'target.txt');
|
||||
const targetFilePath = await createTestFile(
|
||||
'content',
|
||||
|
||||
@@ -22,9 +22,9 @@ describe('crawler', () => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('should use .geminiignore rules', async () => {
|
||||
it('should use .qwenignore rules', async () => {
|
||||
tmpDir = await createTmpDir({
|
||||
'.geminiignore': 'dist/',
|
||||
'.qwenignore': 'dist/',
|
||||
dist: ['ignored.js'],
|
||||
src: ['not-ignored.js'],
|
||||
});
|
||||
@@ -48,16 +48,16 @@ describe('crawler', () => {
|
||||
expect.arrayContaining([
|
||||
'.',
|
||||
'src/',
|
||||
'.geminiignore',
|
||||
'.qwenignore',
|
||||
'src/not-ignored.js',
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
it('should combine .gitignore and .geminiignore rules', async () => {
|
||||
it('should combine .gitignore and .qwenignore rules', async () => {
|
||||
tmpDir = await createTmpDir({
|
||||
'.gitignore': 'dist/',
|
||||
'.geminiignore': 'build/',
|
||||
'.qwenignore': 'build/',
|
||||
dist: ['ignored-by-git.js'],
|
||||
build: ['ignored-by-gemini.js'],
|
||||
src: ['not-ignored.js'],
|
||||
@@ -82,7 +82,7 @@ describe('crawler', () => {
|
||||
expect.arrayContaining([
|
||||
'.',
|
||||
'src/',
|
||||
'.geminiignore',
|
||||
'.qwenignore',
|
||||
'.gitignore',
|
||||
'src/not-ignored.js',
|
||||
]),
|
||||
|
||||
@@ -17,9 +17,9 @@ describe('FileSearch', () => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('should use .geminiignore rules', async () => {
|
||||
it('should use .qwenignore rules', async () => {
|
||||
tmpDir = await createTmpDir({
|
||||
'.geminiignore': 'dist/',
|
||||
'.qwenignore': 'dist/',
|
||||
dist: ['ignored.js'],
|
||||
src: ['not-ignored.js'],
|
||||
});
|
||||
@@ -38,13 +38,13 @@ describe('FileSearch', () => {
|
||||
await fileSearch.initialize();
|
||||
const results = await fileSearch.search('');
|
||||
|
||||
expect(results).toEqual(['src/', '.geminiignore', 'src/not-ignored.js']);
|
||||
expect(results).toEqual(['src/', '.qwenignore', 'src/not-ignored.js']);
|
||||
});
|
||||
|
||||
it('should combine .gitignore and .geminiignore rules', async () => {
|
||||
it('should combine .gitignore and .qwenignore rules', async () => {
|
||||
tmpDir = await createTmpDir({
|
||||
'.gitignore': 'dist/',
|
||||
'.geminiignore': 'build/',
|
||||
'.qwenignore': 'build/',
|
||||
dist: ['ignored-by-git.js'],
|
||||
build: ['ignored-by-gemini.js'],
|
||||
src: ['not-ignored.js'],
|
||||
@@ -66,7 +66,7 @@ describe('FileSearch', () => {
|
||||
|
||||
expect(results).toEqual([
|
||||
'src/',
|
||||
'.geminiignore',
|
||||
'.qwenignore',
|
||||
'.gitignore',
|
||||
'src/not-ignored.js',
|
||||
]);
|
||||
|
||||
@@ -89,9 +89,9 @@ describe('loadIgnoreRules', () => {
|
||||
expect(fileFilter('test.txt')).toBe(false);
|
||||
});
|
||||
|
||||
it('should load rules from .geminiignore', async () => {
|
||||
it('should load rules from .qwenignore', async () => {
|
||||
tmpDir = await createTmpDir({
|
||||
'.geminiignore': '*.log',
|
||||
'.qwenignore': '*.log',
|
||||
});
|
||||
const ignore = loadIgnoreRules({
|
||||
projectRoot: tmpDir,
|
||||
@@ -104,10 +104,10 @@ describe('loadIgnoreRules', () => {
|
||||
expect(fileFilter('test.txt')).toBe(false);
|
||||
});
|
||||
|
||||
it('should combine rules from .gitignore and .geminiignore', async () => {
|
||||
it('should combine rules from .gitignore and .qwenignore', async () => {
|
||||
tmpDir = await createTmpDir({
|
||||
'.gitignore': '*.log',
|
||||
'.geminiignore': '*.txt',
|
||||
'.qwenignore': '*.txt',
|
||||
});
|
||||
const ignore = loadIgnoreRules({
|
||||
projectRoot: tmpDir,
|
||||
|
||||
@@ -28,7 +28,7 @@ export function loadIgnoreRules(options: LoadIgnoreRulesOptions): Ignore {
|
||||
}
|
||||
|
||||
if (options.useGeminiignore) {
|
||||
const geminiignorePath = path.join(options.projectRoot, '.geminiignore');
|
||||
const geminiignorePath = path.join(options.projectRoot, '.qwenignore');
|
||||
if (fs.existsSync(geminiignorePath)) {
|
||||
ignorer.add(fs.readFileSync(geminiignorePath, 'utf8'));
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ ${testRootDir}${path.sep}
|
||||
describe('with geminiignore', () => {
|
||||
it('should ignore geminiignore files by default', async () => {
|
||||
await fsPromises.writeFile(
|
||||
nodePath.join(testRootDir, '.geminiignore'),
|
||||
nodePath.join(testRootDir, '.qwenignore'),
|
||||
'ignored.txt\nnode_modules/\n.gemini/\n!/.gemini/config.yaml',
|
||||
);
|
||||
await createTestFile('file1.txt');
|
||||
@@ -315,7 +315,7 @@ ${testRootDir}${path.sep}
|
||||
|
||||
it('should not ignore files if respectGeminiIgnore is false', async () => {
|
||||
await fsPromises.writeFile(
|
||||
nodePath.join(testRootDir, '.geminiignore'),
|
||||
nodePath.join(testRootDir, '.qwenignore'),
|
||||
'ignored.txt\nnode_modules/\n.gemini/\n!/.gemini/config.yaml',
|
||||
);
|
||||
await createTestFile('file1.txt');
|
||||
|
||||
@@ -82,16 +82,16 @@ node_modules/
|
||||
|
||||
it('should handle custom patterns file name', async () => {
|
||||
// No .git directory for this test
|
||||
await createTestFile('.geminiignore', 'temp/\n*.tmp');
|
||||
await createTestFile('.qwenignore', 'temp/\n*.tmp');
|
||||
|
||||
parser.loadPatterns('.geminiignore');
|
||||
parser.loadPatterns('.qwenignore');
|
||||
expect(parser.getPatterns()).toEqual(['temp/', '*.tmp']);
|
||||
expect(parser.isIgnored(path.join('temp', 'file.txt'))).toBe(true);
|
||||
expect(parser.isIgnored(path.join('src', 'file.tmp'))).toBe(true);
|
||||
});
|
||||
|
||||
it('should initialize without errors when no .geminiignore exists', () => {
|
||||
expect(() => parser.loadPatterns('.geminiignore')).not.toThrow();
|
||||
it('should initialize without errors when no .qwenignore exists', () => {
|
||||
expect(() => parser.loadPatterns('.qwenignore')).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user