How to use AI to generate unit tests
pnpm install
- First, add the Pythagora API key to your environment using the command:
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.
- To generate unit tests for a specific function in your Node.js application, use the following command:
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 file since version 0.0.36
- Add example/guide with integration test
- Add example with GraphQL (Grafbase - Instant GraphQL APIs for your data)
- Add example with DB (DrizzleORM - next gen TypeScript ORM)
- Website: https://productsway.com/
- Twitter: @jellydn
- Github: @jellydn
Give a ⭐️ if this project helped you!