Replace mockery to sinon library in mock-run which is used for Tasks Unit Tests #961
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.
This PR includes changes that are made to the azure-pipelines-task-lib to replace the Mockery package with Sinon. Despite not utilizing the vulnerable method in Mockery (CVE-2022-37614 in Mockery 2.1.0), it was decided to make this change because Mockery is outdated. Sinon appeared to be the most suitable package. The changes proposed in this PR affect the unit tests of Pipeline Tasks, and some tasks may need adjustments when updating to the new version of task-lib.
Changelog:
Impact of Changes:
The changes require additional alterations in several situations when updating Pipeline Tasks to the new version of task-lib:
Testing:
The changes were thoroughly tested using the unit tests of tasks under our ownership in the Pipeline Tasks repository. Out of around 200+ tasks, half are under our ownership. Out of these, not all are affected by these changes. Around 40-50 tasks that were affected have been tested.
Documentation:
After the PR gets merged, the documentation for the TaskMockRunner class should be updated to reflect the new and refactored methods and the usage of Sinon.js over Mockery. It should provide examples of how to use the new methods to accommodate the changes made.
Note:
This PR doesn't directly handle the localization changes, module initialization, relative path adjustments, recursive calls, and import aliasing. A separate migration guide will be released to help others navigate the necessary modifications in their tasks.