{"record":{"id":"2d82d163e21618b1","repo":"jestjs/jest","slug":"jest-no-configuration-found-for-any-project","errorCode":null,"errorMessage":"jest: No configuration found for any project.","messagePattern":"jest: No configuration found for any project\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/jest-config/src/index.ts","lineNumber":487,"sourceCode":"          );\n        }),\n    );\n\n    ensureNoDuplicateConfigs(parsedConfigs, projects);\n    configs = parsedConfigs.map(({projectConfig}) => projectConfig);\n    if (!hasDeprecationWarnings) {\n      hasDeprecationWarnings = parsedConfigs.some(\n        ({hasDeprecationWarnings}) => !!hasDeprecationWarnings,\n      );\n    }\n    // If no config was passed initially, use the one from the first project\n    if (!globalConfig) {\n      globalConfig = parsedConfigs[0].globalConfig;\n    }\n  }\n\n  if (!globalConfig || configs.length === 0) {\n    throw new Error('jest: No configuration found for any project.');\n  }\n\n  return {\n    configs,\n    globalConfig,\n    hasDeprecationWarnings: !!hasDeprecationWarnings,\n  };\n}\n","sourceCodeStart":469,"sourceCodeEnd":496,"githubUrl":"https://github.com/jestjs/jest/blob/8e6d128e4a278059ecddecaa97400b04c8ae5fd9/packages/jest-config/src/index.ts#L469-L496","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before: no jest config present\n// after: create jest.config.js\nmodule.exports = { testEnvironment: 'node' };","handlingStrategy":"validation","validationCode":"import * as fs from 'node:fs';\nimport * as path from 'node:path';\nconst EXTS = ['.js','.ts','.mjs','.cjs','.json','.mts','.cts'];\nfunction ensureJestConfigExists(root: string): void {\n  const hasFile = EXTS.some(e => fs.existsSync(path.join(root, `jest.config${e}`)));\n  const pkgJson = fs.existsSync(path.join(root, 'package.json')) ? require(path.join(root,'package.json')) : {};\n  if (!hasFile && !pkgJson.jest) {\n    throw new Error('No jest config found; create jest.config.js or add a jest key to package.json');\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const { globalConfig, configs } = await readConfigs(argv, projectPaths);\n  // ...\n} catch (e) {\n  if ((e as Error).message.includes('No configuration found')) {\n    console.error('No Jest config: run `npx jest --init` or add one.');\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["jest-config","readconfigs","missing-config","bootstrap"],"backgroundTag":null,"analyzedSha":"8e6d128e4a278059ecddecaa97400b04c8ae5fd9","analyzedAt":"2026-08-10T18:11:27.960Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}