Failed to load "/_app"
See original GitHub issueI have basically copied over the code from the example and adapted it to render the main route “/”. The test just tests if there’s a certain text. I don’t understand why it can’t render _app. Is there a way to have info in the error output?
test:
import { screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { getPage } from 'next-page-tester';
describe('Main route', () => {
it('redirects to the Dashboard after log in', async () => {
const { render } = await getPage({
route: '/dashboard',
});
render();
expect(screen.getByRole('Button', {
name: /log in/i
})).toBeInTheDocument();
userEvent.click(screen.getByText('Log in', {
exact: true
}));
await screen.findByText(/hallo tim/i);
});
});
_app.tsx:
import '../styles/index.css';
import '../styles/_app.css';
import '../styles/course_content.css';
import type { AppProps } from 'next/app';
import { useStore, loadStore } from '../store';
import { Auth } from '../views';
import { useEffect, useState } from 'react';
import moment from 'moment';
// App component wrapping each page / route
export function MyApp({ Component, pageProps }: AppProps) {
const [storeLoaded, setStoreLoaded] = useState(false);
const { user, getLoginStatus } = useStore(({ user, getLoginStatus }) => ({
user,
getLoginStatus,
}));
const isLoggedIn = getLoginStatus();
useEffect(() => {
loadStore(useStore);
setStoreLoaded(true);
}, []);
moment.locale('de', {
weekdays: 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'),
weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
week: {
dow: 1,
},
});
// Render requested page when logged in, render auth view
// If store hasn't loaded yet, render empty view
return storeLoaded ? (
isLoggedIn ? (
<Component {...pageProps} />
) : (
<Auth {...pageProps} />
)
) : (
<div className='w-full h-full'></div>
);
}
export default MyApp;
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Fix an installed Android app that isn't working
Try the following steps if an app installed on your phone has any of these problems: Crashing. Won't open. Won't respond. Isn't working...
Read more >Application failed to load
Dear all, I have been running on some issues recently on version 11.2 SR7. It's the second time in a week my application...
Read more >What to do if my app shows "Failed to load data, please try ...
What to do if my app shows "Failed to load data, please try again"? · Uninstall Aranet4 app. · Delete Aranet4 from the...
Read more >Windows 10 in app images failing to load
Windows 10 in app images failing to load. So I am asking if anyone here may know another solution to my issue which...
Read more >Failed to load App Descriptor - AppGyver Community Edition
Afternoon all, getting the: "Network Error Retrying To Download App Descriptor" error in the SAP and the app won't load on my phone...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

hey @toomuchdesign, thanks for the ultra fast response. Yes, I also noticed that the error happens there, I did some debugging to see what the catch block receives as an error. It’s quite strange, as in my case the
evariable is anobjectand not an error, so maybe there’s also an issue within Jest itself, imo. Jest should throw anErrorand not an object. However it might be a good idea to anyway log the stringified error in case of failure:Would you be open for a PR? 😄
@romanserazhiev did you update next page tester to see if you receive a specific error message?