Skip to content

refactor(code): reorganize test structure to test/ directory#21

Merged
amondnet merged 2 commits into
mainfrom
refactor/code-package-tests
Dec 18, 2025
Merged

refactor(code): reorganize test structure to test/ directory#21
amondnet merged 2 commits into
mainfrom
refactor/code-package-tests

Conversation

@amondnet

Copy link
Copy Markdown
Contributor

Summary

Reorganized test structure for packages/code to follow better organization patterns with dedicated test directories.

  • Moved all tests from src/__tests__/ to test/ directory
  • Created new test structure: test/unit/ and test/integration/
  • Extracted parseArgs to src/utils/args.ts with bug fix for flag value parsing
  • Extracted platform detection to src/utils/platform.ts
  • Fixed CLI -v/--version and -h/--help flag handling
  • Updated package.json test script to bun test ./test
  • All 87 tests passing with new structure

Test plan

  • All 87 unit tests passing
  • All integration tests passing
  • CLI version command works with both version command and -v/--version flags
  • CLI help command works with both help command and -h/--help flags
  • Format command works in both direct and stdin hook modes
  • LSP command works in both direct and stdin hook modes
  • Argument parsing handles edge cases correctly
  • Platform detection works across environments

- Moved all tests from src/__tests__/ to test/unit/ and test/integration/
- Created new utils package with extracted utilities:
  - parseArgs function with bug fix for flag value parsing
  - Platform detection utilities
- Fixed CLI -v/--version and -h/--help flag handling
- Updated package.json test script to bun test ./test
- Reorganized test structure: unit tests in test/unit/, integration tests in test/integration/
- All 87 tests passing with new structure
@amondnet amondnet self-assigned this Dec 18, 2025
@codecov

codecov Bot commented Dec 18, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.68%. Comparing base (cb7f71a) to head (6ad3868).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/code/src/utils/platform.ts 76.47% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #21      +/-   ##
==========================================
+ Coverage   29.72%   34.68%   +4.96%     
==========================================
  Files           4       13       +9     
  Lines        1904     2606     +702     
==========================================
+ Hits          566      904     +338     
- Misses       1338     1702     +364     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Document fallback behavior in platform detection with better comments
- Preserve JSON parse error context in cli.ts for better debugging
- Add tests for flag precedence over commands (--version, --help)
- Add tests for environment variable priority (CODE_PROJECT_PATH)
@amondnet
amondnet merged commit b2979fa into main Dec 18, 2025
9 checks passed
@amondnet
amondnet deleted the refactor/code-package-tests branch December 18, 2025 09:54
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.

1 participant