{"id":"3d6e4d269695c5f7","repo":"jestjs/jest","slug":"deprecationentries-name-argv","errorCode":null,"errorMessage":"${deprecationEntries[name](argv)}","messagePattern":"\\$\\{deprecationEntries\\[name\\]\\(argv\\)\\}","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"packages/jest-validate/src/validateCLIOptions.ts","lineNumber":69,"sourceCode":"      '  Following options were not recognized:\\n' +\n      `  ${chalk.bold(format(unrecognizedOptions))}`;\n  }\n\n  return new ValidationError(title, message, comment);\n};\n\nconst validateDeprecatedOptions = (\n  deprecatedOptions: Array<DeprecationItem>,\n  deprecationEntries: DeprecatedOptions,\n  argv: Config.Argv,\n) => {\n  for (const opt of deprecatedOptions) {\n    const name = opt.name;\n    const message = deprecationEntries[name](argv);\n    const comment = DOCUMENTATION_NOTE;\n\n    if (opt.fatal) {\n      throw new ValidationError(name, message, comment);\n    } else {\n      logValidationWarning(name, message, comment);\n    }\n  }\n};\n\nexport default function validateCLIOptions(\n  argv: Config.Argv,\n  options: Record<string, Options> & {\n    deprecationEntries?: DeprecatedOptions;\n  } = {},\n  rawArgv: Array<string> = [],\n): boolean {\n  const yargsSpecialOptions = ['$0', '_', 'help', 'h'];\n\n  const allowedOptions = Object.keys(options).reduce(\n    (acc, option) =>\n      acc.add(option).add((options[option].alias as string) || option),","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/jestjs/jest/blob/f49721c78e195558b40913977c9230f5b7f559d8/packages/jest-validate/src/validateCLIOptions.ts#L51-L87","documentation":"Thrown by `validateDeprecatedOptions` (validateCLIOptions.ts:68-70) as a `ValidationError` when a deprecated CLI option is used and the option is NOT in the allowed set (i.e. `opt.fatal === true`, computed at line 107). The thrown message is whatever the deprecation-entry function returns when called with `argv` - typically 'option X has been removed, use Y instead'.","triggerScenarios":"Passing a CLI flag that has been deprecated and is no longer in the current allowed-options set. Because `opt.fatal = !allowedOptions.has(arg)`, an option removed entirely from the registered yargs options triggers the throw; one merely deprecated but still registered only logs a warning.","commonSituations":"Upgrading Jest and using a removed CLI flag (e.g. `--jasmine` after jasmine was removed, `--runInBand` spelling changes, old `--config` shapes); passing aliases that were dropped; CI scripts that pin removed flags.","solutions":["Read the message returned by the deprecation entry - it names the replacement.","Replace the removed flag with its documented successor in your CLI invocation, npm scripts, and CI config.","If unsure which flag triggered it, run with the args echoed (`node --inspect ... ` or a wrapper) and grep for the offending token.","Pin to a Jest major where the flag still works only as a stopgap; migrate before the next major."],"exampleFix":"# before: removed flag\njest --runTestsByPath some/file.test.js  # (hypothetical removed flag)\n# after\njest path/to/file.test.js","handlingStrategy":"validation","validationCode":"// Detect removed flags before invoking Jest\nconst { validateCLIOptions } = require('jest-validate');\ntry { validateCLIOptions(argv, registeredOptions, rawArgv); }\ncatch (e) { if (/ValidationError/.test(e.name)) suggestReplacement(e.message); throw e; }","typeGuard":null,"tryCatchPattern":"// Catch the validation, map to a helpful build error\ntry { runJest(args); }\ncatch (e) {\n  if (e.name === 'ValidationError' && /deprecated|removed|use instead/i.test(e.message))\n    throw new Error('CI script uses a removed Jest flag - ' + e.message);\n  throw e;\n}","preventionTips":["After a Jest major bump, grep your CI/npm scripts for flags listed in the release notes as removed.","Keep a single source of truth for the Jest CLI invocation and lint it on upgrade.","Run `jest --help` after upgrade and reconcile against your scripts."],"tags":["jest-validate","cli","deprecation","user-error"],"analyzedSha":"f49721c78e195558b40913977c9230f5b7f559d8","analyzedAt":"2026-08-03T20:16:28.571Z","schemaVersion":2}