I'm running cypress on my project, it's about a simple login using auth0, I'm getting:

(uncaught exception)TypeError: Cannot read properties of undefined (reading 'pathname')

on my file login.cy.jsx

import App from "../../src/App";

describe('login.cy.jsx', () => {
  it('playground', () => {
     cy.mount(<App />)
  })
})

on my app.jsx

import { Router ,Routes, Route } from 'react-router-dom'
import Header from './layout/header'; 
import Profile from './pages/profile';
import Home from './pages/home';
import Dashboard from './pages/dashboard';
import Contact from './pages/contact';
import About from './pages/about';
import Settings from './pages/settings';

function App() {

  return (
    <div>        
      <Router>
        <Header /> 
        <Routes>  
          <Route path='/' Component={Home} />
          <Route path='/home' Component={Home} />
          <Route path='/dashboard' Component={Dashboard} />
          <Route path='profile' Component={Profile} />
          <Route path='/contact' Component={Contact} />
          <Route path='/about' Component={About} />
          <Route path='/settings' Component={Settings} /> 
        </Routes>
      </Router>
    </div>
  );
}

export default App;

so my intuition reading this issue Cannot read properties of undefined (reading 'pathname') I understand that some attribute of tag <Link> is wrong, so I was checking all my code, I checked header, home, dashboard, contact, and another files, but I don't found why this is happing, what't wrong with this code??

0

There are 0 best solutions below