0.9.5 β’ Published 3 years ago
vitest-react v0.9.5
π§ͺ vitest-react 
Auto setup project to use Vitest with TypeScript + test-utils
π Description
Tool to auto initialize vitest config for react/nextjs projects. Allow to use common test utils methods.
π¦ Installation
# Install the package
$ npm install -D vitest-react
π Usage
Just install the package and it will automatically create a vitest config file in your project root if needed.
Also you have some common test utils methods available:
/**
* You can import some pre-setup common methods in your test files.
*/
import {
render,
renderWithNextRouter, // mocked next router
renderWithProviders, // wrap component in providers
userEvent, // all from @testing-library/user-event
// All the @testing-library/react ones
screen,
waitFor,
// ...
}
/**
* You can also use methods from
* @testing-library/jest-dom automatically
*/
expect(element).toHaveClass('example-class')
expect(element).toBeVisible()
// ...
π€ Happy Code
Created with Typescript! β‘ and latin music πΊπ΅