@node-lib-tech/universal-test-cases-gen
v1.1.18
Published
Universal library to auto-generate test cases for Node, React, Angular, Vue, and NestJS using Jest, Mocha, Vitest, Supertest, or Playwright.
Maintainers
Readme
@react-lib-tech/universal-test-cases-gen
🚀 A universal test case generator for Node.js, React, Angular, Vue, and NestJS.
Supports Jest, Mocha, and Vitest.
Works as both a CLI tool and a library.
👉 Download README.md
✨ Features
- 🔎 Automatically scans project folders
- 🧪 Generates test stubs for:
- Node.js functions & classes
- React components
- Angular / Vue / NestJS files
- 📦 Supports:
- Jest
- Mocha + Chai
- Vitest
- 📂 Creates
.test.tsfiles inside__tests__/(or custom folder) - 📊 Optional JSON output report
- ⚡ Zero configuration required for most projects
📦 Installation
Install Globally (CLI Usage)
npm install -g @react-lib-tech/universal-test-cases-genInstall as Dev Dependency (Library Usage)
npm install --save-dev @react-lib-tech/universal-test-cases-gen🚀 CLI Usage
universal-test-cases-gen \
--root ./src \
--framework react \
--testFramework jest \
--output __tests__ \
--reportJsonAvailable Options
| Flag | Description | Default |
|------|-------------|---------|
| --root | Root folder to scan | ./src |
| --framework | node / react / angular / vue / nestjs | node |
| --testFramework | jest / mocha / vitest | jest |
| --output | Where test files are written | __tests__ |
| --reportJson | Return a JSON report | false |
📖 Library Usage (Node.js / TypeScript)
Use generateTests() inside your app, script, or build pipeline.
import {
generateTests,
type TestGenConfig,
type GeneratedTestReport
} from "@react-lib-tech/universal-test-cases-gen";
const config: TestGenConfig = {
rootFolder: "./src",
framework: "react",
testFramework: "jest",
output: "__tests__",
reportJson: true
};
(async () => {
const report: GeneratedTestReport[] = await generateTests(config);
console.log("📑 Generated Test Report:", report);
})();📊 Example Output JSON
[
{
"file": "src/components/Button.tsx",
"exports": ["Button"],
"testFile": "__tests__/Button.test.ts"
},
{
"file": "src/utils/math.ts",
"exports": ["add", "subtract"],
"testFile": "__tests__/math.test.ts"
}
]📜 License
MIT © 2025 – @react-lib-tech
