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-fs

v0.2.6

Published

Cypress-fs is a utility package that extends the capabilities of [Cypress](https://www.cypress.io/) for working with the file system. It provides a set of custom Cypress commands for performing file and directory operations, making it easier to interact w

Downloads

29,525

Readme

Cypress-fs

Cypress-fs is a utility package that extends the capabilities of Cypress for working with the file system. It provides a set of custom Cypress commands for performing file and directory operations, making it easier to interact with files in your end-to-end tests.

Installation

You can install Cypress-fs using npm or yarn. Here's how to do it:

npm

npm install cypress-fs --save-dev

yarn

yarn add --dev cypress-fs

Extra setup

Importing the commands

To use Cypress-fs, you need to import the commands into your Cypress project. To do this, add the following line to your project's cypress/support/e2e.ts file:

import "cypress-fs";

Adding Required Dependencies

Cypress-fs requires some cypress tasks to be registered in order to work. To do this, update your cypress.config.ts to look like the following:

export default defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      return require("cypress-fs/plugins")(on, config);
    },
  },
});

Usage

Commands

Cypress-fs provides the following custom Cypress commands:

cy.fsCopyFile({ path, newPath, mode })

Copies a file from one location to another.

  • path - The path to the file to copy.
  • newPath - The path to the new file.
  • mode - The mode to apply to the new file,refer to fs for more details.

cy.fsFileExists(path)

Checks if a file exists.

  • path - The path to the file to check.

cy.fsReadFile(path, options)

Reads the contents of a file.

  • path - The path to the file to read.
  • options - The options to use when reading the file.

cy.fsWriteFile(path, content, options)

Writes content to a file.

  • path - The path to the file to write to.
  • content - The content to write to the file.
  • options - The options to use when writing the file.

cy.fsDeleteFile(path)

Deletes a file.

  • path - The path to the file to delete.

cy.fsCreateDirectory(path, options)

Creates a directory.

  • path - The path to the directory to create.
  • options - The options to use when creating the directory.

cy.fsDeleteDirectory(path, options)

Deletes a directory.

  • path - The path to the directory to delete.
  • options - The options to use when deleting the directory.

cy.fsChmod({ path, mode })

Changes the permissions of a file.

  • path - The path to the file to change the permissions of.
  • mode - The mode to apply to the file, refer to fs for more details.

cy.fsAppendFile({ path, content })

Appends content to a file.

  • path - The path to the file to append to.
  • content - The content to append to the file.

cy.fsRename({ path, newPath })

Renames a file.

  • path - The path to the file to rename.
  • newPath - The new path for the file.

cy.fsDirExists(path)

Checks if a directory exists.

  • path The path to the directory to check.

cy.fsReadDir(path, options)

Reads the contents of a directory.

  • path - The path to the directory to read.

cy.fsIsDirectory(path)

Checks if a path is a directory.

  • path - The path to check.

cy.fsIsFile(path)

Checks if a path is a file.

  • path - The path to check.

Note

The types used are the same as the ones used by each corresponding method from the fs module.