From 031ed5557db0ffb336502ab670081e91cf6f1966 Mon Sep 17 00:00:00 2001 From: Hugh Lilly <hughlilly@users.noreply.github.com> Date: Thu, 10 Nov 2022 17:59:55 +1300 Subject: [PATCH] fix comma splice in `verifyRootLayout.ts` (#42324) The phrase "Your page X did not have a root layout, we created Y for you." creates a [comma splice](https://en.wikipedia.org/wiki/Comma_splice). This PR fixes it. Co-authored-by: JJ Kasper <jj@jjsweb.site> --- packages/next/lib/verifyRootLayout.ts | 2 +- test/e2e/app-dir/create-root-layout.test.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/next/lib/verifyRootLayout.ts b/packages/next/lib/verifyRootLayout.ts index 144184b784f65..15068bd47a7de 100644 --- a/packages/next/lib/verifyRootLayout.ts +++ b/packages/next/lib/verifyRootLayout.ts @@ -138,7 +138,7 @@ export async function verifyRootLayout({ chalk.green( `\nYour page ${chalk.bold( `app/${normalizedPagePath}` - )} did not have a root layout, we created ${chalk.bold( + )} did not have a root layout. We created ${chalk.bold( `app${rootLayoutPath.replace(appDir, '')}` )}${ !hasHead diff --git a/test/e2e/app-dir/create-root-layout.test.ts b/test/e2e/app-dir/create-root-layout.test.ts index da4eeab95e640..9c4201aaff607 100644 --- a/test/e2e/app-dir/create-root-layout.test.ts +++ b/test/e2e/app-dir/create-root-layout.test.ts @@ -50,7 +50,7 @@ describe('app-dir create root layout', () => { /did not have a root layout/ ) expect(next.cliOutput.slice(outputIndex)).toMatch( - 'Your page app/route/page.js did not have a root layout, we created app/layout.js and app/head.js for you.' + 'Your page app/route/page.js did not have a root layout. We created app/layout.js and app/head.js for you.' ) expect(await next.readFile('app/layout.js')).toMatchInlineSnapshot(` @@ -112,7 +112,7 @@ describe('app-dir create root layout', () => { /did not have a root layout/ ) expect(next.cliOutput.slice(outputIndex)).toInclude( - 'Your page app/(group)/page.js did not have a root layout, we created app/(group)/layout.js and app/(group)/head.js for you.' + 'Your page app/(group)/page.js did not have a root layout. We created app/(group)/layout.js and app/(group)/head.js for you.' ) expect(await next.readFile('app/(group)/layout.js')) @@ -179,7 +179,7 @@ describe('app-dir create root layout', () => { /did not have a root layout/ ) expect(next.cliOutput.slice(outputIndex)).toInclude( - 'Your page app/(group)/route/second/inner/page.js did not have a root layout, we created app/(group)/route/second/layout.js and app/(group)/route/second/head.js for you.' + 'Your page app/(group)/route/second/inner/page.js did not have a root layout. We created app/(group)/route/second/layout.js and app/(group)/route/second/head.js for you.' ) expect(await next.readFile('app/(group)/route/second/layout.js')) @@ -247,7 +247,7 @@ describe('app-dir create root layout', () => { /did not have a root layout/ ) expect(next.cliOutput.slice(outputIndex)).toInclude( - 'Your page app/page.tsx did not have a root layout, we created app/layout.tsx and app/head.tsx for you.' + 'Your page app/page.tsx did not have a root layout. We created app/layout.tsx and app/head.tsx for you.' ) expect(await next.readFile('app/layout.tsx')).toMatchInlineSnapshot(`