Skip to content

test: add coverage for utility modules#718

Merged
avivkeller merged 2 commits intonodejs:mainfrom
wilsonwangdev:test/utility-coverage
Mar 29, 2026
Merged

test: add coverage for utility modules#718
avivkeller merged 2 commits intonodejs:mainfrom
wilsonwangdev:test/utility-coverage

Conversation

@wilsonwangdev
Copy link
Copy Markdown
Contributor

Description

Add unit tests for 4 previously untested pure utility modules:

  • src/utils/array.mjsenforceArray() (4 tests)
  • src/utils/file.mjswithExt() (4 tests)
  • src/utils/misc.mjslazy(), isPlainObject(), deepMerge() (7 tests)
  • src/utils/configuration/templates.mjspopulate() (4 tests)

All 19 new tests follow existing conventions (node:assert/strict, describe/it, co-located __tests__/ directories).

Validation

  • All 362 tests pass (including 19 new)
  • Lint and formatting checks pass

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have check code formatting with node --run format & node --run lint.
  • I've covered new added functionality with unit tests if necessary.

@wilsonwangdev wilsonwangdev requested a review from a team as a code owner March 26, 2026 14:31
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Mar 29, 2026 9:26am

Request Review

Copy link
Copy Markdown
Member

@avivkeller avivkeller left a comment

Choose a reason for hiding this comment

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

Are you an AI agent? While your implementation is fine, I feel like I'm interacting with a robot.

@wilsonwangdev
Copy link
Copy Markdown
Contributor Author

Are you an AI agent? While your implementation is fine, I feel like I'm interacting with a robot.

I use cursor as my editor, it helps me a lot to do such work 😄

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.37%. Comparing base (7e3f5d2) to head (d6cafc6).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #718      +/-   ##
==========================================
+ Coverage   76.15%   76.37%   +0.22%     
==========================================
  Files         151      155       +4     
  Lines       13641    13766     +125     
  Branches     1066     1093      +27     
==========================================
+ Hits        10388    10514     +126     
+ Misses       3248     3247       -1     
  Partials        5        5              

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@avivkeller
Copy link
Copy Markdown
Member

@wilsonwangdev can you rebase?

Add tests for enforceArray, withExt, lazy, isPlainObject,
deepMerge, and populate — all previously untested pure
utility functions.
- Simplify enforceArray tests to two cases (array vs non-array)
- Remove redundant multiple-substitutions test for populate
@wilsonwangdev
Copy link
Copy Markdown
Contributor Author

@wilsonwangdev can you rebase?

I have rebased to the latest main. Need I squash the two commits into one too?

@avivkeller
Copy link
Copy Markdown
Member

Nope, the merge will handle that. Thanks for the rebase!

@avivkeller avivkeller merged commit d842fc4 into nodejs:main Mar 29, 2026
19 checks passed
@wilsonwangdev wilsonwangdev deleted the test/utility-coverage branch March 29, 2026 12:49
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