vitest-react

0.9.5 • Public • Published

🧪 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 🎺🎵

Readme

Keywords

none

Package Sidebar

Install

npm i vitest-react

Weekly Downloads

372

Version

0.9.5

License

MIT

Unpacked Size

11.2 kB

Total Files

13

Last publish

Collaborators

  • chempogonzalez