diff --git a/e2e/app.spec.ts b/e2e/app.spec.ts index 2dcfd03..93a7f82 100644 --- a/e2e/app.spec.ts +++ b/e2e/app.spec.ts @@ -6,6 +6,16 @@ test("has title", async ({ page }) => { await expect(page).toHaveTitle(/React Starter/); }); +test("not found", async ({ page }) => { + await page.goto("/lost"); + + await expect(page).toHaveTitle(/React Starter/); + + await expect( + page.getByRole("heading", { name: "Error", level: 1 }), + ).toBeInViewport(); +}); + test.describe("external links", () => { test.beforeEach(async ({ page }) => { await page.goto("/"); diff --git a/src/pages/error.tsx b/src/pages/error.tsx index 184df14..0b1458b 100644 --- a/src/pages/error.tsx +++ b/src/pages/error.tsx @@ -6,10 +6,10 @@ export const Error = ({ error }: ErrorComponentProps) => {
-

+

Error

-

{error.message}

+

{error.message}

Go back diff --git a/src/pages/not-found.tsx b/src/pages/not-found.tsx index a5d34ff..faf4b4d 100644 --- a/src/pages/not-found.tsx +++ b/src/pages/not-found.tsx @@ -6,10 +6,10 @@ export const NotFound = () => {
-

+

Error

-

Not Found

+

Not Found

Go back diff --git a/src/routes/__root.tsx b/src/routes/__root.tsx index 301aed5..e371796 100644 --- a/src/routes/__root.tsx +++ b/src/routes/__root.tsx @@ -24,4 +24,6 @@ const Root = () => { ); }; -export const Route = createRootRouteWithContext()({ component: Root }); +export const Route = createRootRouteWithContext()({ + component: Root, +}); diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..3400bf2 --- /dev/null +++ b/vercel.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://openapi.vercel.sh/vercel.json", + "rewrites": [ + { + "source": "/(.*)", + "destination": "/" + } + ] +}