Socket
Socket
Sign inDemoInstall

@cypress/skip-test

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cypress/skip-test

Simple commands to skip a test based on platform, browser or an url


Version published
Weekly downloads
183K
decreased by-3.46%
Maintainers
1
Weekly downloads
 
Created
Source

@cypress/skip-test renovate-app badge semantic-release CircleCI

Simple commands to skip a test based on platform, browser or an url

it('skips this test when running on Mac', () => {
  cy.log('about to run custom command to skip this test')
    .wait(1000)
    .skipOn('mac')
})

Skip in action

Install

npm install -D @cypress/skip-test

Then add this module to your support file cypress/support/index.js

require('@cypress/skip-test')

Example

cy.skip

Skip this test if running in Electron browser

it('only runs on Electron', () => {
  cy.skipOn('electron')
  // the rest of the test
})

Skip this test if running on Windows platform

it('runs on Linux and Mac', () => {
  cy.skipOn('windows')
  // the rest of the test
})

cy.onlyOn

Continues the test only when running on Mac, skips when running on any other platform

it('runs on Mac only', () => {
  cy.onlyOn('mac')
  // the rest of the test
})

Continues this test only when running against localhost. Use baseUrl to set the url to compare.

it('only tests localhost', () => {
  cy.onlyOn('localhost')
  // the rest of the test
})

Notes

You can chain conditions together

it('combination of skip and only', () => {
  cy.skipOn('firefox')
  cy.onlyOn('electron').onlyOn('mac')
  cy.log('running test')
})

If the test runs, it will print the conditions in the command log

Skip and only

Intellisense

To get typings, reference this module, for example by using reference comment

/// <reference types="@cypress/skip-test" />

Skip intellisense

For more details read Cypress Intelligent Completion Guide

Authors

  • Kevin Old
  • Gleb Bahmutov

MIT License

Keywords

FAQs

Package last updated on 07 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc