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