Skip to content

Commit

Permalink
Fix test for absence of test config in vitest plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Dec 4, 2023
1 parent c2ff2b3 commit b43a903
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/knip/src/plugins/vitest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,13 @@ export const findVitestDependencies = async (
resolveEntry(configFilePath, specifier)
);

if (!localConfig.test) return dependencies;
{
// When coming from the vite plugin we should not assume vitest is enabled
// TODO Fix better
const deps = Object.keys(options.manifest.dependencies ?? {});
const devDeps = Object.keys(options.manifest.devDependencies ?? {});
if (!new Set([...deps, ...devDeps]).has('vitest')) return dependencies;
}

return [...dependencies, ...findConfigDependencies(configFilePath, localConfig, options)];
};
Expand Down

0 comments on commit b43a903

Please sign in to comment.