Skip to content

test: add comprehensive unit tests for utils modules - #737

Merged
sxzz merged 3 commits into
mainfrom
sxzz/tests-audit
Jan 29, 2026
Merged

sxzz merged 3 commits into
mainfrom
sxzz/tests-audit

Conversation

@sxzz

@sxzz sxzz commented Jan 29, 2026

Copy link
Copy Markdown
Member

Summary

Added comprehensive unit tests for pure utility functions in src/utils/:

  • chunks.ts: 3 tests for chunk manipulation
  • fs.ts: 23 tests for filesystem utilities
  • general.ts: 33 tests for general utilities (removed unused debounce function)
  • logger.ts: 16 tests for logger creation and formatting
  • package.ts: 14 tests for package.json handling

Renamed tests/index.test.ts to tests/e2e.test.ts for clarity. Total 93 new tests, all passing with zero warnings.

Test Coverage

  • Edge cases and error handling
  • Type validation and format normalization
  • Filesystem operations with mocking
  • Logger lifecycle and output formatting
  • Package detection and type inference

Add unit tests for chunks, fs, general, logger, and package utilities:
- 93 new tests covering pure functions and utility modules
- Covers edge cases and error handling
- Rename tests/index.test.ts to tests/e2e.test.ts for clarity
- Remove unused debounce function from general.ts

All tests pass with zero warnings or lint errors.
@netlify

netlify Bot commented Jan 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for tsdown ready!

Name Link
🔨 Latest commit a0a46ed
🔍 Latest deploy log https://app.netlify.com/projects/tsdown/deploys/697bcbf511f3ad00080b5024
😎 Deploy Preview https://deploy-preview-737--tsdown.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Jan 29, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/tsdown@737
npm i https://pkg.pr.new/create-tsdown@737
npm i https://pkg.pr.new/tsdown-migrate@737

commit: a0a46ed

sxzz added 2 commits January 30, 2026 05:04
lowestCommonAncestor tests used hardcoded forward slashes which fail
on Windows where path.dirname returns backslash separators.
The single-path branch of lowestCommonAncestor returns path.dirname()
directly without normalizing, so the test expectation must match that
behavior rather than using path.normalize().
@sxzz
sxzz merged commit 096b051 into main Jan 29, 2026
17 checks passed
@sxzz
sxzz deleted the sxzz/tests-audit branch January 29, 2026 21:08
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