Skip to content

Conversation

Copy link

Copilot AI commented Nov 12, 2025

Updated deprecated Node 12 runtime and added test coverage for maintainability.

Changes

Runtime & Dependencies

  • Upgraded to Node 20 runtime (Node 12 EOL)
  • Updated all dependencies to latest versions, eliminating 14 vulnerabilities (7 high, 6 moderate, 1 low)
  • Fixed deprecated yaml.safeLoad()yaml.load()

Code Refactoring

  • Extracted functions to accept parameters instead of module-level globals, enabling testability
  • Added module exports for testing without breaking existing behavior

Test Infrastructure

  • Added Jest with 17 unit tests covering:
    • Jazzy install command generation with version handling
    • CLI argument construction and config file integration
    • Output directory extraction from args and YAML/JSON configs
    • Priority resolution (args override config, --output over -o)

Example

Before (untestable):

const jazzyArgs = core.getInput("args")
const getDocumentationFolder = () => {
  if (jazzyArgs && jazzyArgs.includes("--output")) {
    return sliceDocumentsFromJazzyArgs("--output")
  }
  return "docs"
}

After (testable):

const getDocumentationFolder = (jazzyArgs, configFilePath) => {
  if (jazzyArgs && jazzyArgs.includes("--output")) {
    return sliceDocumentsFromJazzyArgs(jazzyArgs, "--output")
  }
  return "docs"
}

Rebuilt dist/index.js with updated code. All existing functionality preserved.

Original prompt

Update this and add tests


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Nov 12, 2025
Copilot AI and others added 2 commits November 12, 2025 23:40
Co-authored-by: marzvrover <6617862+marzvrover@users.noreply.github.com>
- Updated action.yml to use node20 instead of deprecated node12
- Updated all dependencies to latest versions to fix security vulnerabilities
- Fixed deprecated yaml.safeLoad -> yaml.load
- Refactored main.js to make functions testable and exportable
- Added Jest as test framework
- Created comprehensive unit tests for all utility functions
- Updated package.json with test script
- Updated .gitignore to exclude test artifacts
- Rebuilt dist/index.js with updated code

Co-authored-by: marzvrover <6617862+marzvrover@users.noreply.github.com>
Copilot AI changed the title [WIP] Update code and add tests Modernize action: Node 20, fix vulnerabilities, add tests Nov 12, 2025
Copilot AI requested a review from marzvrover November 12, 2025 23:49
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