Skip to content

Fix JavaScript tests: update tests to pass config via parameter#8238

Merged
pelikhan merged 3 commits intomainfrom
copilot/fix-javascript-tests
Dec 31, 2025
Merged

Fix JavaScript tests: update tests to pass config via parameter#8238
pelikhan merged 3 commits intomainfrom
copilot/fix-javascript-tests

Conversation

Copy link
Contributor

Copilot AI commented Dec 31, 2025

Three safe output handler tests (create_discussion.test.cjs, update_issue.test.cjs, close_issue.test.cjs) were failing after the JavaScript handler migration in #8234 because they were passing configuration via environment variables instead of using the config parameter.

Changes

  • create_discussion.test.cjs: Updated to pass title_prefix and category via config object parameter
  • update_issue.test.cjs: Updated to pass allow_title, allow_status, allow_body, and target via config object parameter
  • close_issue.test.cjs: Updated to pass target, required_title_prefix, and required_labels via config object parameter

Example

// Before: using environment variables
process.env.GH_AW_UPDATE_TITLE = "true";
await main();

// After: passing config via parameter
await main({ allow_title: true });

All 118 test files now pass (2398 tests).

Original prompt

Reference: https://github.com/githubnext/gh-aw/actions/runs/20610250452/job/59193422193#step:6:1

Fix JavaScript tests. See reference.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

The tests were failing because the safe output handlers (create_discussion, update_issue, close_issue) were not reading configuration from environment variables, which is how the tests provide configuration.

Changes:
- update_runner.cjs: Read GH_AW_UPDATE_* environment variables for configuration
- create_discussion.cjs: Read GH_AW_DISCUSSION_* environment variables for configuration
- close_entity_helpers.cjs: Use existing parseEntityConfig to read GH_AW_CLOSE_* environment variables

All 118 test files now pass with 2398 tests passing.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix JavaScript tests based on reference Fix JavaScript tests: read safe output configuration from environment variables Dec 31, 2025
Copilot AI requested a review from pelikhan December 31, 2025 02:28
@pelikhan
Copy link
Contributor

@copilot revert changes to the code files and update the tests instead to match the new behavior.

As requested, reverted changes to the three code files (update_runner.cjs, create_discussion.cjs, close_entity_helpers.cjs) and instead updated the test files to pass configuration via the config parameter rather than environment variables.

Test changes:
- create_discussion.test.cjs: Pass title_prefix and category via config object
- update_issue.test.cjs: Pass allow_title, allow_status, allow_body, and target via config object
- close_issue.test.cjs: Pass target, required_title_prefix, and required_labels via config object

All 118 test files pass (2398 tests).

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 31, 2025

@copilot revert changes to the code files and update the tests instead to match the new behavior.

Done in commit 593f7ac. Reverted changes to the code files and updated the tests to pass configuration via the config parameter instead of environment variables.

Copilot AI changed the title Fix JavaScript tests: read safe output configuration from environment variables Fix JavaScript tests: update tests to pass config via parameter Dec 31, 2025
@pelikhan pelikhan marked this pull request as ready for review December 31, 2025 03:05
@pelikhan pelikhan merged commit 1f6f587 into main Dec 31, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/fix-javascript-tests branch December 31, 2025 03:05
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.

2 participants