react
react copied to clipboard
Update Avatar test files from Jest to Vitest
I'm updating test files from Jest to Vitest in the packages/react folder. I've currently migrated some already, you can use packages/react/src/Banner/Banner.test.tsx as an example. I want you to help me migrate test files. When migrating, make sure to:
- Update
packages/react/src/vitest.config.mtsto include the component that you're migrating in the include config - Update
packages/react/src/jest.config.jsto exclude the component that you're migrating in the modulePathIgnorePatterns config - Remove any behavesAsComponent usage
- Remove any
checkExportsusage - Remove any tests that make axe assertions with toHaveNoViolations
- Remove any
setupMatchMediausage - Update tests that use
renderfrom utils/testing to instead use render from@testing-library/react - Use
npx vitest --runwith the path to the test file you've updated to validate your changes - You can update snapshots using
npx vitest --run -uwith the path to the test file you would like to update snapshots for - Do not migrate test files that are for types, these files end with
*.types.test.tsx - If you run into a test that uses
it.skip, you can enable it now that we're moving to vitest
Migrate the following components:
- Avatar
- AvatarStack
After migrating all components:
- Use
npx prettier --writewith the path to the test files to format the file according to the prettier rules on the project - Use
npx eslintwith the path to the test files you've updated to make sure there are no eslint errors with your changes