Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions packages/core/src/utils/getFolderStructure.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,23 @@ ${testRootDir}${path.sep}
expect(structure).toContain('file1.txt');
});

it('should ignore files in subdirectories specified in root .gitignore', async () => {
await fsPromises.writeFile(
path.join(testRootDir, '.gitignore'),
'subfolder/ignored.txt',
);
await createTestFile('subfolder', 'ignored.txt');
await createTestFile('subfolder', 'allowed.txt');

const fileService = new FileDiscoveryService(testRootDir);
const structure = await getFolderStructure(testRootDir, {
fileService,
});

expect(structure).not.toContain('ignored.txt');
expect(structure).toContain('allowed.txt');
});

it('should not ignore files if respectGitIgnore is false', async () => {
await fsPromises.writeFile(
path.join(testRootDir, '.gitignore'),
Expand Down