
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
ai-testgen-tool
Advanced tools
AI-powered CLI tool to generate unit, service, integration, and end-to-end tests for service codebases.
AI-TestGen is a CLI tool that leverages AI to automatically generate unit, service, integration, and end-to-end tests for service-oriented codebases (Node.js, TypeScript, etc.).
npm install
node src/cli/index.js generate --all src/userService.ts --output tests/generated
node src/cli/index.js generate --all src/userService.ts --output tests/generated --dry-run
node src/cli/index.js generate --all src/userService.ts \
--unit-output tests/unit --unit-filename userService.unit.test.ts \
--service-output tests/service --service-filename userService.service.test.ts \
--integration-output tests/integration --integration-filename userService.integration.test.ts \
--e2e-output tests/e2e --e2e-filename userService.e2e.test.ts
node src/cli/index.js generate --all src/userService.ts --output tests/generated --force
If you want to use OpenAI GPT to generate tests:
export OPENAI_API_KEY=sk-...
export OPENAI_BASE_URL=https://your-gateway.example.com/v1
# or use the CLI flag:
# --openai-base-url https://your-gateway.example.com/v1
node src/cli/index.js generate --all src/userService.ts --output tests/generated --ai
# or with a custom base URL:
node src/cli/index.js generate --all src/userService.ts --output tests/generated --ai --openai-base-url https://your-gateway.example.com/v1
Usage: ai-testgen generate [type] <target> [options]
Arguments:
[type] Test type: unit | service | integration | e2e (optional if --all is used)
<target> Target file or directory
Options:
-o, --output <dir> Default output directory (default: "examples")
--all Generate all test types for the target file (omit [type] argument)
--unit-output <dir> Unit test output directory
--unit-filename <name> Unit test filename
--service-output <dir> Service test output directory
--service-filename <name> Service test filename
--integration-output <dir> Integration test output directory
--integration-filename <name> Integration test filename
--e2e-output <dir> E2E test output directory
--e2e-filename <name> E2E test filename
--force Overwrite existing test files
--dry-run Show what would be generated, but do not write files
--ai Use LLM-powered test generation if OPENAI_API_KEY is set
--openai-base-url <url> Custom OpenAI-compatible base URL (for gateways, Azure, etc.)
Preview all test types with custom locations (dry run, no [type] needed):
node src/cli/index.js generate --all src/userService.ts \
--unit-output tests/unit --unit-filename userService.unit.test.ts \
--service-output tests/service --service-filename userService.service.test.ts \
--integration-output tests/integration --integration-filename userService.integration.test.ts \
--e2e-output tests/e2e --e2e-filename userService.e2e.test.ts --dry-run
Generate all test types with OpenAI GPT (if API key is set):
export OPENAI_API_KEY=sk-...
node src/cli/index.js generate --all src/userService.ts --output tests/generated --ai
Generate all test types with a custom OpenAI-compatible endpoint:
export OPENAI_API_KEY=sk-...
export OPENAI_BASE_URL=https://your-gateway.example.com/v1
node src/cli/index.js generate --all src/userService.ts --output tests/generated --ai
# or
node src/cli/index.js generate --all src/userService.ts --output tests/generated --ai --openai-base-url https://your-gateway.example.com/v1
Generate only a unit test in a custom location:
node src/cli/index.js generate unit src/userService.ts --unit-output tests/unit --unit-filename userService.unit.test.ts
Overwrite existing files:
node src/cli/index.js generate --all src/userService.ts --output tests/generated --force
Preview (dry run) before generating:
node src/cli/index.js generate --all src/userService.ts --output tests/generated --dry-run
MIT
FAQs
AI-powered CLI tool to generate unit, service, integration, and end-to-end tests for service codebases.
We found that ai-testgen-tool demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.