https://github.com/jellydn/auto-testgen-nodejs
How to use AI to generate unit tests
https://github.com/jellydn/auto-testgen-nodejs
ai drizzle drizzle-orm nodejs pythagora turso
Last synced: 6 months ago
JSON representation
How to use AI to generate unit tests
- Host: GitHub
- URL: https://github.com/jellydn/auto-testgen-nodejs
- Owner: jellydn
- License: mit
- Created: 2023-06-15T14:33:57.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-11T05:05:55.000Z (6 months ago)
- Last Synced: 2025-04-11T06:19:46.038Z (6 months ago)
- Topics: ai, drizzle, drizzle-orm, nodejs, pythagora, turso
- Language: TypeScript
- Homepage:
- Size: 3.54 MB
- Stars: 16
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Welcome to auto-testgen-nodejs 👋
How to use AI to generate unit tests[![IT Man - AI-Powered Unit Testing in 2023 [Vietnamese]](https://i.ytimg.com/vi/1YvrwOeZk5w/hqdefault.jpg)](https://www.youtube.com/watch?v=1YvrwOeZk5w)
## Demo

## Usage
```sh
pnpm install
```### Setup
1. First, add the [Pythagora](https://github.com/Pythagora-io/pythagora) API key to your environment using the command:
```sh
npx pythagora --config --pythagora-api-key YOUR_API_KEY
```This command will store your Pythagora API key in a config file which will be used for generating your tests.
### Generating Unit Tests
2. To generate unit tests for a specific function in your Node.js application, use the following command:
```sh
npx pythagora --unit-tests --func divide --path src/math.ts
```In the above command, replace `divide` with the name of the function you want to test and `src/math.ts` with the path to the file that contains the function. The tool will automatically create a unit test for the specified function.
_Note_: Pythagora support [Typescript](https://github.com/Pythagora-io/pythagora/issues/10) file since version 0.0.36
## Plan/Todo
- [ ] Add example/guide with [integration test](https://github.com/Pythagora-io/pythagora/blob/main/src/docs/integration/README.md)
- [ ] Add example with GraphQL ([Grafbase - Instant GraphQL APIs for your data](https://grafbase.com/))
- [ ] Add example with DB ([DrizzleORM - next gen TypeScript ORM](https://orm.drizzle.team/))## Author
- Website: https://productsway.com/
- Twitter: [@jellydn](https://twitter.com/jellydn)
- Github: [@jellydn](https://github.com/jellydn)## Show your support
[](https://ko-fi.com/dunghd)
[](https://paypal.me/dunghd)
[](https://www.buymeacoffee.com/dunghd)Give a ⭐️ if this project helped you!