Vitest is used for both unit tests and testing Remix route components using
createRemixStub
.
The following packages are added:
vitest
vite-tsconfig-paths
@vitejs/plugin-react
@testing-library/jest-dom/vitest
@remix-run/testing
The following scripts are added to package.json:
test
- run vitest in watch modevalidate
- runs vitest in run mode
The following configuration files are used:
- vitest.config.js
It will run all tests in the app
folder.
The following setup file are used:
- tests/setup/setup-test-env.ts
- tests/setup/global-setup.ts
The setup-test-env.ts script imports @testing-library/jest-dom/vitest
which will automatically extent the vitest expect
with additional matchers.