{"id":"48db43f87bcea5f1","repo":"jestjs/jest","slug":"the-ignoreprojects-option-requires-the-name-of-a","errorCode":null,"errorMessage":"The --ignoreProjects option requires the name of at least one project to be specified.\nExample usage: jest --ignoreProjects my-first-project my-second-project","messagePattern":"The --ignoreProjects option requires the name of at least one project to be specified\\.\nExample usage: jest --ignoreProjects my-first-project my-second-project","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/jest-cli/src/args.ts","lineNumber":71,"sourceCode":"    argv.maxWorkers === undefined\n  ) {\n    throw new Error(\n      'The --maxWorkers (-w) option requires a number or string to be specified.\\n' +\n        'Example usage: jest --maxWorkers 2\\n' +\n        'Example usage: jest --maxWorkers 50%\\n' +\n        'Or did you mean --watch?',\n    );\n  }\n\n  if (argv.selectProjects && argv.selectProjects.length === 0) {\n    throw new Error(\n      'The --selectProjects option requires the name of at least one project to be specified.\\n' +\n        'Example usage: jest --selectProjects my-first-project my-second-project',\n    );\n  }\n\n  if (argv.ignoreProjects && argv.ignoreProjects.length === 0) {\n    throw new Error(\n      'The --ignoreProjects option requires the name of at least one project to be specified.\\n' +\n        'Example usage: jest --ignoreProjects my-first-project my-second-project',\n    );\n  }\n\n  if (\n    argv.config &&\n    !isJSONString(argv.config) &&\n    !new RegExp(\n      `\\\\.(${constants.JEST_CONFIG_EXT_ORDER.map(e => e.slice(1)).join('|')})$`,\n      'i',\n    ).test(argv.config)\n  ) {\n    throw new Error(\n      `The --config option requires a JSON string literal, or a file path with one of these extensions: ${constants.JEST_CONFIG_EXT_ORDER.join(\n        ', ',\n      )}.\\nExample usage: jest --config ./jest.config.js`,\n    );","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/jestjs/jest/blob/f49721c78e195558b40913977c9230f5b7f559d8/packages/jest-cli/src/args.ts#L53-L89","documentation":"Mirror of the selectProjects guard: `check` throws (packages/jest-cli/src/args.ts:70) when `--ignoreProjects` is given an empty array. ignoreProjects excludes projects by `displayName`, so at least one name must be supplied.","triggerScenarios":"`jest --ignoreProjects` with no names; dynamic name list that resolved to empty.","commonSituations":"Scripts that build an ignore list from a conditionally-empty variable; CI configs left with a placeholder.","solutions":["Pass the project display names to ignore: `jest --ignoreProjects e2e-heavy`.","Guard the call site when the list is dynamic: only add the flag when names exist.","Confirm each name matches a configured `displayName`."],"exampleFix":"# before\njest --ignoreProjects\n\n# after\njest --ignoreProjects slow-e2e integration","handlingStrategy":"validation","validationCode":"function requireIgnoreNames(names?: string[]): string[] {\n  if (!names || names.length === 0) throw new Error('--ignoreProjects needs >=1 displayName');\n  return names;\n}","typeGuard":"const hasIgnoreNames = (a: any) => Array.isArray(a.ignoreProjects) && a.ignoreProjects.length > 0;","tryCatchPattern":null,"preventionTips":["Confirm each ignored name is a real displayName.","Only add the flag when the name list is non-empty."],"tags":["jest-cli","cli-args","projects","ignoreprojects"],"analyzedSha":"f49721c78e195558b40913977c9230f5b7f559d8","analyzedAt":"2026-08-03T20:16:28.571Z","schemaVersion":2}