JSPM

@apitree.cz/testing-library

0.7.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 137
  • Score
    100M100P100Q89256F

React Testing Library setup for Vitest in ApiTree projects.

Package Exports

  • @apitree.cz/testing-library
  • @apitree.cz/testing-library/setup
  • @apitree.cz/testing-library/testing-library

Readme

ApiTree s.r.o.

Testing Library

NPM Version

React Testing Library setup for Vitest in ApiTree projects.

Installation

pnpm add --save-dev @apitree.cz/testing-library @testing-library/react vitest

In a monorepo, install and use the package in each workspace.

Usage

  1. Setup Vitest for React with @apitree.cz/vitest-config.

  2. Create tests/setup.ts:

    import '@apitree.cz/testing-library/setup';
  3. Create test renderers in tests/testing-library.ts

    import { createRenderers } from '@apitree.cz/testing-library';
    
    export * from '@testing-library/react';
    export const { render, renderHook } = createRenderers();

    See CreateRenderersProps for createRenderers props reference.

  4. Write your tests in tests directory and run them with vitest --run command.

    Use tests/testing-library.ts for importing Testing Library utilities.