-
Notifications
You must be signed in to change notification settings - Fork 3
refactor: reorganise test files and standardise naming convention #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Move all test files from src/tests/ to respective implementation directories: - Array, TF-IDF index tests to src/utils/ - Base, StackOne toolset tests to src/toolsets/ - RequestBuilder tests to src/modules/ - Feedback tool tests to src/tools/ - Tool, meta-tools, json-schema tests to src/ - RPC client test remains in src/ Update all relative imports to reflect new file locations. This makes the test file sit horizontally next to its implementation, improving discoverability and maintainability. All tests pass and types are correct.
Rename all test files from .spec.ts to .test.ts convention for consistency with industry standards. Test files now use a uniform naming scheme across the entire project.
Update vitest.config.ts to reference .test.ts files instead of .spec.ts: - Change include patterns from *.spec.ts to *.test.ts - Simplify coverage exclude patterns by removing deprecated patterns - Update typecheck include patterns to match new naming convention - Fix outdated path reference in exclude list
Update Claude Code skill documentation to reflect the new .test.ts naming convention for test files: - Update typescript-testing skill globs from *.spec.ts to *.test.ts - Update example commands to use .test.ts file paths - Remove outdated pnpm test:unit command reference - Update development-workflow skill with new naming convention
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR successfully refactors the test file structure by relocating test files from a centralized src/tests/ directory to sit alongside their respective implementations, and standardizes the test file naming convention from .spec.ts to .test.ts.
Key changes:
- Co-located all test files with their implementations across utils, toolsets, modules, tools, and root src directories
- Renamed all test files from
.spec.tsto.test.tsextension - Updated vitest configuration to reflect new patterns and simplified exclude rules
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.ts | Updated test include patterns from **/*.spec.ts to **/*.test.ts, simplified coverage exclusions, and updated excluded file path to reflect new test location |
| src/utils/tfidf-index.test.ts | Updated import path from ../utils/tfidf-index to ./tfidf-index to reflect co-location |
| src/utils/array.test.ts | Updated import path from ../utils/array to ./array to reflect co-location |
| src/toolsets/stackone.test.ts | Updated import paths from parent directory references to relative local imports |
| src/toolsets/stackone.mcp-fetch.test.ts | Updated import paths from parent directory references to relative local imports |
| src/toolsets/base.test.ts | Updated import path from ../toolsets/base to ./base to reflect co-location |
| src/tools/feedback.test.ts | Updated import path from ../tools/feedback to ./feedback to reflect co-location |
| src/tool.test.ts | Updated import paths to use current directory references instead of parent directory |
| src/tool.test-d.ts | Updated import paths to use current directory references instead of parent directory |
| src/tool.meta-tools.test.ts | Updated import paths to use current directory references instead of parent directory |
| src/tool.json-schema.test.ts | Updated import path to use current directory reference instead of parent directory |
| src/rpc-client.test.ts | New test file added with correct import paths for co-located structure |
| src/modules/requestBuilder.test.ts | Updated import path from ../modules/requestBuilder to ./requestBuilder to reflect co-location |
| src/index.test.ts | Updated import path from ../index to ./index to reflect co-location |
| .claude/skills/typescript-testing/SKILL.md | Updated glob pattern from *.spec.ts to *.test.ts and example commands to reflect new convention |
| .claude/skills/development-workflow/SKILL.md | Updated test command examples to reference .test.ts files and removed pnpm test:unit reference |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 16 files
|
resolve conflicts later |
glebedel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
Reorganises the test file structure to co-locate tests alongside their implementations and standardises the test file naming convention from
.spec.tsto.test.ts. This improves discoverability and aligns with industry standards.What Changed
Test File Relocation
src/tests/directorysrc/utils/src/toolsets/src/modules/src/tools/src/Test File Naming
.spec.tsfiles to.test.tsfor consistencysrc/tests/directory entirelyConfiguration Updates
vitest.config.tsto reference.test.tspatterns instead of.spec.tsDocumentation Updates
typescript-testingskill glob patternsdevelopment-workflowskill test command examplesWhy
This restructuring provides several benefits:
.test.tsis the industry standard convention, improving consistency across the codebasesrc/tests/directory in favour of co-located testingTesting
Summary by cubic
Co-located all tests next to their implementations and standardized test file naming from .spec.ts to .test.ts. Updated Vitest config and internal docs to match the new structure.
Refactors
Migration
Written for commit 64f3c82. Summary will update automatically on new commits.