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 - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

18

index.js

@@ -33,3 +33,6 @@ /// <reference path="./index.d.ts" />

Cypress.Commands.add('skipOn', name => {
/**
* Skips the current test based on the browser, platform or url.
*/
export const skipOn = name => {
if (!_.isString(name) || '') {

@@ -66,5 +69,8 @@ throw new Error(

}
})
}
Cypress.Commands.add('onlyOn', name => {
/**
* Runs the current test only in the specified browser, platform or against url.
*/
export const onlyOn = name => {
if (!_.isString(name) || '') {

@@ -97,2 +103,6 @@ throw new Error(

}
})
}
Cypress.Commands.add('skipOn', skipOn)
Cypress.Commands.add('onlyOn', onlyOn)
{
"name": "@cypress/skip-test",
"version": "1.0.0",
"version": "1.1.0",
"description": "Simple commands to skip a test based on platform, browser or an url",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -20,4 +20,6 @@ # @cypress/skip-test [![renovate-app badge][renovate-badge]][renovate-app] [![semantic-release][semantic-image] ][semantic-url] [![CircleCI](https://circleci.com/gh/cypress-io/cypress-skip-test/tree/master.svg?style=svg)](https://circleci.com/gh/cypress-io/cypress-skip-test/tree/master)

Then add this module to your support file `cypress/support/index.js`
## Example
You can use this module as custom Cypress commands `cy.skipOn` and `cy.onlyOn` or by importing its functions. To use custom commands, add this module to your support file `cypress/support/index.js`
```js

@@ -27,6 +29,4 @@ require('@cypress/skip-test')

## Example
### `cy.skipOn`
### `cy.skip`
Skip this test if running in Electron browser

@@ -70,2 +70,18 @@

### imports
```js
import { onlyOn, skipOn } from '../..'
it('runs only on Mac', () => {
// using the exported function instead of
// the custom command cy.onlyOn(...)
onlyOn('mac')
})
it('skips on Mac', () => {
skipOn('darwin')
})
```
### Notes

@@ -99,2 +115,18 @@

## Warning
Skipping tests in Mocha at run-time skips the `afterEach` hooks. In this example, `afterEach` will be skipped, and `after` hook will run.
```js
it('example', () => {
cy.skipOn('mac')
})
afterEach(() => {
// this will be skipped when a test is skipped
})
after(() => {
// this will run even after skipping test
})
```
## Authors

@@ -101,0 +133,0 @@

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