[jsweep] Clean missing_messages_helper.cjs#31161
Conversation
…and tests - Add `// @ts-check` to enable type checking (was the only .cjs file without it) - Existing JSDoc type annotations are sufficient; no type errors introduced - Add 5 new test cases covering noopMessages, reportIncomplete, combined fields, and state mutation scenarios; test count: 7 → 12 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
✅ Necromancer fortified this PR with fresh regression coverage. |
There was a problem hiding this comment.
Pull request overview
Enables TypeScript checking (// @ts-check) for missing_messages_helper.cjs and expands the Vitest coverage for getMissingInfoSections() to include noop and report-incomplete scenarios.
Changes:
- Added
// @ts-checktoactions/setup/js/missing_messages_helper.cjs. - Added new Vitest cases for
noopMessages,reportIncomplete, combined fields, and state updates inactions/setup/js/missing_messages_helper.test.cjs.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/missing_messages_helper.cjs | Enables @ts-check, making the file’s JSDoc types part of the effective API contract. |
| actions/setup/js/missing_messages_helper.test.cjs | Adds additional tests for noop/incomplete and repeated updates to collected missings. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
actions/setup/js/missing_messages_helper.test.cjs:172
- These
setCollectedMissingscalls use a partialmissingsshape (nonoopMessages/reportIncomplete). In production the missings object includes those arrays (possibly empty), so consider passing them here as well to better reflect real usage and guard against regressions in the formatter’s handling of empty arrays.
setCollectedMissings({ missingTools: [{ tool: "npm", reason: "Build tool" }], missingData: [] });
const first = getMissingInfoSections();
expect(first).toContain("npm");
setCollectedMissings({ missingTools: [], missingData: [] });
const second = getMissingInfoSections();
- Files reviewed: 2/2 changed files
- Comments generated: 4
| const missings = { | ||
| missingTools: [], | ||
| missingData: [], | ||
| reportIncomplete: [{ reason: "Task not finished" }], | ||
| }; |
| const result = getMissingInfoSections(); | ||
|
|
||
| expect(result).toContain("docker"); | ||
| expect(result).toContain("token"); |
| it("should handle noopMessages", () => { | ||
| const { setCollectedMissings, getMissingInfoSections } = helper; | ||
| const missings = { | ||
| missingTools: [], | ||
| missingData: [], | ||
| noopMessages: [{ message: "No action needed" }], | ||
| reportIncomplete: [], |
| @@ -1,3 +1,4 @@ | |||
| // @ts-check | |||
There was a problem hiding this comment.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · ● 3.4M
🧪 Test Quality Sentinel ReportTest Quality Score: 85/100✅ Excellent test quality
Test Classification DetailsView all 12 test classifications
Flagged Tests — Requires Review
|
|
Commit pushed:
|
|
Necromancer regression pass complete.
|
Summary
This PR enables
@ts-checkinmissing_messages_helper.cjs— the only.cjssource file inactions/setup/js/that was missing it — and expands its test suite.Changes
missing_messages_helper.cjs//@ts-check`` as the first line to enable TypeScript type checkingmissing_messages_helper.test.cjsshould handle noopMessages— verifiesnoopMessagesarray is forwarded to formattershould handle reportIncomplete messages— verifiesreportIncompletearray is forwardedshould handle all fields simultaneously— exercises all four fields at onceshould reflect updates after setCollectedMissings is called again— state mutation checkValidation
All checks passed:
npx prettier✓ (unchanged)npm run lint:cjs✓npm run typecheck✓ (0 errors after adding@ts-check)