mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-18 22:28:38 -05:00
43 lines
891 B
Markdown
43 lines
891 B
Markdown
---
|
|
title: debug
|
|
comments: true
|
|
description: ''
|
|
---
|
|
|
|
`cy.debug` sets a `debugger` and logs the subject from the previous command.
|
|
|
|
Make sure you have your Developer Tools open for `cy.debug` to hit the breakpoint.
|
|
|
|
| | |
|
|
|--- | --- |
|
|
| **Returns** | the subject from the previous command for further chaining. |
|
|
| **Timeout** | *cannot timeout* |
|
|
|
|
# [cy.debug()](#usage)
|
|
|
|
Debug the previous command.
|
|
|
|
# Options
|
|
|
|
Pass in an options object to change the default behavior of `cy.debug`.
|
|
|
|
**cy.debug(*options* )**
|
|
|
|
Option | Default | Notes
|
|
--- | --- | ---
|
|
`log` | `true` | whether to display command in command log
|
|
|
|
# Usage
|
|
|
|
## Log out the current subject for debugging
|
|
|
|
```javascript
|
|
// Cypress will log out the current subject and other
|
|
// useful debugging information to your console
|
|
cy.get('a').debug().should('have.attr', 'href')
|
|
```
|
|
|
|
# See also
|
|
|
|
- [pause](https://on.cypress.io/api/pause)
|