diff --git a/e2e-tests/docker-utils.test.ts b/e2e-tests/docker-utils.test.ts index 85ec149..5597885 100644 --- a/e2e-tests/docker-utils.test.ts +++ b/e2e-tests/docker-utils.test.ts @@ -235,6 +235,7 @@ describe('Docker Utils E2E Tests', () => { const files = output .split('\n') .map((f) => f.trim()) + .filter((f) => f.length > 0) .sort(); expect(files).toContain('/data/root.txt'); diff --git a/e2e-tests/github-models-integration.test.ts b/e2e-tests/github-models-integration.test.ts index 953f09e..0a21b66 100644 --- a/e2e-tests/github-models-integration.test.ts +++ b/e2e-tests/github-models-integration.test.ts @@ -70,22 +70,24 @@ describe('GitHub Models Integration E2E Tests', () => { const command = `node "${CLI_PATH}" --ai-service=github-models --explicit-prompt="${prompt}" --dry-run`; try { - const { stderr } = await execAsync(command, { + const { stdout, stderr } = await execAsync(command, { env: { ...process.env, GITHUB_TOKEN: '', // Explicitly unset the token }, - timeout: 10000, + timeout: 60000, // Increased timeout since the command takes time to load plugins and scan files }); // Should show error message when no token is provided - // Note: The command may exit with code 0 or non-zero, but the error message should be in stderr - expect(stderr).toContain('GitHub Models API token not configured'); + // Note: The error message may appear in stdout (via console output) or stderr + const combinedOutput = stdout + stderr; + expect(combinedOutput).toContain('GitHub Models API token not configured'); } catch (error: unknown) { const execError = error as { code?: unknown; stdout?: string; stderr?: string }; - // If the command fails, the error message should still be in stderr - expect(execError.stderr).toContain('GitHub Models API token not configured'); + // If the command fails, the error message should be in either stdout or stderr + const combinedOutput = (execError.stdout || '') + (execError.stderr || ''); + expect(combinedOutput).toContain('GitHub Models API token not configured'); } }); }); diff --git a/src/prompt/steps/step-iterate/handlers/container-task/utils/docker-utils.ts b/src/prompt/steps/step-iterate/handlers/container-task/utils/docker-utils.ts index 649ae2b..6361eda 100644 --- a/src/prompt/steps/step-iterate/handlers/container-task/utils/docker-utils.ts +++ b/src/prompt/steps/step-iterate/handlers/container-task/utils/docker-utils.ts @@ -206,15 +206,18 @@ function addDirectoryToPack(pack: tar.Pack, directoryPath: string, relativeTo: s const items = fs.readdirSync(directoryPath); const dirStats = fs.lstatSync(directoryPath); - pack.entry( - { - name: relativeTo.endsWith('/') ? relativeTo : relativeTo + '/', - type: 'directory', - mode: dirStats.mode & 0o777, - mtime: dirStats.mtime, - }, - () => {}, - ); + // Only add directory entry if not the root (to avoid creating a '/' entry which can cause issues) + if (relativeTo !== '') { + pack.entry( + { + name: relativeTo.endsWith('/') ? relativeTo : relativeTo + '/', + type: 'directory', + mode: dirStats.mode & 0o777, + mtime: dirStats.mtime, + }, + () => {}, + ); + } for (const item of items) { const fullPath = path.join(directoryPath, item);