Skip to content

test(metrics): migrate tests to vitest & refactor #3355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 25, 2024
Merged

Conversation

dreamorosi
Copy link
Contributor

Summary

Changes

Please provide a summary of what's being changed

This PR introduces significant refactoring to the unit tests of the Metrics utility to streamline the test structure and prioritize observing the actual side effects of certain actions, rather than assessing values in the internal implementation.

The PR follows a similar philosophy to a previous one opened for Logger, where I went through all the existing tests and refactored them. For example, except for rare cases, most of the tests observe and perform assertions on the metrics emitted by the utility rather than looking at the implementation of the class.

At the same time, the PR also moves the tests off Jest in favor of vitest. Coverage remained the same, but tests have been split into smaller and more focused files since the previous structure had most of the tests in a single 2K+ LOC file.

Please add the issue number below, if no issue is present the PR might get blocked and not be reviewed

Issue number: closes #2821, closes #3354


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@dreamorosi dreamorosi self-assigned this Nov 25, 2024
@dreamorosi dreamorosi requested a review from a team November 25, 2024 11:21
@dreamorosi dreamorosi requested a review from a team as a code owner November 25, 2024 11:21
@boring-cyborg boring-cyborg bot added dependencies Changes that touch dependencies, e.g. Dependabot, etc. internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) metrics This item relates to the Metrics Utility tests PRs that add or change tests labels Nov 25, 2024
@pull-request-size pull-request-size bot added the size/XXL PRs with 1K+ LOC, largely documentation related label Nov 25, 2024
@boring-cyborg boring-cyborg bot added the automation This item relates to automation label Nov 25, 2024
Copy link
Contributor

@am29d am29d left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Only a minor change for watch command.

Looks like it was the last package to migrate from jest to vitest. We can now remove more jest remains scattered across the docs and config files.

@dreamorosi dreamorosi requested a review from am29d November 25, 2024 13:03
@am29d am29d merged commit 0b50be7 into main Nov 25, 2024
38 checks passed
@am29d am29d deleted the chore/metrics_vitest branch November 25, 2024 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation This item relates to automation dependencies Changes that touch dependencies, e.g. Dependabot, etc. internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) metrics This item relates to the Metrics Utility size/XXL PRs with 1K+ LOC, largely documentation related tests PRs that add or change tests
Projects
None yet
2 participants