jestjs/jest · critical · Error
jest: No configuration found for any project.
Error message
jest: No configuration found for any project.
What it means
readConfigs (index.ts:397-494) aggregates per-project configs and at the end requires a non-empty globalConfig and at least one project config (index.ts:486-488). If neither condition holds — no projects resolved, no config file was found anywhere — Jest has nothing to run and throws this terminal error.
Solutions
- Create a jest.config.js (or add a jest key to package.json) in the project root.
- Run jest from the directory containing the config, or pass --config <path> explicitly.
- Run jest --showConfig or jest --listTests to confirm Jest can discover configuration.
- If using projects, ensure at least one entry resolves to a directory with a config.
Example fix
// before: no jest config present
// after: create jest.config.js
module.exports = { testEnvironment: 'node' }; Defensive patterns
Strategy: validation
Validate before calling
import * as fs from 'node:fs';
import * as path from 'node:path';
const EXTS = ['.js','.ts','.mjs','.cjs','.json','.mts','.cts'];
function ensureJestConfigExists(root: string): void {
const hasFile = EXTS.some(e => fs.existsSync(path.join(root, `jest.config${e}`)));
const pkgJson = fs.existsSync(path.join(root, 'package.json')) ? require(path.join(root,'package.json')) : {};
if (!hasFile && !pkgJson.jest) {
throw new Error('No jest config found; create jest.config.js or add a jest key to package.json');
}
} Try / catch
try {
const { globalConfig, configs } = await readConfigs(argv, projectPaths);
// ...
} catch (e) {
if ((e as Error).message.includes('No configuration found')) {
console.error('No Jest config: run `npx jest --init` or add one.');
process.exit(1);
}
throw e;
} Prevention
- Run npx jest --init to scaffold a config in new projects.
- Pin the config file in version control and CI checkout.
- Confirm cwd before invoking jest in CI.
When it happens
Trigger: Running jest in a directory with no jest.config.*, no jest key in package.json, and no parent directory containing one; pointing --config at a path that doesn't exist or resolves to nothing; a projects array whose entries were all filtered out (e.g. non-directory non-config files).
Common situations: Fresh project that hasn't created a config; wrong cwd (e.g. running from a subdirectory with no config and no upward resolution); deleted/moved config; CI checkout that excluded the config file; monorepo where every project dir was filtered out.
Related errors
- Cannot find module
- Cannot merge config in form of callback
- Could not find a config file based on provided values: path
- Could not resolve a module for a custom reporter. Module…
- haste.enableSymlinks is incompatible with watchman
AI-assisted analysis of jestjs/jest@8e6d128e4a (2026-08-10).
Data as JSON: /api/errors/2d82d163e21618b1.
Report an issue: GitHub.
Appendix: source
Thrown at packages/jest-config/src/index.ts:487
);
}),
);
ensureNoDuplicateConfigs(parsedConfigs, projects);
configs = parsedConfigs.map(({projectConfig}) => projectConfig);
if (!hasDeprecationWarnings) {
hasDeprecationWarnings = parsedConfigs.some(
({hasDeprecationWarnings}) => !!hasDeprecationWarnings,
);
}
// If no config was passed initially, use the one from the first project
if (!globalConfig) {
globalConfig = parsedConfigs[0].globalConfig;
}
}
if (!globalConfig || configs.length === 0) {
throw new Error('jest: No configuration found for any project.');
}
return {
configs,
globalConfig,
hasDeprecationWarnings: !!hasDeprecationWarnings,
};
}
View on GitHub (pinned to 8e6d128e4a)