testing-library / cypress-testing-library

🐅 Simple and complete custom Cypress commands and utilities that encourage good testing practices.
http://npm.im/@testing-library/cypress
MIT License
1.8k stars 152 forks source link

fix: remove deprecated cy.state('subject') #230

Closed warpdesign closed 1 year ago

warpdesign commented 1 year ago

What:

Replace cy.state('subject') by cy.currentSubject().

Why:

cy.state('subject') is being deprecated:

image

How:

Replace cy.state('subject') by cy.currentSubject() in utils.ts.

Checklist:

skvale commented 1 year ago

Linking the PR that deprecated this: https://github.com/cypress-io/cypress/pull/23092

While we would normally consider internal state to be internal, cypress-testing-library relies on cy.state('subject'). Therefore, this PR includes a shim to keep that call working as before. Once this PR is released, we will follow up with them to move over to the new call, ensuring that no end users (with or without cypress-testing-library) ever experience disruption (beyond the console warning).

TylorMayfield commented 1 year ago

image My console appreciates it

marctorrelles commented 1 year ago

Hi! Do you think we can get this merged? Thanks 😄

olaj commented 1 year ago

It would be awesome if this gets merged, if it works that is.

NicholasBoll commented 1 year ago

Duplicate of #233