Skip to content

Commit

Permalink
Presets are extended by local config in jest plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Oct 16, 2024
1 parent 6115107 commit 4973a9d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/knip/src/plugins/jest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ const config = ['jest.config.{js,ts,mjs,cjs,json}', 'package.json'];
const entry = ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'];

const resolveExtensibleConfig = async (configFilePath: string) => {
const config = await load(configFilePath);
let config = await load(configFilePath);
if (config?.preset) {
const { preset } = config;
if (isInternal(preset)) {
const presetConfigPath = toAbsolute(preset, dirname(configFilePath));
const presetConfig = await resolveExtensibleConfig(presetConfigPath);
Object.assign(config, presetConfig);
config = Object.assign({}, presetConfig, config);
}
}
return config;
Expand All @@ -38,7 +38,7 @@ const resolveDependencies = async (config: JestInitialOptions, options: PluginOp
if (isInternal(preset)) {
const presetConfigPath = toAbsolute(preset, configFileDir);
const presetConfig = await resolveExtensibleConfig(presetConfigPath);
Object.assign(config, presetConfig);
config = Object.assign({}, presetConfig, config);
}
}

Expand Down

0 comments on commit 4973a9d

Please sign in to comment.