0.9.5 β€’ Published 3 years ago

vitest-react v0.9.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

πŸ§ͺ vitest-react standard-readme compliant

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