cypress-skip-this-test

1.0.1 • Public • Published

cypress-skip-this-test

Skips the current test if it depends on the previous failed test

Install

$ npm i -D cypress-skip-this-test
# or using Yarn
$ yarn add -D cypress-skip-this-test

Import the `` in the specs with tests that depend on each other

import { skipIfPreviousTestsFailed } from 'cypress-skip-this-test'

describe('Parent suite', () => {
  // second test fails on purpose
  // and the third test should skip
  beforeEach(skipIfPreviousTestsFailed)

  it('test 1', () => {})

  it('test 2', () => {
    throw new Error('fail on purpose')
  })

  it('test 3', () => {})
})

The "test 3" will be skipped when the test "test 2" fails. If all tests in the parent suite before "test 3" pass successfully, then the test will run.

Small print

Author: Gleb Bahmutov <gleb.bahmutov@gmail.com> © 2024

License: MIT - do anything with the code, but don't blame me if it does not work.

Support: if you find any problems with this module, email / tweet / open issue on Github

/cypress-skip-this-test/

    Package Sidebar

    Install

    npm i cypress-skip-this-test

    Weekly Downloads

    2,259

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    3.81 kB

    Total Files

    4

    Last publish

    Collaborators

    • bahmutov