Skip to content

Commit

Permalink
feat(jest): add __mocks__ to entry files
Browse files Browse the repository at this point in the history
jest allows defining manual mocks within a special __mocks__ directory, so those files should be seen as used by knip. See: https://jestjs.io/docs/manual-mocks
  • Loading branch information
TkDodo committed Jan 24, 2025
1 parent e5e57c8 commit 0774966
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/knip/src/plugins/jest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const isEnabled: IsPluginEnabled = ({ dependencies, manifest }) =>

const config = ['jest.config.{js,ts,mjs,cjs,json}', 'package.json'];

const entry = ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'];
const entry = ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)', '**/__mocks__/**'];

const resolveDependencies = async (config: JestInitialOptions, options: PluginOptions): Promise<Input[]> => {
const { configFileDir } = options;
Expand Down

0 comments on commit 0774966

Please sign in to comment.