Conversation
…re functions Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…o core functions Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
….test.cjs remains Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] fix JavaScript tests (mocks are out of date)
Fix JavaScript test mocks: Update outdated console.log expectations to @actions/core functions
Sep 12, 2025
Collaborator
|
@copilot continue fixing tests |
Collaborator
|
30 more tests to fix |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
✅ All JavaScript tests fixed! Successfully achieved 331/331 tests passing (100% success rate). Key fixes applied:
Commit: 7faf955 |
Copilot
AI
changed the title
Fix JavaScript test mocks: Update outdated console.log expectations to @actions/core functions
Fix JavaScript test mocks: Complete 100% test coverage with @actions/core functions
Sep 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The JavaScript test suite was failing with 50+ test failures because the tests used outdated mocks that expected
console.log()calls, while the actual implementation uses GitHub Actions@actions/corelogging methods (core.info(),core.debug(),core.warning()).Root Cause
Tests were written before migrating from console-based logging to the GitHub Actions core library:
Solution
Systematically updated all JavaScript test files to use proper
@actions/coremock expectations:consoleSpy→mockCore.info/debug/warningcore.infovscore.debugmismatches incheck_permissions.test.cjscore.setFailed()for JSON parsing errorsKey Changes
Core Function Mapping:
mockCore.info()mockCore.debug()mockCore.warning()mockCore.setFailed()Files Updated (18+ total):
add_labels.test.cjs- 31 tests, all now passingcreate_pull_request.test.cjs- 25 tests, all now passingcollect_ndjson_output.test.cjs- 62 tests, all now passingcheck_permissions.test.cjs- 14 tests, updated logging expectations and removed process.exit mockssanitize_output.test.cjs- 47 tests, fixed remaining consoleSpy referencespush_to_pr_branch.test.cjs- Fixed contradictory test expectationscreate_code_scanning_alert.test.cjs- Updated error handling expectationscreate_discussion.test.cjs- Aligned with core function usageResults
Example Fix
Testing
All 331 JavaScript tests now pass with 100% success rate. Test mocks correctly match the actual implementation's use of GitHub Actions
@actions/corelogging methods, providing complete and reliable test coverage for the agentic workflow system.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.