pythagora  by Pythagora-io

CLI tool for automated unit test generation via LLMs

created 2 years ago
1,796 stars

Top 24.6% on sourcepulse

GitHubView on GitHub
Project Summary

Pythagora aims to automate the generation of unit tests for Node.js applications using LLMs, specifically GPT-4. It targets developers seeking to improve code coverage and identify bugs with minimal manual effort, offering a significant time-saving benefit by reducing the need to write tests from scratch.

How It Works

Pythagora parses the target function and its dependencies using Abstract Syntax Trees (AST). This information, along with the function's code, is sent to a Pythagora server which leverages GPT-4 to generate Jest unit tests. This approach allows for the identification of edge cases and potential bugs within the code itself, as demonstrated by bug findings in projects like Lodash.

Quick Start & Requirements

  • Install: npm i pythagora --save-dev
  • Run: npx pythagora --unit-tests --func <FUNCTION_NAME>
  • Prerequisites: OpenAI API Key or Pythagora API Key. Node.js environment.
  • Notes: For Windows, use Git Bash.
  • Docs: Visual Studio Code Extension, Demo Videos

Highlighted Details

  • Generates Jest unit tests for JavaScript and TypeScript.
  • Can generate tests for single functions, files, or entire folders.
  • Supports expanding existing test suites to increase code coverage.
  • Has identified bugs in open-source projects like Lodash and node-fs-extra.

Maintenance & Community

  • Project is in alpha.
  • Community discussion available on Discord.

Licensing & Compatibility

  • License: Not explicitly stated in the README.
  • Compatibility: Primarily for JavaScript/TypeScript. Supports Jest framework. Code is sent to OpenAI for processing; review OpenAI's privacy policy.

Limitations & Caveats

Pythagora is an alpha version and works best with standalone functions; more complex or non-standalone functions may require manual review and modification. Generated tests should always be reviewed before committing. The project is deprecated in favor of GPT Pilot.

Health Check
Last commit

11 hours ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
38 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.