Skip to content

Commit 84441d6

Browse files
committed
fix(ci): create ~/.claude directory and clean up test
- Add step to create default Claude directory in CI environment - Remove try-catch block from test, making it clean and simple - Test now works consistently in both local and CI environments
1 parent 844308e commit 84441d6

2 files changed

Lines changed: 7 additions & 17 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
- run: bun install --frozen-lockfile
1717
- run: bun lint
1818
- run: bun typecheck
19+
- name: Create default Claude directory for tests
20+
run: mkdir -p $HOME/.claude
1921
- run: bun test
2022

2123
npm-publish-dry-run-and-upload-pkg-pr-now:

‎src/data-loader.test.ts‎

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,14 @@ describe('getDefaultClaudePath', () => {
6060
expect(getDefaultClaudePath()).toBe(fixture.path);
6161
});
6262

63-
test('throws error when CLAUDE_CONFIG_DIR is not set and default path does not exist', () => {
63+
test('returns default path when CLAUDE_CONFIG_DIR is not set', () => {
6464
// Ensure CLAUDE_CONFIG_DIR is not set
6565
delete process.env.CLAUDE_CONFIG_DIR;
6666

67-
// Test that it throws an error when default path doesn't exist
68-
// This test only works in environments where ~/.claude doesn't exist (like CI)
69-
// In local development, ~/.claude might exist, so we'll check both cases
70-
const homeClaudePath = join(homedir(), '.claude');
71-
72-
try {
73-
const actualPath = getDefaultClaudePath();
74-
// If we get here, the directory exists
75-
expect(actualPath).toBe(homeClaudePath);
76-
}
77-
catch (error) {
78-
// If an error is thrown, it should be about the directory not existing
79-
expect(error).toBeInstanceOf(Error);
80-
expect((error as Error).message).toContain('Claude data directory does not exist');
81-
expect((error as Error).message).toContain(homeClaudePath);
82-
}
67+
// Test that it returns the default path (which ends with .claude)
68+
const actualPath = getDefaultClaudePath();
69+
expect(actualPath).toMatch(/\.claude$/);
70+
expect(actualPath).toContain(homedir());
8371
});
8472

8573
test('returns default path with trimmed CLAUDE_CONFIG_DIR', async () => {

0 commit comments

Comments
 (0)