Skip to content

Conversation

@ryoppippi
Copy link
Member

@ryoppippi ryoppippi commented Dec 9, 2025

Summary

Reorganises the test file structure to co-locate tests alongside their implementations and standardises the test file naming convention from .spec.ts to .test.ts. This improves discoverability and aligns with industry standards.

What Changed

Test File Relocation

  • Moved all test files from src/tests/ directory
  • Tests now sit alongside their implementations in respective directories:
    • Array and TF-IDF index tests → src/utils/
    • Base and StackOne toolset tests → src/toolsets/
    • RequestBuilder tests → src/modules/
    • Feedback tool tests → src/tools/
    • Tool, meta-tools, and json-schema tests → src/

Test File Naming

  • Renamed all .spec.ts files to .test.ts for consistency
  • Removed src/tests/ directory entirely

Configuration Updates

  • Updated vitest.config.ts to reference .test.ts patterns instead of .spec.ts
  • Simplified coverage exclude patterns
  • Updated typecheck include patterns

Documentation Updates

  • Updated Claude Code skill documentation:
    • typescript-testing skill glob patterns
    • development-workflow skill test command examples

Why

This restructuring provides several benefits:

  1. Improved Discoverability: Tests sit horizontally next to their implementations, making it easier to find and maintain related code
  2. Standardised Naming: .test.ts is the industry standard convention, improving consistency across the codebase
  3. Cleaner Structure: Removes the separate src/tests/ directory in favour of co-located testing
  4. Better Documentation: Skills and configuration now accurately reflect the new structure

Testing

  • ✅ All 262 unit tests pass
  • ✅ No type errors
  • ✅ Biome linting passes
  • ✅ All imports correctly updated for new file locations

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

    • Moved tests out of src/tests/ into relevant directories; removed src/tests/.
    • Renamed all .spec.ts files to .test.ts and fixed relative imports.
    • Updated vitest.config.ts include/exclude and typecheck patterns to use .test.ts.
    • Updated internal docs (.claude skills) with new globs and example commands.
  • Migration

    • Use *.test.ts for new tests.
    • Run specific tests with: pnpm vitest src/path/to/file.test.ts.
    • No runtime or API changes.

Written for commit 64f3c82. Summary will update automatically on new commits.

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
Copilot AI review requested due to automatic review settings December 9, 2025 16:41
@ryoppippi ryoppippi requested a review from a team as a code owner December 9, 2025 16:41
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 9, 2025

Open in StackBlitz

npm i https://pkg.pr.new/StackOneHQ/stackone-ai-node/@stackone/ai@191

commit: ae06ad8

Copy link

Copilot AI left a 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.ts to .test.ts extension
  • 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.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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

@ryoppippi
Copy link
Member Author

resolve conflicts later

Copy link
Contributor

@glebedel glebedel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ryoppippi ryoppippi merged commit 7aa4a20 into main Dec 9, 2025
7 checks passed
@ryoppippi ryoppippi deleted the refactor/test-reorganisation branch December 9, 2025 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants