diff --git a/packages/knip/src/plugins/vite/index.ts b/packages/knip/src/plugins/vite/index.ts index 00180914a..4c3aedf0d 100644 --- a/packages/knip/src/plugins/vite/index.ts +++ b/packages/knip/src/plugins/vite/index.ts @@ -13,7 +13,7 @@ export const ENABLERS = ['vite']; export const isEnabled: IsPluginEnabledCallback = ({ dependencies }) => hasDependency(dependencies, ENABLERS); -export const CONFIG_FILE_PATTERNS = ['vite.config.{js,mjs,ts,cjs,mts,cts}']; +export const CONFIG_FILE_PATTERNS = ['vite*.config.{js,mjs,ts,cjs,mts,cts}']; const findViteDependencies: GenericPluginCallback = async (configFilePath, options) => { const localConfig: ViteConfigOrFn | undefined = await load(configFilePath); diff --git a/packages/knip/src/plugins/vitest/index.ts b/packages/knip/src/plugins/vitest/index.ts index 374783606..e1cb86e60 100644 --- a/packages/knip/src/plugins/vitest/index.ts +++ b/packages/knip/src/plugins/vitest/index.ts @@ -22,7 +22,7 @@ export const ENABLERS = ['vitest']; export const isEnabled: IsPluginEnabledCallback = ({ dependencies }) => hasDependency(dependencies, ENABLERS); export const CONFIG_FILE_PATTERNS = [ - 'vitest.config.{js,mjs,ts,cjs,mts,cts}', + 'vitest*.config.{js,mjs,ts,cjs,mts,cts}', 'vitest.{workspace,projects}.{ts,js,json}', ]; diff --git a/packages/knip/test/plugins/vitest.test.ts b/packages/knip/test/plugins/vitest.test.ts index 29b924b08..95762b486 100644 --- a/packages/knip/test/plugins/vitest.test.ts +++ b/packages/knip/test/plugins/vitest.test.ts @@ -47,14 +47,16 @@ test('Find dependencies in vitest configuration', async () => { }); assert(issues.unlisted['vitest.workspace.ts']['@edge-runtime/vm']); + assert(issues.unlisted['vitest-default-coverage.config.ts']['jsdom']); + assert(issues.unlisted['vitest-default-coverage.config.ts']['@vitest/coverage-v8']); assert(issues.unlisted['vitest.config.ts']['happy-dom']); assert(issues.unlisted['vitest.config.ts']['@vitest/coverage-istanbul']); assert(issues.unlisted['vitest.config.ts']['setup.js']); assert.deepEqual(counters, { ...baseCounters, - files: 2, - unlisted: 4, + files: 1, + unlisted: 6, processed: 6, total: 6, });