Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cy.mount() does not provide meaningful error message when component to mount was incorrectly imported #22790

Open
emilyrohrbough opened this issue Jul 14, 2022 · 0 comments
Labels
CT Issue related to component testing npm: @cypress/react @cypress/react package issues Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. type: error message

Comments

@emilyrohrbough
Copy link
Member

Current behavior

cy.mount() does not provide meaningful error message when component to mount was incorrectly imported because we are trying to determine the display name before mounting.

Screen Shot 2022-07-14 at 8 33 54 AM

Screen Shot 2022-07-14 at 8 33 58 AM

Desired behavior

Provide an error message similar to
Screen Shot 2022-07-14 at 8 34 15 AM

Test code to reproduce

Import a component using a wrong path, i.e. if component is exported by default, use a named import

// component
import React from 'react'

const Example = () => (
  <span>
    "hello there"
  </span>
)

export default Example
// test
import React from 'react'
import { Example } from './example'

it('example', () => {
  cy.mount(<Example />)
})

Cypress Version

10.3.0

Other

No response

@emilyrohrbough emilyrohrbough added the npm: @cypress/react @cypress/react package issues label Jul 14, 2022
@github-actions github-actions bot added the stale no activity on this issue for a long period label Apr 13, 2023
@nagash77 nagash77 added routed-to-ct and removed stale no activity on this issue for a long period labels Apr 13, 2023
@cypress-io cypress-io deleted a comment from github-actions bot Apr 13, 2023
@nagash77 nagash77 added CT Issue related to component testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. and removed routed-to-ct labels Apr 19, 2023
@jennifer-shehane jennifer-shehane changed the title [@cypress/react] mount cy.mount() does not provide meaningful error message when component to mount was incorrectly imported May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CT Issue related to component testing npm: @cypress/react @cypress/react package issues Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. type: error message
Projects
None yet
Development

No branches or pull requests

4 participants