question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cy.stub breaks after upgrade to 7.3.0

See original GitHub issue

Current behavior

I am migrating a project from 6.5.0 to 7.3.0 The project has a large test suite. After installing 7.3.0 many previously successful tests are failing. After investigation it appears that the behavior of cy.stub has changed.

The existing tests have many ‘module’ stubs like:

const AuthProvider = require('../../../../src/providers/Auth'); 
cy.stub(AuthProvider, 'login', (email, password, callback) => {
    callback("hard value", undefined)
})

When the test is run this stub never gets called and the default AuthProvider.login function gets called. So the stub does nothing.

this stack overflow question demonstrates the same issue https://stackoverflow.com/questions/61944433/how-to-stub-a-module-function-with-cypress

Desired behavior

The behavior should be consistent with 6.5.0 I’m not seeing any documentation on this breaking change to cy.stub or how to stub modules like this.

Versions

$ node -v v10.23.0 $ npm -v 6.14.8 $ cypress -v Cypress package version: 7.3.0 Cypress binary version: 7.3.0 Electron version: 12.0.0-beta.14 Bundled Node version: 14.15.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
p-christcommented, Oct 27, 2021

i am also seeing a similar problem and have documented it here

0reactions
rockindahizzycommented, Dec 9, 2022

Closing this issue. Please follow https://github.com/cypress-io/cypress/issues/22355 for updates on ES module mocking.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog - Cypress Documentation
Fixed an issue with the cy.session command where it now recollects the session data after validation is successful to correctly store the full...
Read more >
Loading Data with Fixtures - YouTube
We will implement the initial data load for our todo app, leveraging cy.server() and cy.route() to stub the API call to load our...
Read more >
Getting Started in Eagle 7.3.0 Professional Schematic Software
Developing a PCB on Eagle software can be broken down into a few sections or ... After adding all of the required components...
Read more >
3GPP TS 32.101
The contents of the present document are subject to continuing work within the TSG and may change following formal TSG approval. Should the...
Read more >
TS 102 221 - V13.1.0 - Smart Cards - ETSI
7.3.0. Introduction. ... Default state after UICC activation and ATR . ... Subsequent records are updated with the UPDATE RECORD command without SFI....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found