jestjs/jest · error · Error

The --ignoreProjects option requires the name of at least…

Error message

The --ignoreProjects option requires the name of at least one project to be specified.
Example usage: jest --ignoreProjects my-first-project my-second-project

What it means

Symmetric to --selectProjects, check() requires --ignoreProjects (args.ts:70-75) be given at least one project displayName. The flag filters projects OUT of the run; an empty list is meaningless, so Jest rejects it immediately.

Solutions

  1. Pass at least one project displayName: jest --ignoreProjects my-first-project.
  2. Verify the displayName of each project you intend to ignore matches what's in the config.
  3. When the ignore list is dynamic and empty, omit the flag entirely instead of passing --ignoreProjects.

Example fix

// before
jest --ignoreProjects
// after
jest --ignoreProjects my-first-project my-second-project
Defensive patterns

Strategy: validation

Validate before calling

function ignoreProjectsArg(names: string[]): string[] {
  if (names.length === 0) throw new Error('--ignoreProjects needs >= 1 name');
  return ['--ignoreProjects', ...names];
}

Type guard

function isNonEmptyStringArray(v: unknown): v is string[] {
  return Array.isArray(v) && v.length > 0 && v.every(x => typeof x === 'string');
}

Prevention

When it happens

Trigger: Running jest --ignoreProjects with no names; an empty interpolation in a script; CI matrix computing an ignore list that came up empty.

Common situations: Excluding a noisy project conditionally where the condition produced no names; aliasing selectProjects/ignoreProjects incorrectly; copy-paste from docs without args.

Related errors


AI-assisted analysis of jestjs/jest@8e6d128e4a (2026-08-10). Data as JSON: /api/errors/48db43f87bcea5f1. Report an issue: GitHub.

Appendix: source

Thrown at packages/jest-cli/src/args.ts:71

    argv.maxWorkers === undefined
  ) {
    throw new Error(
      'The --maxWorkers (-w) option requires a number or string to be specified.\n' +
        'Example usage: jest --maxWorkers 2\n' +
        'Example usage: jest --maxWorkers 50%\n' +
        'Or did you mean --watch?',
    );
  }

  if (argv.selectProjects && argv.selectProjects.length === 0) {
    throw new Error(
      'The --selectProjects option requires the name of at least one project to be specified.\n' +
        'Example usage: jest --selectProjects my-first-project my-second-project',
    );
  }

  if (argv.ignoreProjects && argv.ignoreProjects.length === 0) {
    throw new Error(
      'The --ignoreProjects option requires the name of at least one project to be specified.\n' +
        'Example usage: jest --ignoreProjects my-first-project my-second-project',
    );
  }

  if (
    argv.config &&
    !isJSONString(argv.config) &&
    !new RegExp(
      `\\.(${constants.JEST_CONFIG_EXT_ORDER.map(e => e.slice(1)).join('|')})$`,
      'i',
    ).test(argv.config)
  ) {
    throw new Error(
      `The --config option requires a JSON string literal, or a file path with one of these extensions: ${constants.JEST_CONFIG_EXT_ORDER.join(
        ', ',
      )}.\nExample usage: jest --config ./jest.config.js`,
    );

View on GitHub (pinned to 8e6d128e4a)