DPL-890-3 Replace Jest with Vitest to ensure maintainability and security and enable us to upgrade to Vue 3
Sangeetha-Bheeman opened this issue · comments
Describe the Housekeeping
As developers we need to upgrade Quanthub to Vue 3 as Vue 2 is out of support in December 2023. As part of this we need to replace Jest with Vitest.
Who are the primary contacts for this story
Steve, Sangeetha
Who is the nominated tester for UAT
PSD
Acceptance criteria
To be considered successful the solution must allow:
- Replace Jest with Vitest.
- The application to continue to work as expected with no loss of service for users
Tasks:
- Install vitest
- Add vitest related config to vite.config
- Remove jest config and its dependencies
- Jest has globals enabled by default, so
describe, expect, test
etc are available from the global scope. Vitest does not. So this needs to be handled, either enabling globals via the globals config setting or update code to use imports from the vitest module instead.
- Jest has globals enabled by default, so
- Modify the test files to remove jest dependencies and replace it with vitest utility functions using
vi
helper. - Testing:
- Run and pass all the unit tests and e2e tests.
- Run the application to upload a quantfile successfully and test the qc data is exported to Sequencescape.
- Test printing works as expected.
Reference link to the vitest migration guide here - https://vitest.dev/guide/migration.html