Skip to content

Apply azdo ext best practices for testing and fix mocks#6491

Merged
vhvb1989 merged 16 commits into
Azure:mainfrom
vhvb1989:vhvb1989/azdo-ext-testing-improvements
Jan 12, 2026
Merged

Apply azdo ext best practices for testing and fix mocks#6491
vhvb1989 merged 16 commits into
Azure:mainfrom
vhvb1989:vhvb1989/azdo-ext-testing-improvements

Conversation

@vhvb1989
Copy link
Copy Markdown
Member

Improves Azure DevOps extension testing by applying best practices and fixing mocks to work on both Windows and Linux (previously only compatible with Linux).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Azure DevOps extension testing infrastructure to follow best practices and fix cross-platform compatibility issues. The changes replace direct child_process usage with the proper azure-pipelines-task-lib/toolrunner API, update test mocks to work on both Windows and Linux, clean up deprecated dependencies, and modernize the Node.js runtime support.

Changes:

  • Refactored main implementation to use toolRunner instead of child_process.execSync for better error handling and cross-platform support
  • Updated test mocks to properly simulate both Windows and Linux/Mac execution environments
  • Removed outdated test files and dependencies (Jest, ts-jest, sync-request, js-yaml)
  • Updated Node.js runtime from Node10/Node20_1 to Node20_1 only

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ext/azuredevops/setupAzd/index.ts Refactored to use toolRunner API with proper async/await and error handling
ext/azuredevops/setupAzd/tests/success.ts Updated mock to support both Windows and Linux scenarios
ext/azuredevops/setupAzd/tests/successVersion.ts Updated mock to support both Windows and Linux scenarios
ext/azuredevops/setupAzd/tests/invalidVersion.ts Updated mock to support both Windows and Linux with failure scenarios
ext/azuredevops/setupAzd/tests/InstallSuccess.ts Deleted - old test runner pattern
ext/azuredevops/setupAzd/tests/InstallFail.ts Deleted - old test runner pattern
ext/azuredevops/setupAzd/package.json Removed Jest-related dependencies, updated test script
ext/azuredevops/setupAzd/task.json Removed deprecated Node10 support
ext/azuredevops/setupAzd/.gitignore Added *.log to ignore test logs
.vscode/cspell-devops-ext.txt Added new technical terms
ext/azuredevops/setupAzd/package-lock.json Dependency updates and removals

@vhvb1989 vhvb1989 enabled auto-merge (squash) January 12, 2026 18:18
@vhvb1989
Copy link
Copy Markdown
Member Author

/check-enforcer override

Comment thread ext/azuredevops/setupAzd/index.ts
Copy link
Copy Markdown
Contributor

@weikanglim weikanglim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for taking the time to add mockable tests and cleaning up the package dependencies -- this is extremely useful for maintenance going forward!

@vhvb1989 vhvb1989 merged commit 3323e13 into Azure:main Jan 12, 2026
4 checks passed
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.

5 participants