@react-lib-tech/universal-test-cases-gen
v0.1.9
Published
Universal library to auto-generate test cases for Node, React, Angular, Vue, and NestJS using Jest, Mocha, or Vitest.
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.
✨ Features
- 🔎 Scans your project folder automatically
- 🧪 Generates test stubs for:
- Node.js functions/classes
- React components
- Angular/Vue/NestJS (basic scaffolds)
- 📦 Test framework support:
- Jest
- Mocha + Chai
- Vitest
- 📂 Writes
.test.tsfiles into__tests__/(or custom folder) - 📊 Optional JSON report output
📦 Installation
Global (CLI tool)
npm install -g @react-lib-tech/universal-test-cases-genLocal (as dev dependency)
npm install --save-dev @react-lib-tech/universal-test-cases-gen🚀 Usage (CLI)
universal-test-cases-gen --root ./src --framework react --testFramework jest --output __tests__ --reportJsonOptions:
--root→ project root folder to scan (default:./src)--framework→node | react | angular | vue | nestjs--testFramework→jest | mocha | vitest--output→ output folder for test files (default:__tests__)--reportJson→ if provided, outputs a JSON report
📖 Usage (Library)
import { generateTests, TestGenConfig } from "@react-lib-tech/universal-test-cases-gen";
const config: TestGenConfig = {
rootFolder: "./src",
framework: "react",
testFramework: "jest",
output: "__tests__",
reportJson: true
};
(async () => {
const report = await generateTests(config);
console.log("📑 Test Report:", report);
})();📂 Example Output
[
{
"file": "src/components/Button.tsx",
"exports": ["Button"]
},
{
"file": "src/utils/math.ts",
"exports": ["add", "subtract"]
}
]📜 License
MIT © 2025 – @react-lib-tech/universal-test-cases-gen
