Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

skipOn fails when using @cypress/skip-test and cypress-terminal-report #193

@samtsai

Description

@samtsai

Description

When using cypress-terminal-report with enableExtendedCollector enabled and @cypress/skip-test, the test will fail with a CypressError if the skip check is done in a before hook.

The error below is triggered by:
https://github.com/archfz/cypress-terminal-report/blob/a785736b6c1c2ebe56763ea332886dfef12b51a1/src/collector/LogCollectExtendedControl.js#L76

Reproducible Example

Run the spec test until you hit the error (sometimes it runs without an error).

https://github.com/samtsai/terminal-report-and-skip-tests-bug

Hits this CypressError:

Cypress detected that you returned a promise from a command while also invoking one or more cy commands in that promise.

The command that returned the promise was:

> cy.wait()

The cy command you invoked inside the promise was:

> cy.wait()

Because Cypress commands are already promise-like, you don't need to wrap them or return your own promise.

Cypress will resolve your command with whatever the final Cypress command yields.

The reason this is an error instead of a warning is because Cypress internally queues commands serially whereas Promises execute as soon as they are invoked. Attempting to reconcile this would prevent Cypress from ever resolving.

Because this error occurred during a after all hook we are skipping all of the remaining tests.[Learn more](https://on.cypress.io/returning-promise-and-commands-in-another-command)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions