-
Notifications
You must be signed in to change notification settings - Fork 2
test: add tests for workspace-detector utility #59
Copy link
Copy link
Open
Labels
good first issueGood for newcomersGood for newcomerstestingTest improvements and coverageTest improvements and coverage
Description
The workspace detector utility (src/utils/workspace-detector.ts) inspects the filesystem to determine workspace type (npm, pnpm, yarn, lerna, nx, rush, gradle, maven, vscode, etc.) and enumerate child projects. This logic has no dedicated test file. Since it reads the filesystem, tests should create small temporary directory trees with the relevant marker files (package.json with workspaces, pnpm-workspace.yaml, .code-workspace, etc.) and verify detection results.
Relevant files:
src/utils/workspace-detector.ts— the module to testsrc/types.ts—WorkspaceInfo,WorkspaceTypetypestest/— place the new test file here asworkspace-detector.test.ts
Suggested test cases:
- Detects npm workspace (package.json with
workspacesfield) - Detects pnpm workspace (pnpm-workspace.yaml exists)
- Detects single repo (has .git but no workspace markers)
- Returns null or appropriate result for empty directory
- Correctly enumerates child project paths from workspace config
Acceptance criteria:
- New file
test/workspace-detector.test.tswith at least 6 tests - Tests create and clean up temporary directories
- All tests pass with
npm test
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomerstestingTest improvements and coverageTest improvements and coverage