From db9cc66a3e1ddc7dbbb3c5389b1241648c0b91b5 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 16 Oct 2023 13:41:06 +0100 Subject: [PATCH] test: update test and make index replacement case-insensitive --- packages/nuxt/src/core/utils/names.ts | 2 +- packages/nuxt/test/app.test.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/nuxt/src/core/utils/names.ts b/packages/nuxt/src/core/utils/names.ts index a40cb4346a..9e9dff7512 100644 --- a/packages/nuxt/src/core/utils/names.ts +++ b/packages/nuxt/src/core/utils/names.ts @@ -6,7 +6,7 @@ export function getNameFromPath (path: string, relativeTo?: string) { const relativePath = relativeTo ? normalize(path).replace(withTrailingSlash(normalize(relativeTo)), '') : basename(path) - return kebabCase(relativePath.replace(/\/index\.\w+$/, '').replace(/[\\/]+/g, '-').replace(extname(relativePath), '')).replace(/["']/g, '') + return kebabCase(relativePath.replace(/\/index\.\w+$/i, '').replace(/[\\/]+/g, '-').replace(extname(relativePath), '')).replace(/["']/g, '') } export function hasSuffix (path: string, suffix: string) { diff --git a/packages/nuxt/test/app.test.ts b/packages/nuxt/test/app.test.ts index 7bebd5a6fe..bc92319335 100644 --- a/packages/nuxt/test/app.test.ts +++ b/packages/nuxt/test/app.test.ts @@ -185,6 +185,7 @@ describe('resolveApp', () => { 'layouts/default.vue', 'layouts/some/layout.vue', 'layouts/SomeOther.vue', + 'layouts/SomeOther/Thing/Index.vue', 'layouts/some.vue', 'layouts/SomeOther/layout.ts' ]) @@ -210,6 +211,10 @@ describe('resolveApp', () => { "file": "/layouts/SomeOther/layout.ts", "name": "some-other-layout", }, + "some-other-thing": { + "file": "/layouts/SomeOther/Thing/Index.vue", + "name": "some-other-thing", + }, } `) })