jestjs/jest · error · Error
jest: No configuration found for any project.
Error message
jest: No configuration found for any project.
What it means
At the end of `readConfigs` (packages/jest-config/src/index.ts:479), if no project produced a globalConfig and no projectConfig was collected, Jest throws 'No configuration found for any project.' This means none of the project paths/cwd yielded a loadable Jest config.
Source
Thrown at packages/jest-config/src/index.ts:480
);
}),
);
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 f49721c78e)
Solutions
- Create a jest.config.js (or .ts/.mjs/.cjs/.json) in the project root, or add a `"jest"` field to package.json.
- Verify you are running Jest from the directory that contains (or is above) the config.
- Check that `--projects` paths exist and are directories or valid config files.
Example fix
// before: no config anywhere, jest fails to start
// 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';
import {constants} from 'jest-config';
function hasJestConfig(dir: string): boolean {
if (fs.existsSync(path.join(dir, 'package.json')) && JSON.parse(fs.readFileSync(path.join(dir,'package.json'),'utf8')).jest) return true;
return constants.JEST_CONFIG_EXT_ORDER.some(ext => fs.existsSync(path.join(dir, `jest.config${ext}`)));
} Type guard
const configExists = (dir: string) => {
try { return hasJestConfig(dir); } catch { return false; }
}; Prevention
- Always ship a jest.config.* (or package.json jest field) in the project root.
- Run Jest from the directory containing the config.
- In monorepos, ensure each runnable package resolves to a config.
When it happens
Trigger: Running `jest` in a directory with no jest.config.* and no `jest` field in package.json; all project paths were filtered out (e.g. glob matched nothing or only non-config files); passing `--projects` pointing at non-existent directories.
Common situations: Fresh project that hasn't added Jest config yet; running from the wrong working directory; CI that checks out a sub-tree without the root config; all listed projects filtered by the 'ignore non-config, non-directory' filter at index.ts:434.
Related errors
- Whoops! Two projects resolved to the same config path: ${Str
- Cannot merge config in form of callback
- Jest: Cannot use configuration as an object without a file p
- There was an error while parsing the `--config` argument as
- Cannot find module '${presetPath}'
AI-assisted analysis of jestjs/jest@f49721c78e (2026-08-03).
Data as JSON: /data/errors/2d82d163e21618b1.json.
Report an issue: GitHub.