Skip to content

Migrate frontend unit tests to Vitest #670

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

Open
2 of 4 tasks
LoTerence opened this issue Apr 12, 2025 · 1 comment · May be fixed by #681
Open
2 of 4 tasks

Migrate frontend unit tests to Vitest #670

LoTerence opened this issue Apr 12, 2025 · 1 comment · May be fixed by #681
Assignees
Labels
complexity: large feature: Quality Control javascript Pull requests that update Javascript code P3: Med Medium priority PBV: dev all issues for engineering roles (devops, backend, frontend, db) role: frontend Pertains to frontend tasks size: 8pt Can be done in 31-48 hours
Milestone

Comments

@LoTerence
Copy link
Member

LoTerence commented Apr 12, 2025

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 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

  • Migrate all Jest unit tests to Vitest
  • 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

@github-project-automation github-project-automation bot moved this to 🆕 New Issue Approval in P: CTJ: Project Board Apr 12, 2025
@LoTerence LoTerence added role: frontend Pertains to frontend tasks size: 8pt Can be done in 31-48 hours P3: Med Medium priority javascript Pull requests that update Javascript code feature: Quality Control complexity: large labels Apr 12, 2025
@LoTerence LoTerence added PBV: dev all issues for engineering roles (devops, backend, frontend, db) P2: Med-high Medium-high priority P3: Med Medium priority and removed P3: Med Medium priority P2: Med-high Medium-high priority labels Apr 13, 2025
@LoTerence LoTerence moved this from 🆕 New Issue Approval to 🧊 Ice Box in P: CTJ: Project Board Apr 13, 2025
@LoTerence LoTerence self-assigned this Apr 15, 2025
@LoTerence LoTerence moved this from 🧊 Ice Box to ❔ For Review / Feedback Needed in P: CTJ: Project Board Apr 15, 2025
@LoTerence LoTerence moved this from ❔ For Review / Feedback Needed to 🏗 In progress in P: CTJ: Project Board Apr 15, 2025
@LoTerence LoTerence linked a pull request Apr 21, 2025 that will close this issue
4 tasks
@LoTerence
Copy link
Member Author

LoTerence commented Apr 21, 2025

Next actions:

  • There is no code inside the files within the tests/__mocks__/ folder. Consider deleting or filling them
  • LandingPage.test.tsx - throws warning: "Warning: An update to Dialog inside a test was not wrapped in act(...)."
  • Button.test.tsx - tests the old SASS button, need to test the new tailwind button instead.
  • Checkbox.test.tsx - tests the old checkbox component, need to test the new tailwind checkbox instead.
  • implement test coverage: npm run test:coverage
  • convert github action jest-react-test to vitest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: large feature: Quality Control javascript Pull requests that update Javascript code P3: Med Medium priority PBV: dev all issues for engineering roles (devops, backend, frontend, db) role: frontend Pertains to frontend tasks size: 8pt Can be done in 31-48 hours
Projects
Status: 🏗 In progress
Development

Successfully merging a pull request may close this issue.

1 participant