Commit Graph

4 Commits

Author SHA1 Message Date
Kazuki Yamada 7ff8c8b155 test: Address PR review feedback (RepomixError instances + mock isolation)
- outputGenerate: tests titled "throws RepomixError…" / "wraps … in
  RepomixError" now assert the rejection is an instance of RepomixError
  in addition to the message regex, matching the test names.
- LanguageParser: collapse the duplicate getParserForLang('javascript')
  rejection assertions into a single .catch capture that checks both
  type and message.
- calculateMetrics: vi.mocked(initTaskRunner).mockReset() before
  mockReturnValueOnce so a future test that omits taskRunner can't
  silently consume the override.
- packager: pre-attach a no-op .catch on the rejected warmupPromise so
  vitest's unhandled-rejection detection doesn't fire before pack
  awaits it. Production code mirrors this pattern in packager.ts:262.
2026-04-26 22:29:06 +09:00
Kazuki Yamada cbdfc29b4d test: Cover error/edge paths in core (output, file, security, treeSitter)
Lift the four most impactful uncovered files past 90% lines without
introducing fragile or contrived tests. Each block targets real
user-facing branches (error handling, optional features, init/dispose).

- core/output/outputGenerate (78% -> ~90%):
  - buildOutputGeneratorContext: instructionFilePath success and missing-file
    paths; pre-computed vs. searchFiles fallback for empty directories;
    full-tree mode (success and listing failure); searchFiles failure wrap.
  - generateOutput: unsupported style throws RepomixError.

- core/security/validateFileSafety (79% -> ~95%):
  - logSuspiciousContentWarning loop: header line per section, plus
    singular ("issue") and plural ("issues") suffix per result.
  - No-op behavior when no suspicious git diff/log entries exist.

- core/file/fileSearch (88% -> ~92%):
  - handleGlobbyError: EPERM and EACCES translated to PermissionError;
    other error codes pass through.
  - Outer catch: generic Error wrapped with directory context;
    non-Error throw produces the generic fallback message.

- core/treeSitter/languageParser (74% -> ~88%):
  - getResources before init() throws RepomixError.
  - init() is idempotent (Parser.init is called only once across two calls).
  - Parser.init() failure is wrapped as RepomixError.
  - dispose() resets state so subsequent calls require re-init.

Coverage:
- Statements 89.51% -> 90.23%
- Branches   79.31% -> 80.26%
- Functions  89.37% -> 89.69%
- Lines      90.06% -> 90.80%
2026-04-26 19:35:00 +09:00
Kazuki Yamada 1fe2a942eb feat(compress): Compress now supports solidity 2025-03-27 00:39:30 +09:00
yamadashy d2f3820574 feat(compress): Add comments and import statements to compress. Also improve to include all type definitions such as interfaces in some languages 2025-03-02 00:32:47 +09:00