npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cygen

v5.0.2

Published

AI-powered Cypress test generator

Downloads

133

Readme

CyGen - AI-Powered Cypress Test Generator

[Under Construction]

CyGen is an intelligent test generator that automatically creates Cypress tests for your JavaScript/TypeScript API endpoints. It uses AI agents to generate comprehensive test cases.

Features

  • Automatic test generation for JavaScript/TypeScript API endpoints
  • AI-powered test case generation using agents
  • Comprehensive test scenarios including:
    • Happy path tests
    • Negative test cases
    • Edge cases
    • Error handling
  • Real-time file watching
  • Customizable output directory
  • Support for modern JavaScript features

Installation

Global Installation (Recommended)

# Install globally
npm install -g cygen

# Verify installation
cygen --help

Local Installation

# Install in your project
npm install cygen

# Run using npx
npx cygen --help

Usage

Command Line Interface

CyGen provides two main commands:

  1. Watch Mode - Continuously watch for file changes:
# Basic usage with Ollama
cygen watch --use-ai

# With OpenAI
cygen watch --use-ai --llm openai --model gpt-4 --api-key YOUR_OPENAI_KEY

# With web search enabled
cygen watch --use-ai --web-search --llm ollama --model llama3.1
  1. Test Mode - Generate and optionally run tests for specific files:
# Generate tests with OpenAI
cygen test --files ./src/api/users.js --use-ai --llm openai --model gpt-3.5-turbo --api-key YOUR_OPENAI_KEY

# With custom Ollama server
cygen test --files ./src/api/*.js --use-ai --llm ollama --model mistral --base-url http://localhost:11434

# Generate and run tests
cygen test --files ./src/api/*.js --use-ai --web-search

CLI Options

Watch Command Options

| Option | Alias | Description | Default | |--------|-------|-------------|---------| | --watch-dir | -w | Directory to watch for file changes | Current directory | | --output-dir | -o | Directory to output generated tests | cypress/integration/generated | | --use-ai | | Enable AI-powered test generation | false | | --web-search | | Enable web search for test generation | false | | --llm | | LLM provider (ollama or openai) | ollama | | --model | | Model name for the selected LLM | llama3.1 | | --api-key | | API key for the LLM provider | | | --base-url | | Base URL for the LLM service | http://localhost:11434 |

Test Command Options

| Option | Alias | Description | Default | |--------|-------|-------------|---------| | --files | -f | Files to generate tests for | (required) | | --output-dir | -o | Directory to output generated tests | cypress/integration/generated | | --use-ai | | Enable AI-powered test generation | false | | --web-search | | Enable web search for test generation | false | | --llm | | LLM provider (ollama or openai) | ollama | | --model | | Model name for the selected LLM | llama3.1 | | --api-key | | API key for the LLM provider | | | --base-url | | Base URL for the LLM service | http://localhost:11434 | | --run | | Run the generated tests with Cypress | false |

Programmatic Usage

You can also use CyGen programmatically in your code:

const { CyGen } = require('cygen');

// Using OpenAI
const cygen = new CyGen({
    useAI: true,
    aiOptions: {
        llm: 'openai',
        model: 'gpt-4',
        apiKey: 'your-openai-key',
        enableWebSearch: true
    }
});

// Using Ollama
const cygen = new CyGen({
    useAI: true,
    aiOptions: {
        llm: 'ollama',
        model: 'mistral',
        baseUrl: 'http://localhost:11434'
    }
});

// Generate tests
await cygen.generateTestsForFile('./src/api/users.js');

Configuration

The following options are available:

  • watchDir: Directory to watch for changes (default: current working directory)
  • outputDir: Directory where test files will be generated (default: './cypress/integration/generated')
  • useAI: Enable AI-powered test generation (default: false)
  • aiOptions: AI configuration options
    • llm: LLM provider (ollama or openai)
    • model: Model name for the selected LLM
    • apiKey: API key for the LLM provider
    • baseUrl: Base URL for the LLM service
    • enableWebSearch: Enable web search for test generation

Supported File Types

  • JavaScript/TypeScript API files
  • Swagger/OpenAPI specification files (JSON/YAML)

Generated Tests

Tests are generated with comprehensive coverage including:

  1. Happy Path Tests

    • Successful API calls
    • Valid request/response handling
    • Expected data validation
  2. Negative Tests

    • Invalid input handling
    • Error response validation
    • Authentication/Authorization failures
    • Rate limiting scenarios
  3. Edge Cases

    • Boundary value testing
    • Empty/null input handling
    • Large payload handling
    • Timeout scenarios

Example generated test:

describe('GET /api/users', () => {
    beforeEach(() => {
        cy.intercept('GET', '/api/users').as('apiRequest');
    });

    it('should return a list of users', () => {
        cy.request({
            method: 'GET',
            url: '/api/users',
            failOnStatusCode: false
        }).then((response) => {
            expect(response.status).to.equal(200);
            expect(response.body).to.be.an('array');
            expect(response.body[0]).to.have.property('id');
            expect(response.body[0]).to.have.property('name');
        });
    });

    it('should handle invalid requests', () => {
        cy.request({
            method: 'GET',
            url: '/api/users/invalid',
            failOnStatusCode: false
        }).then((response) => {
            expect(response.status).to.equal(404);
            expect(response.body).to.have.property('error');
        });
    });
});

Supported LLMs

Ollama

  • Default models: llama3.1, mistral, llama2
  • Requires local Ollama server (default: http://localhost:11434)

OpenAI

  • Models: gpt-4, gpt-3.5-turbo
  • Requires API key