refactor: reorganise test files and standardise naming convention#191
Merged
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: |
Contributor
There was a problem hiding this comment.
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.
Contributor
Author
|
resolve conflicts later |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.