Set up testing environment for updateChangelog
and write comprehensive unit tests
#188
Labels
updateChangelog
and write comprehensive unit tests
#188
Explanation
There are currently no tests written for
updateChangelog
or any other method in theupdate-changelog.ts
file. We should write comprehensive unit tests for this module.Issues
One complication with writing tests for
updateChangelog
and its helper methods is that they rely on executing actual git commands, as well as taking aprojectRootDirectory
parameter which defaults to the root directory of the localauto-changelog
repo.If tests are written to call
updateChangelog
, the tests will run on the changelog of theauto-changelog
repo itself instead of the supplied mock changelog.Approach
Therefore, it's necessary to set up mock git repos where git commands can be run in order to write tests for
updateChangelog
.One possible approach would be to mock the outputs from the git commands, but this is likely to be too complex to be practical.
A second approach is to use the following tools to create sandboxes and set up git repos inside:
createSandbox
method in thefs
module of@metamask/utils
repository-{utils,filesystem}
modules of@metamask/module-lint
References
updateChangelog
in #158 #181The text was updated successfully, but these errors were encountered: