{"library":"rc-test","title":"React Component Test Tools","description":"rc-test is a focused testing utility library designed for React components, primarily built as a wrapper and pre-configurator for Jest. It streamlines the setup of the testing environment for React projects by providing a customized Jest runner and re-exporting common Jest functions along with specific React component testing helpers. The current stable version is 7.1.3. Releases are typically driven by dependency updates, Jest compatibility fixes, and new utility additions, with a fairly active development cadence as indicated by recent minor version bumps. Its key differentiator lies in simplifying React testing boilerplate, addressing common environment issues like `jsdom` configurations and `ResizeObserver` mocks, and ensuring compatibility with various Jest versions, rather than introducing a new testing paradigm.","language":"javascript","status":"active","last_verified":"Thu Apr 23","install":{"commands":["npm install rc-test"],"cli":null},"imports":["import createTest from 'rc-test/lib/createTest';","import { test } from 'rc-test';","import type { TestOptions } from 'rc-test/lib/createTest';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { test, expect, render, screen } from '@testing-library/react';\nimport createTest from 'rc-test/lib/createTest';\nimport MyComponent from './MyComponent'; // Assume this exists for demonstration\n\n// A basic React component for testing\nfunction MyComponent({ name }) {\n  return <div>Hello, {name || 'World'}!</div>;\n}\n\n// Using rc-test's createTest utility for structured tests\nconst { setup } = createTest();\n\ndescribe('MyComponent with rc-test', () => {\n  setup(); // Sets up render, cleanup, etc. from testing-library\n\n  test('should render correctly with default name', () => {\n    render(<MyComponent />);\n    expect(screen.getByText('Hello, World!')).toBeInTheDocument();\n  });\n\n  test('should render correctly with a provided name', () => {\n    render(<MyComponent name=\"Alice\" />);\n    expect(screen.getByText('Hello, Alice!')).toBeInTheDocument();\n  });\n});\n\n// To run this test, add a script to package.json:\n// {\n//   \"scripts\": {\n//     \"test\": \"rc-test\"\n//   }\n// }\n// Then run: npm test OR yarn test OR pnpm test","lang":"typescript","description":"Demonstrates defining a simple React component test using `rc-test`'s `createTest` utility and running it via the CLI.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}