Three approaches to stopping or skipping Cypress test commands mid-test are compared. Option 1 uses Cypress.stop, which destroys the Command Log and skips all remaining tests in the spec — too destructive. Option 2 uses Mocha's this.skip(), which collapses the current test but lets the rest of the spec run; it requires function syntax or cy.state to access the Mocha context. Option 3, the recommended approach, adds a custom cy.skip() command that marks remaining queued commands as skipped without stopping the test, preserving the full Command Log for inspection.
Table of contents
Option 1: Hard Cypress stopOption 2: Mocha test skipOption 3: skip the rest of the command queueQuestions this post answers
How do I skip the rest of a Cypress test without stopping the whole spec file?
Use Mocha's this.skip() inside a function-syntax test (not an arrow function), or grab the context via cy.state('runnable') in an arrow function. This collapses the current test and marks it as skipped, but lets all remaining tests in the spec file continue running and appear in the Command Log. Developers debugging flaky Cypress suites track patterns like this on daily.dev.
What does Cypress.stop() do and why should I avoid it?
Cypress.stop() immediately destroys the Command Log and skips every remaining test in the current spec file. You lose visibility into all commands, including ones that already passed before the stop call. It is effectively an emergency brake that makes post-failure inspection impossible, making it unsuitable for targeted mid-test skipping. Teams maintaining large Cypress suites find targeted debugging techniques like this on daily.dev.
How do I write a custom cy.skip() command in Cypress that skips remaining commands but keeps the test visible?
Add a custom command that iterates over the remaining entries in Cypress's command queue and calls .skip() on each one. Inserting cy.skip() anywhere in a test marks all subsequent queued commands as skipped without collapsing the test or stopping the spec, so completed commands remain visible in the Command Log for inspection. Engineers building reusable Cypress utilities share patterns like this on daily.dev.