jestjs/jest · error · ValidationError

● Multiple configurations found: * ${configPath} ..

Error message

● Multiple configurations found:

    * ${configPath}
    ...
  Implicit config resolution does not allow multiple configuration files.
  Either remove unused config files or select one explicitly with `--config`.

What it means

Thrown as a ValidationError during directory traversal when more than one Jest config file is discovered (across jest.config.{js,ts,...} extensions or the package.json 'jest' key) and the caller did not pass skipMultipleConfigError. Jest refuses to guess which config to use under implicit resolution.

Source

Thrown at packages/jest-config/src/resolveConfigPath.ts:108

            `${BULLET}Validation Error`,
            `  Configuration in ${chalk.bold(packageJson)} is not valid. ` +
              `Jest expects the string configuration to point to a file, but ${absolutePath} is not. ` +
              `Please check your Jest configuration in ${chalk.bold(
                packageJson,
              )}.`,
            DOCUMENTATION_NOTE,
          );
        }

        configFiles.push(absolutePath);
      } else {
        configFiles.push(packageJson);
      }
    }
  }

  if (!skipMultipleConfigError && configFiles.length > 1) {
    throw new ValidationError(...makeMultipleConfigsErrorMessage(configFiles));
  }

  if (configFiles.length > 0 || packageJson) {
    return configFiles[0] ?? packageJson;
  }

  // This is the system root.
  // We tried everything, config is nowhere to be found ¯\_(ツ)_/¯
  if (pathToResolve === path.dirname(pathToResolve)) {
    throw new Error(makeResolutionErrorMessage(initialPath, cwd));
  }

  // go up a level and try it again
  return resolveConfigPathByTraversing(
    path.dirname(pathToResolve),
    initialPath,
    cwd,
    skipMultipleConfigError,

View on GitHub (pinned to 8e6d128e4a)

Solutions

  1. Delete the unused config file(s), keeping only one
  2. Or pass --config <path> to explicitly select the config you want
  3. Remove the 'jest' key from package.json if a dedicated config file exists

Example fix

# before: both jest.config.js and jest.config.ts present

# after option A: remove one
rm jest.config.js

# after option B: select explicitly
jest --config jest.config.ts
Defensive patterns

Strategy: validation

Validate before calling

import * as fs from 'node:fs';
import * as path from 'node:path';
const JEST_CONFIG_EXT_ORDER = ['.ts', '.mts', '.cts', '.js', '.mjs', '.cjs', '.json'];
function findDuplicateConfigs(dir: string): string[] {
  return JEST_CONFIG_EXT_ORDER
    .map(ext => path.join(dir, `jest.config${ext}`))
    .filter(f => fs.existsSync(f));
}
const dups = findDuplicateConfigs(process.cwd());
if (dups.length > 1) {
  throw new Error(`Multiple Jest configs found: ${dups.join(', ')}`);
}

Prevention

When it happens

Trigger: Having both jest.config.js and jest.config.ts in the same directory; a jest.config.* file plus a 'jest' key in package.json; leftover configs after migrating between formats (e.g. .js -> .ts without deleting the old one).

Common situations: Migrations between config formats; monorepo scaffolding that drops multiple templates; tooling (Nx, Angular) that generates a second config; merging projects that each brought their own config.

Related errors


AI-assisted analysis of jestjs/jest@8e6d128e4a (2026-08-10). Data as JSON: /api/errors/aa262b3da7bae191. Report an issue: GitHub.