Skip to content
Draft
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions e2e-tests/docker-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
14 changes: 8 additions & 6 deletions e2e-tests/github-models-integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down