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 🙏

© 2024 – Pkg Stats / Ryan Hefner

cypress-codegen

v2.4.4

Published

[![GitHub Actions CI](https://github.com/ExpediaGroup/cypress-codegen/workflows/Release/badge.svg)](https://github.com/ExpediaGroup/cypress-codegen/actions?query=workflow%3ARelease) [![npm version](https://badge.fury.io/js/cypress-codegen.svg)](https://ww

Downloads

2,340

Readme

cypress-codegen

GitHub Actions CI npm version Downloads

A Cypress plugin and CLI tool which automatically adds and enables IntelliSense for your custom commands!

Table of Contents

Why Do I Need This Plugin?

The process for adding Cypress custom commands to test suites is quite manual and involves bloating projects with too much boilerplate code. Additionally, custom commands are hard to write because we don't get IntelliSense or the ease of navigating to the command's definition. The cypress-codegen plugin will enable IntelliSense and "go to definition" shortcuts, and will also generate boilerplate for adding custom commands to Cypress!

Installation

npm i --save-dev cypress-codegen

Plugin Usage

  1. Add the required plugin code to cypress.config.ts like so:
import { cypressCodegen } from "cypress-codegen";
import { defineConfig } from "cypress";

export default defineConfig({
    e2e: {
        setupNodeEvents(on, config) {
            cypressCodegen(on, config);
            return config;
        },
    },

    component: {
        setupNodeEvents(on, config) {
            cypressCodegen(on, config);
            return config;
        },
        devServer: {
            framework: "react",
            bundler: "vite",
        },
    },
});
  1. Put all of your custom commands in cypress/commands as regular functions.
  2. Run the cypress-codegen CLI command, or just open Cypress!
  3. You will notice that the Cypress support file(s) are updated to automatically import all your custom commands!

Example

Check out this project's cypress directory for a generic example!

Custom Command Chaining

If you want to create custom commands that are meant to be scoped to a previous command's result, just add those separately. See the Cypress docs for more details.

Code Styling

cypress-codegen will attempt to read your prettierrc config by default, but will use the prettier defaults otherwise.

Command Line Usage

You can run cypress-codegen in your terminal to generate types for your Cypress project! Pass the --testingType option to run it for a particular testing type, component or e2e (defaults to e2e).

Currently, only the default supportFile config options are supported. See the docs for more details. Also, JavaScript usage is not supported. Use TypeScript, it's better!