gitforest 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/package.json +24 -4
- package/src/github/auth.ts +3 -3
- package/src/utils/debug.ts +4 -4
- package/.bunignore +0 -7
- package/.github/workflows/ci.yml +0 -73
- package/CLAUDE.md +0 -111
- package/CONTRIBUTING.md +0 -145
- package/bun.lock +0 -267
- package/bunfig.toml +0 -15
- package/cli +0 -0
- package/docs/ai/IMPROVEMENT_PLAN.md +0 -341
- package/docs/ai/VERIFICATION_REPORT.md +0 -87
- package/docs/ai/architecture.md +0 -169
- package/docs/ai/checks/check-2025-12-02-tests.md +0 -40
- package/docs/ai/checks/check-2025-12-02.md +0 -55
- package/docs/ai/checks/test-verification-report.md +0 -85
- package/docs/ai/implementation-guide.md +0 -776
- package/docs/ai/research/gitty-codebase-analysis.md +0 -221
- package/docs/ai/tickets/GENERAL-sitrep.md +0 -30
- package/docs/ai/tickets/TASK-database-tests-sitrep.md +0 -25
- package/docs/ai/tickets/TASK-deprecated-functions-sitrep.md +0 -28
- package/docs/ai/tickets/TASK-detail-modal-sitrep.md +0 -28
- package/docs/ai/tickets/TASK-filter-overlay-sitrep.md +0 -24
- package/docs/ai/tickets/TASK-github-service-sitrep.md +0 -32
- package/docs/ai/tickets/TASK-github-token-sitrep.md +0 -51
- package/docs/ai/tickets/TASK-hascommits-sitrep.md +0 -35
- package/docs/ai/tickets/TASK-keybindings-sitrep.md +0 -26
- package/docs/ai/tickets/TASK-layout-sitrep.md +0 -25
- package/docs/ai/tickets/TASK-markdown-sitrep.md +0 -28
- package/docs/ai/tickets/TASK-project-item-sitrep.md +0 -79
- package/docs/ai/tickets/TASK-sitrep.md +0 -28
- package/docs/ai/tickets/TASK-state-sitrep.md +0 -26
- package/docs/ai/tickets/TASK-types-sitrep.md +0 -25
- package/docs/ai/tickets/TASK-unified-item-fix-sitrep.md +0 -26
- package/docs/ai/tickets/TKT-001-sitrep.md +0 -24
- package/docs/ai/tickets/TKT-002-sitrep.md +0 -25
- package/docs/ai/tickets/TKT-003-git-service-refactoring-complete.md +0 -46
- package/docs/ai/tickets/TKT-003-git-service-refactoring-plan.md +0 -135
- package/docs/ai/tickets/TKT-003-sitrep.md +0 -26
- package/docs/ai/tickets/TKT-004-sitrep.md +0 -27
- package/docs/ai/tickets/TKT-005-sitrep.md +0 -25
- package/docs/ai/tickets/TKT-006-sitrep.md +0 -26
- package/docs/ai/tickets/TKT-007-sitrep.md +0 -30
- package/docs/ai/tickets/TKT-008-sitrep.md +0 -32
- package/docs/ai/tickets/TKT-009-sitrep.md +0 -27
- package/docs/ai/tickets/TKT-010-sitrep.md +0 -27
- package/docs/ai/tickets/TKT-011-sitrep.md +0 -26
- package/docs/ai/tickets/TKT-012-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-actions-sitrep.md +0 -28
- package/docs/ai/tickets/sitreps/TASK-actions-test-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-app-integration-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-background-fetch-sitrep.md +0 -24
- package/docs/ai/tickets/sitreps/TASK-background-fetch-test-sitrep.md +0 -29
- package/docs/ai/tickets/sitreps/TASK-batch-tests-sitrep.md +0 -29
- package/docs/ai/tickets/sitreps/TASK-bun-test-sitrep.md +0 -26
- package/docs/ai/tickets/sitreps/TASK-cache-tests-sitrep.md +0 -30
- package/docs/ai/tickets/sitreps/TASK-cli-tests-sitrep.md +0 -28
- package/docs/ai/tickets/sitreps/TASK-clone-error-handling-sitrep.md +0 -26
- package/docs/ai/tickets/sitreps/TASK-commands-tests-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-component-tests-1-sitrep.md +0 -30
- package/docs/ai/tickets/sitreps/TASK-configloader-tests-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-confirm-dialog-test-sitrep.md +0 -29
- package/docs/ai/tickets/sitreps/TASK-coverage-sitrep.md +0 -95
- package/docs/ai/tickets/sitreps/TASK-database-tests-summary.md +0 -61
- package/docs/ai/tickets/sitreps/TASK-error-boundary-sitrep.md +0 -30
- package/docs/ai/tickets/sitreps/TASK-error-tests-sitrep.md +0 -27
- package/docs/ai/tickets/sitreps/TASK-errors-tests-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-extract-reducer-sitrep.md +0 -27
- package/docs/ai/tickets/sitreps/TASK-filter-overlay-test-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-final-verification-sitrep.md +0 -28
- package/docs/ai/tickets/sitreps/TASK-fix-all-tests-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-fix-hooks-sitrep.md +0 -26
- package/docs/ai/tickets/sitreps/TASK-fix-remaining-tests-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-fix-test-failures-sitrep.md +0 -26
- package/docs/ai/tickets/sitreps/TASK-fix-tests-sitrep.md +0 -24
- package/docs/ai/tickets/sitreps/TASK-formatters-tests-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-git-timeouts-sitrep.md +0 -29
- package/docs/ai/tickets/sitreps/TASK-github-cache-test-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-githubcli-tests-sitrep.md +0 -24
- package/docs/ai/tickets/sitreps/TASK-gitstatus-tests-sitrep.md +0 -24
- package/docs/ai/tickets/sitreps/TASK-hooks-isolation-sitrep.md +0 -27
- package/docs/ai/tickets/sitreps/TASK-keybindings-tests-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-layout-tests-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-mock-factories-sitrep.md +0 -27
- package/docs/ai/tickets/sitreps/TASK-modal-tests-sitrep.md +0 -32
- package/docs/ai/tickets/sitreps/TASK-processbatch-fix-sitrep.md +0 -27
- package/docs/ai/tickets/sitreps/TASK-projectlist-tests-sitrep.md +0 -30
- package/docs/ai/tickets/sitreps/TASK-projectutils-tests-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-scanner-tests-sitrep.md +0 -29
- package/docs/ai/tickets/sitreps/TASK-select-all-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-shell-error-handling-sitrep.md +0 -27
- package/docs/ai/tickets/sitreps/TASK-store-tests-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-test-fixes-sitrep.md +0 -26
- package/docs/ai/tickets/sitreps/TASK-test-summary-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-test-verification-sitrep.md +0 -27
- package/docs/ai/tickets/sitreps/TASK-testsuite-sitrep.md +0 -75
- package/docs/ai/tickets/sitreps/TASK-unified-reducer-tests-sitrep.md +0 -29
- package/docs/ai/tickets/sitreps/TASK-unified-repos-test-sitrep.md +0 -29
- package/docs/ai/tickets/sitreps/TASK-unified-tests-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-useprojects-tests-sitrep.md +0 -25
- package/docs/ai/tickets/sitreps/TASK-utility-tests-sitrep.md +0 -32
- package/docs/ai/tickets/sitreps/TKT-003-git-service-refactoring-sitrep.md +0 -64
- package/docs/ai/tkt-001-fix-database-error.md +0 -217
- package/docs/ai/ui-enhancement-plan.md +0 -562
- package/test/integration/app.isolated.tsx +0 -240
- package/test/integration/cli-commands.test.ts +0 -287
- package/test/integration/cli-validation.test.ts +0 -264
- package/test/integration/git-operations.test.ts +0 -218
- package/test/integration/scanner.test.ts +0 -228
- package/test/preload.ts +0 -18
- package/test/unit/cli/commands.test.ts +0 -13
- package/test/unit/cli/formatters.test.ts +0 -1116
- package/test/unit/cli/github-commands.test.ts +0 -12
- package/test/unit/components/CloneDialog.test.tsx +0 -240
- package/test/unit/components/ColumnHeader.test.tsx +0 -128
- package/test/unit/components/CommandPalette.test.tsx +0 -355
- package/test/unit/components/ConfirmDialog.test.tsx +0 -111
- package/test/unit/components/ErrorBoundary.test.tsx +0 -139
- package/test/unit/components/FilterBar.test.tsx +0 -43
- package/test/unit/components/FilterOptionsOverlay.test.tsx +0 -197
- package/test/unit/components/HelpOverlay.test.tsx +0 -90
- package/test/unit/components/Layout.test.tsx +0 -328
- package/test/unit/components/MarkdownRenderer.test.tsx +0 -45
- package/test/unit/components/ProgressBar.test.tsx +0 -138
- package/test/unit/components/ProjectItem.test.tsx +0 -182
- package/test/unit/components/ProjectList.test.tsx +0 -311
- package/test/unit/components/RepoDetailModal.test.tsx +0 -445
- package/test/unit/components/StatusBar.test.tsx +0 -112
- package/test/unit/components/UnifiedProjectItem.test.tsx +0 -618
- package/test/unit/components/ViewModeIndicator.test.tsx +0 -137
- package/test/unit/components/test-utils.tsx +0 -63
- package/test/unit/config/loader.test.ts +0 -692
- package/test/unit/db/database.test.ts +0 -978
- package/test/unit/db/index.test.ts +0 -314
- package/test/unit/fixtures/setup.ts +0 -186
- package/test/unit/git/commands-untested.test.ts +0 -205
- package/test/unit/git/commands.test.ts +0 -269
- package/test/unit/git/operations.test.ts +0 -322
- package/test/unit/git/status.test.ts +0 -219
- package/test/unit/github/auth.test.ts +0 -317
- package/test/unit/github/cache.test.ts +0 -1028
- package/test/unit/github/cli.test.ts +0 -135
- package/test/unit/github/unified.test.ts +0 -1201
- package/test/unit/graceful-shutdown.test.ts +0 -83
- package/test/unit/hooks/useBackgroundFetch.test.tsx +0 -239
- package/test/unit/hooks/useConfirmDialogActions.test.tsx +0 -81
- package/test/unit/hooks/useKeyBindings.isolated.ts +0 -715
- package/test/unit/hooks/useProjects.test.tsx +0 -186
- package/test/unit/hooks/useUnifiedRepos-simple.test.tsx +0 -115
- package/test/unit/hooks/useUnifiedRepos.test.tsx +0 -177
- package/test/unit/mocks/config.ts +0 -109
- package/test/unit/mocks/git-service.ts +0 -274
- package/test/unit/mocks/github-service.ts +0 -250
- package/test/unit/mocks/index.ts +0 -72
- package/test/unit/mocks/project.ts +0 -148
- package/test/unit/mocks/state-mocks.ts +0 -187
- package/test/unit/mocks/unified.ts +0 -169
- package/test/unit/operations/batch.test.ts +0 -216
- package/test/unit/operations/commands.test.ts +0 -550
- package/test/unit/scanner/errors.test.ts +0 -297
- package/test/unit/scanner/index.test.ts +0 -1011
- package/test/unit/scanner/markers.test.ts +0 -150
- package/test/unit/scanner/submodules.test.ts +0 -99
- package/test/unit/services/git-errors.test.ts +0 -190
- package/test/unit/services/git.test.ts +0 -442
- package/test/unit/services/github-errors.test.ts +0 -293
- package/test/unit/services/github.test.ts +0 -200
- package/test/unit/state/actions.test.ts +0 -217
- package/test/unit/state/reducer.test.ts +0 -745
- package/test/unit/state/store.test.tsx +0 -711
- package/test/unit/types/commands.test.ts +0 -220
- package/test/unit/types/schema.test.ts +0 -179
- package/test/unit/utils/array.test.ts +0 -73
- package/test/unit/utils/debug.test.ts +0 -23
- package/test/unit/utils/errors.test.ts +0 -295
- package/test/unit/utils/markdown.test.ts +0 -163
- package/test/unit/utils/project-utils.test.ts +0 -756
- package/test/unit/utils/rate-limiter.test.ts +0 -256
- package/test/unit/utils/retry.test.ts +0 -165
- package/test/unit/utils/strip-ansi.ts +0 -13
- package/test/unit/utils/timeout.test.ts +0 -93
- package/tsconfig.json +0 -29
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration tests for the scanner module
|
|
3
|
-
* Tests the full scanning workflow with real git repos
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { describe, test, expect, beforeEach, afterEach } from "bun:test";
|
|
7
|
-
import { scanAllDirectories } from "../../src/scanner/index.ts";
|
|
8
|
-
import {
|
|
9
|
-
createTempDir,
|
|
10
|
-
cleanupTempDir,
|
|
11
|
-
createMockGitRepo,
|
|
12
|
-
createMockProject,
|
|
13
|
-
createMockRepoWithSubmodule,
|
|
14
|
-
} from "../unit/fixtures/setup.ts";
|
|
15
|
-
import type { GitforestConfig } from "../../src/types/index.ts";
|
|
16
|
-
|
|
17
|
-
describe("Scanner Integration", () => {
|
|
18
|
-
let tempDir: string;
|
|
19
|
-
|
|
20
|
-
const createTestConfig = (directories: { path: string; maxDepth: number }[]): GitforestConfig => ({
|
|
21
|
-
directories,
|
|
22
|
-
scan: {
|
|
23
|
-
concurrency: 5,
|
|
24
|
-
ignore: ["node_modules", ".git", "vendor", "target"],
|
|
25
|
-
includeHidden: false,
|
|
26
|
-
},
|
|
27
|
-
display: {
|
|
28
|
-
showSubmodules: true,
|
|
29
|
-
showNonGitProjects: true,
|
|
30
|
-
sortBy: "status",
|
|
31
|
-
sortDirection: "desc",
|
|
32
|
-
},
|
|
33
|
-
github: {
|
|
34
|
-
defaultVisibility: "private",
|
|
35
|
-
},
|
|
36
|
-
cache: {
|
|
37
|
-
ttlSeconds: 300,
|
|
38
|
-
githubTtlSeconds: 600,
|
|
39
|
-
enableBackgroundRefresh: true,
|
|
40
|
-
backgroundRefreshIntervalSeconds: 300,
|
|
41
|
-
},
|
|
42
|
-
commands: [],
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
beforeEach(() => {
|
|
46
|
-
tempDir = createTempDir("scanner-integration");
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
afterEach(() => {
|
|
50
|
-
cleanupTempDir(tempDir);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
describe("scanning git repositories", () => {
|
|
54
|
-
test("finds single git repository", async () => {
|
|
55
|
-
await createMockGitRepo(tempDir, "my-repo");
|
|
56
|
-
|
|
57
|
-
const config = createTestConfig([{ path: tempDir, maxDepth: 2 }]);
|
|
58
|
-
const projects = await scanAllDirectories(config);
|
|
59
|
-
|
|
60
|
-
expect(projects).toHaveLength(1);
|
|
61
|
-
expect(projects[0]!.name).toBe("my-repo");
|
|
62
|
-
expect(projects[0]!.type).toBe("git");
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test("finds multiple git repositories", async () => {
|
|
66
|
-
await createMockGitRepo(tempDir, "repo-1");
|
|
67
|
-
await createMockGitRepo(tempDir, "repo-2");
|
|
68
|
-
await createMockGitRepo(tempDir, "repo-3");
|
|
69
|
-
|
|
70
|
-
const config = createTestConfig([{ path: tempDir, maxDepth: 2 }]);
|
|
71
|
-
const projects = await scanAllDirectories(config);
|
|
72
|
-
|
|
73
|
-
expect(projects).toHaveLength(3);
|
|
74
|
-
const names = projects.map((p) => p.name).sort();
|
|
75
|
-
expect(names).toEqual(["repo-1", "repo-2", "repo-3"]);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test("detects dirty repositories", async () => {
|
|
79
|
-
await createMockGitRepo(tempDir, "dirty-repo", { withChanges: true });
|
|
80
|
-
|
|
81
|
-
const config = createTestConfig([{ path: tempDir, maxDepth: 2 }]);
|
|
82
|
-
const projects = await scanAllDirectories(config);
|
|
83
|
-
|
|
84
|
-
expect(projects).toHaveLength(1);
|
|
85
|
-
expect(projects[0]!.status?.isDirty).toBe(true);
|
|
86
|
-
expect(projects[0]!.status?.hasUnstagedChanges).toBe(true);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
test("detects untracked files", async () => {
|
|
90
|
-
await createMockGitRepo(tempDir, "untracked-repo", { withUntracked: true });
|
|
91
|
-
|
|
92
|
-
const config = createTestConfig([{ path: tempDir, maxDepth: 2 }]);
|
|
93
|
-
const projects = await scanAllDirectories(config);
|
|
94
|
-
|
|
95
|
-
expect(projects).toHaveLength(1);
|
|
96
|
-
expect(projects[0]!.status?.hasUntrackedFiles).toBe(true);
|
|
97
|
-
expect(projects[0]!.status?.untrackedCount).toBeGreaterThan(0);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
test("detects staged changes", async () => {
|
|
101
|
-
await createMockGitRepo(tempDir, "staged-repo", { withStaged: true });
|
|
102
|
-
|
|
103
|
-
const config = createTestConfig([{ path: tempDir, maxDepth: 2 }]);
|
|
104
|
-
const projects = await scanAllDirectories(config);
|
|
105
|
-
|
|
106
|
-
expect(projects).toHaveLength(1);
|
|
107
|
-
expect(projects[0]!.status?.hasStagedChanges).toBe(true);
|
|
108
|
-
expect(projects[0]!.status?.stagedCount).toBeGreaterThan(0);
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
describe("scanning non-git projects", () => {
|
|
113
|
-
test("finds npm project without git", () => {
|
|
114
|
-
createMockProject(tempDir, "npm-project", "package.json");
|
|
115
|
-
|
|
116
|
-
const config = createTestConfig([{ path: tempDir, maxDepth: 2 }]);
|
|
117
|
-
|
|
118
|
-
return scanAllDirectories(config).then((projects) => {
|
|
119
|
-
expect(projects).toHaveLength(1);
|
|
120
|
-
expect(projects[0]!.name).toBe("npm-project");
|
|
121
|
-
expect(projects[0]!.type).toBe("non-git");
|
|
122
|
-
expect(projects[0]!.projectMarker).toBe("package.json");
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
test("finds multiple project types", () => {
|
|
127
|
-
createMockProject(tempDir, "rust-project", "Cargo.toml");
|
|
128
|
-
createMockProject(tempDir, "python-project", "pyproject.toml");
|
|
129
|
-
createMockProject(tempDir, "go-project", "go.mod");
|
|
130
|
-
|
|
131
|
-
const config = createTestConfig([{ path: tempDir, maxDepth: 2 }]);
|
|
132
|
-
|
|
133
|
-
return scanAllDirectories(config).then((projects) => {
|
|
134
|
-
expect(projects).toHaveLength(3);
|
|
135
|
-
const markers = projects.map((p) => p.projectMarker).sort();
|
|
136
|
-
expect(markers).toEqual(["Cargo.toml", "go.mod", "pyproject.toml"]);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
describe("scanning submodules", () => {
|
|
142
|
-
test("finds submodules when enabled", async () => {
|
|
143
|
-
const { parentPath, submodulePath } = await createMockRepoWithSubmodule(
|
|
144
|
-
tempDir,
|
|
145
|
-
"parent-repo",
|
|
146
|
-
"child-submodule"
|
|
147
|
-
);
|
|
148
|
-
|
|
149
|
-
const config = createTestConfig([{ path: tempDir, maxDepth: 3 }]);
|
|
150
|
-
config.display.showSubmodules = true;
|
|
151
|
-
|
|
152
|
-
const projects = await scanAllDirectories(config);
|
|
153
|
-
|
|
154
|
-
// Should find both parent and submodule (plus the source repo)
|
|
155
|
-
const submoduleProject = projects.find((p) => p.type === "git-submodule");
|
|
156
|
-
expect(submoduleProject).toBeDefined();
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
describe("scanning with depth limits", () => {
|
|
161
|
-
test("respects max depth setting", async () => {
|
|
162
|
-
// Create nested structure: tempDir/level1/level2/level3/repo
|
|
163
|
-
const level1 = `${tempDir}/level1`;
|
|
164
|
-
const level2 = `${level1}/level2`;
|
|
165
|
-
const level3 = `${level2}/level3`;
|
|
166
|
-
|
|
167
|
-
await Bun.$`mkdir -p ${level3}`.quiet();
|
|
168
|
-
await createMockGitRepo(level3, "deep-repo");
|
|
169
|
-
|
|
170
|
-
// With maxDepth=2, should not find the repo at level 4
|
|
171
|
-
const config = createTestConfig([{ path: tempDir, maxDepth: 2 }]);
|
|
172
|
-
const projects = await scanAllDirectories(config);
|
|
173
|
-
|
|
174
|
-
expect(projects).toHaveLength(0);
|
|
175
|
-
|
|
176
|
-
// With maxDepth=4, should find it
|
|
177
|
-
const deepConfig = createTestConfig([{ path: tempDir, maxDepth: 4 }]);
|
|
178
|
-
const deepProjects = await scanAllDirectories(deepConfig);
|
|
179
|
-
|
|
180
|
-
expect(deepProjects).toHaveLength(1);
|
|
181
|
-
expect(deepProjects[0]!.name).toBe("deep-repo");
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
describe("scanning multiple directories", () => {
|
|
186
|
-
test("scans multiple configured directories", async () => {
|
|
187
|
-
const dir1 = createTempDir("scanner-multi-1");
|
|
188
|
-
const dir2 = createTempDir("scanner-multi-2");
|
|
189
|
-
|
|
190
|
-
try {
|
|
191
|
-
await createMockGitRepo(dir1, "repo-in-dir1");
|
|
192
|
-
await createMockGitRepo(dir2, "repo-in-dir2");
|
|
193
|
-
|
|
194
|
-
const config = createTestConfig([
|
|
195
|
-
{ path: dir1, maxDepth: 2 },
|
|
196
|
-
{ path: dir2, maxDepth: 2 },
|
|
197
|
-
]);
|
|
198
|
-
|
|
199
|
-
const projects = await scanAllDirectories(config);
|
|
200
|
-
|
|
201
|
-
expect(projects).toHaveLength(2);
|
|
202
|
-
const names = projects.map((p) => p.name).sort();
|
|
203
|
-
expect(names).toEqual(["repo-in-dir1", "repo-in-dir2"]);
|
|
204
|
-
} finally {
|
|
205
|
-
cleanupTempDir(dir1);
|
|
206
|
-
cleanupTempDir(dir2);
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
describe("progress callback", () => {
|
|
212
|
-
test("calls progress callback during scan", async () => {
|
|
213
|
-
await createMockGitRepo(tempDir, "repo-1");
|
|
214
|
-
await createMockGitRepo(tempDir, "repo-2");
|
|
215
|
-
|
|
216
|
-
const config = createTestConfig([{ path: tempDir, maxDepth: 2 }]);
|
|
217
|
-
const progressCalls: [number, number][] = [];
|
|
218
|
-
|
|
219
|
-
await scanAllDirectories(config, {
|
|
220
|
-
onProgress: (scanned, found) => {
|
|
221
|
-
progressCalls.push([scanned, found]);
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
expect(progressCalls.length).toBeGreaterThan(0);
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
});
|
package/test/preload.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test preload script - runs before each test file
|
|
3
|
-
* Clears any module mocks from previous test files
|
|
4
|
-
*
|
|
5
|
-
* IMPORTANT: When running all tests together with `bun test`, module mocks
|
|
6
|
-
* from one file can interfere with other files due to module caching.
|
|
7
|
-
* Use `bun run test` (which runs ./run-all-tests.sh) for reliable test isolation.
|
|
8
|
-
*/
|
|
9
|
-
import { mock } from "bun:test";
|
|
10
|
-
|
|
11
|
-
// Disable ANSI colors for consistent test output across environments
|
|
12
|
-
// This ensures ink-testing-library produces the same output regardless of terminal
|
|
13
|
-
process.env.NO_COLOR = '1';
|
|
14
|
-
process.env.FORCE_COLOR = '0';
|
|
15
|
-
|
|
16
|
-
// Restore all mocks before each test file loads
|
|
17
|
-
// This attempts to clear mocks but may not fully work due to module caching
|
|
18
|
-
mock.restore();
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect } from "bun:test";
|
|
2
|
-
import { createMockConfig } from "../mocks/config.ts";
|
|
3
|
-
import type { GitforestConfig } from "../../../src/types/index.ts";
|
|
4
|
-
|
|
5
|
-
describe("CLI Commands", () => {
|
|
6
|
-
describe("listProjects", () => {
|
|
7
|
-
test("placeholder test", () => {
|
|
8
|
-
const config = createMockConfig();
|
|
9
|
-
expect(config).toBeDefined();
|
|
10
|
-
expect(config.directories).toHaveLength(1);
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
});
|