Fix atprocessor test on windows (#12252)

This commit is contained in:
Tommaso Sciortino
2025-10-29 14:11:39 -07:00
committed by GitHub
parent 121732dde6
commit 42a265d290
2 changed files with 5 additions and 6 deletions

View File

@@ -183,7 +183,7 @@ describe('handleAtCommand', () => {
const relativeDirPath = getRelativePath(dirPath);
const relativeFilePath = getRelativePath(filePath);
const query = `@${dirPath}`;
const resolvedGlob = `${relativeDirPath}/**`;
const resolvedGlob = path.join(relativeDirPath, '**');
const result = await handleAtCommand({
query,
@@ -1138,7 +1138,7 @@ describe('handleAtCommand', () => {
it('should handle absolute directory paths correctly', async () => {
const fileContent =
'export default function test() { return "absolute dir test"; }';
const subDirPath = 'src/utils';
const subDirPath = path.join('src', 'utils');
const fileName = 'helper.ts';
await createTestFile(
path.join(testRootDir, subDirPath, fileName),
@@ -1159,7 +1159,7 @@ describe('handleAtCommand', () => {
expect(result.shouldProceed).toBe(true);
expect(result.processedQuery).toEqual(
expect.arrayContaining([
{ text: `Check @${subDirPath}/** please.` },
{ text: `Check @${path.join(subDirPath, '**')} please.` },
expect.objectContaining({
text: '\n--- Content from referenced files ---',
}),
@@ -1167,7 +1167,7 @@ describe('handleAtCommand', () => {
);
expect(mockOnDebugMessage).toHaveBeenCalledWith(
expect.stringContaining(`using glob: ${subDirPath}/**`),
expect.stringContaining(`using glob: ${path.join(subDirPath, '**')}`),
);
});

View File

@@ -243,8 +243,7 @@ export async function handleAtCommand({
: pathName;
if (stats.isDirectory()) {
currentPathSpec =
relativePath + (relativePath.endsWith(path.sep) ? `**` : `/**`);
currentPathSpec = path.join(relativePath, '**');
onDebugMessage(
`Path ${pathName} resolved to directory, using glob: ${currentPathSpec}`,
);