test: add missing coverage for json parser, url utils, and generator …#679
test: add missing coverage for json parser, url utils, and generator …#679ryzrr wants to merge 1 commit intonodejs:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds missing/expanded unit tests to raise coverage for low-covered utility/parser modules, aligning with the project’s minimum coverage requirement.
Changes:
- Added
src/parsers/__tests__/json.test.mjsto coverparseTypeMap(falsy path, valid JSON, invalid JSON). - Added
src/utils/__tests__/url.test.mjsto covertoParsedURLandloadFromURLfor file paths,file:URLs, and http(s) fetch. - Expanded
src/utils/__tests__/generators.test.mjscoverage forlegacyToJSON,buildApiDocURL, andcreateLazyGenerator.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/utils/tests/url.test.mjs | New tests for URL parsing and URL/file loading behavior with fs/fetch mocking. |
| src/utils/tests/generators.test.mjs | Additional tests for generator utilities and lazy generator delegation (with dynamic import mocking). |
| src/parsers/tests/json.test.mjs | New tests for JSON type-map parsing with mocked loadFromURL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #679 +/- ##
==========================================
+ Coverage 74.37% 75.68% +1.31%
==========================================
Files 146 148 +2
Lines 13376 13556 +180
Branches 967 1009 +42
==========================================
+ Hits 9948 10260 +312
+ Misses 3422 3290 -132
Partials 6 6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
7dd752a to
841dad2
Compare
|
Rebased for Codecov to generate a report |
|
Hmm, maybe Codecov is partially down, or something. coverage report: |
|
Thanks for the rebase and running the report manually! Lemme know if there's anything else you'd like me to address. |
Description
Three modules had no or partial test coverage, below the 80% minimum the project requires.
```
src/parsers/json.mjs 0% → 100%
src/utils/generators.mjs 77% → 100%
src/utils/url.mjs 50% → 70%
```
New test files follow the existing conventions (
node:test,mock.module()for dependency isolation,import.meta.resolve()for accurate mock paths).Validation
Run
node --run test:coverageto verify. All 339 tests pass, no regressions.Related Issues
No related issue, proactive coverage fix.
Check List
node --run testand all tests passed.node --run format&node --run lint.