hackforla / hackforla/CivicTechJobs

Migrate frontend unit tests to Vitest

Open
#670 2 comments 0 reactions 0 assignees View on GitHub
complexity: large feature: Quality Control javascript P3: Med PBV: dev role: frontend size: 8pt
Dominant language
TypeScript
Stars
24
Forks
27
Avg merge
2m
Merged PRs (30d)
1

Description

### Story

As a developers, we should have reliable unit tests for the frontend so that we can detect bugs early and ensure that new changes don't introduce unintended consequences.

### Overview

We recently migrated from CRA+Webpack to Vite, which means that our old unit tests in Jest will no longer be effective. Vite does not have out of box support for Jest. We should **migrate our Jest unit tests to Vitest**.

Lastly, **some old unit tests are outdated** because they tested old Design System UI components. We need to audit them to see if they are still relevant for testing updated UI components.
- For example, [this PR](https://github.com/hackforla/CivicTechJobs/pull/654) about Checkbox component introduces a totally new tailwind Checkbox, but does not update the old jest tests for the old sass Checkbox, so they may fail when trying to test it.

### Action Items

- [x] Migrate all Jest unit tests to Vitest
- [x] Audit old unit tests with updated tailwind UI components
- [ ] Make sure `npm run test` is fully functional
- [ ] Write documentation about how frontend unit tests work on our app

### Resources

- [Resources](https://hackforla.github.io/CivicTechJobs/resources/)
- TDM Calculator Vitest migration: https://github.com/hackforla/tdm-calculator/issues/2282
- 311 Data Vitest migration: https://github.com/hackforla/311-data/pull/1873

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.