MetaMask / MetaMask/auto-changelog

Set up testing environment for `updateChangelog` and write comprehensive unit tests

Open
#188 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

team-wallet-framework wf-test-quality-improvement
Dominant language
TypeScript
Stars
8
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Explanation

There are currently no tests written for updateChangelog or any other method in the update-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 a projectRootDirectory parameter which defaults to the root directory of the local auto-changelog repo.

If tests are written to call updateChangelog, the tests will run on the changelog of the auto-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 the fs module of @metamask/utils
  • repository-{utils,filesystem} modules of @metamask/module-lint
    • module-lint is not intended to be released as a public package, so it will need to be npm installed as a git repo.

References

  • See #16
  • Follows #181

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with update-changelog.ts and the existing references in #16 and #181. Set up sandbox Git repositories using createSandbox from @metamask/utils or the repository-utils and repository-filesystem modules, then run tests against mock changelogs rather than the auto-changelog repository. Done means comprehensive unit coverage for updateChangelog and its helper methods.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, typescript
Domain
devtools, testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.