Skip to main content
Scaffold a React component and its matching test in a spa module: a .tsx component, a mirrored .spec.tsx test wired up with happy-dom and React Testing Library, and — the first time a module gets a component — the shared happydom.ts preload and bunfig.toml test setup. Required dev dependencies (@happy-dom/global-registrator, @testing-library/react, @testing-library/jest-dom) are installed at the project root when missing.

Usage

Examples

Options

Behavior

Without --feature, the component and its test are written to modules/<module>/src/components/<Name>.tsx and modules/<module>/tests/components/<Name>.spec.tsx. With --feature, both move under features/<feature>/components instead, so the component sits alongside the rest of that feature’s code. The test imports the component with a relative path computed to match its location, so generated specs run unmodified. happydom.ts and bunfig.toml are only written once per module and never override an existing setup.