fix: add missing debug mock to test files for core.debug calls in sanitize_content_core#28824
fix: add missing debug mock to test files for core.debug calls in sanitize_content_core#28824
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/ebd3eb9a-952b-4fb7-82fc-85a8b1cd87c7 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/ebd3eb9a-952b-4fb7-82fc-85a8b1cd87c7 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| // Extract domain for http/ftp/file/ssh/git protocols | ||
| if (domain) { | ||
| const domainLower = domain.toLowerCase(); | ||
| const sanitized = sanitizeDomainName(domainLower); |
There was a problem hiding this comment.
Done in 1c0bac3 — reverted sanitize_content_core.cjs to its original state and fixed the failures by adding debug: vi.fn() / debug: () => {} to the mockCore objects in the three affected test files (add_comment.test.cjs, add_workflow_run_comment.test.cjs, create_discussion_sanitization.test.cjs).
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…nstead Agent-Logs-Url: https://github.com/github/gh-aw/sessions/6d45730d-3a22-4d5b-b159-1d722c5c3272 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Fixes Vitest failures caused by newly added core.debug() calls in sanitize_content_core.cjs by adding debug to several @actions/core mocks; also updates pinned ruby/setup-ruby action versions.
Changes:
- Add
debugtocoremocks in multiple JS action tests to preventTypeError: core.debug is not a function. - Bump
ruby/setup-rubypin fromv1.305.0tov1.306.0(with updated SHA) in two action pin data files.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/data/action_pins.json | Updates the pinned ruby/setup-ruby version/SHA. |
| pkg/actionpins/data/action_pins.json | Mirrors the pinned ruby/setup-ruby version/SHA update. |
| actions/setup/js/create_discussion_sanitization.test.cjs | Adds debug to the core mock via vi.fn(). |
| actions/setup/js/add_workflow_run_comment.test.cjs | Adds debug to the global core mock via vi.fn(). |
| actions/setup/js/add_comment.test.cjs | Adds debug to the core mock (no-op function). |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 5/5 changed files
- Comments generated: 2
| "ruby/setup-ruby@v1.306.0": { | ||
| "repo": "ruby/setup-ruby", | ||
| "version": "v1.305.0", | ||
| "sha": "0cb964fd540e0a24c900370abf38a33466142735" | ||
| "version": "v1.306.0", | ||
| "sha": "c4e5b1316158f92e3d49443a9d58b31d25ac0f8f" | ||
| }, |
| "ruby/setup-ruby@v1.306.0": { | ||
| "repo": "ruby/setup-ruby", | ||
| "version": "v1.305.0", | ||
| "sha": "0cb964fd540e0a24c900370abf38a33466142735" | ||
| "version": "v1.306.0", | ||
| "sha": "c4e5b1316158f92e3d49443a9d58b31d25ac0f8f" | ||
| }, |
🧪 Test Quality Sentinel ReportTest Quality Score: N/A (Infrastructure Fix)✅ No new test functions — mock setup patched
Change SummaryThis PR makes a 1-line fix to three JavaScript test files, adding the missing
No new test functions were added; the fix prevents crashes in existing behavioral tests caused by Language SupportTests analyzed:
Verdict
📖 Understanding Test ClassificationsDesign Tests (High Value) verify what the system does:
Implementation Tests (Low Value) verify how the system does it:
References:
|
sanitize_content_core.cjsrecently gainedcore.debug()calls to log redacted URL details, but several test mocks only stubinfo/warning/error/setOutput— omittingdebug. This causedTypeError: core.debug is not a functionacross multiple test files when URL redaction code paths were hit.Changes
create_discussion_sanitization.test.cjs— Added missingdebug: vi.fn()tomockCoreadd_comment.test.cjs— Added missingdebug: () => {}tomockCoreadd_workflow_run_comment.test.cjs— Added missingdebug: vi.fn()tomockCoreAll three mocks now align with the full
@actions/coreinterface thatsanitize_content_core.cjsrelies on.