All free skills / Other majors
jest-cli 30.x
Use jest-cli 30 programmatically and avoid Jest 29 CLI/API shapes.
- For
jest-cli@30.5.1- Verified
- 2026-09-08, 2 examples executed
- Skill package
@modootoday/pmcp-jest-cli@30.0.0
Use this skill for free
No PMCP login or subscription is required. Download the original instructions, or install the content-only archive with your project's package manager.
Download SKILL.md · Download package archive
npm install --save-dev https://pmcp.build/skills/jest-cli/30/package.tgz
PMCP discovers the installed package's instructions. Connect your runtime after installation.
Archive integrity
sha512-Dqoz9e9Wd3aD79gaysx4PR5ymHMSEfVJw9k9rGmViB6P9ZNLqS7dmyREJaDGENS+QZEKxQoOBwBSQ4r0tegQkg==Complete instructions
Verified against jest-cli@30.5.1 on 2026-09-08. 2 of 2 examples executed.
jest-cli 30
Surface
jest-cli exposes exactly three named exports:
buildArgv(maybeArgv?: string[]): Promise<Config.Argv>
run(maybeArgv?: string[], project?: string): Promise<void>
yargsOptions: {[key: string]: Options}
Use the package's documented exports rather than deep imports into Jest internals. Jest 30 bundles internals, so paths such as jest-runner/build/testWorker are not stable.
Parse CLI arguments with buildArgv
buildArgv asynchronously converts an argument array into Jest's parsed argument object. Pass only the arguments that would follow the jest command.
import assert from 'node:assert/strict';
import {buildArgv} from 'jest-cli';
const argv = await buildArgv(['--runInBand']);
assert.equal(argv.runInBand, true);
CLI values take precedence over configuration values when Jest runs. Flags requiring values are validated; for example, --maxWorkers and --selectProjects must be given values.
Run Jest programmatically
run starts the Jest command-line runner and resolves when the run completes:
import {run} from 'jest-cli';
await run(['--runInBand'], process.cwd());
The runner needs an actual Jest project and test-runner environment. It is not demonstrated as a standalone executable example here because the required examples run with no test files, configuration file, framework globals, filesystem setup, or network access. Ordinary jest and npm test usage is the supported runner boundary.
Programmatic users of lower-level APIs such as jest.runCLI must provide the newly required globalConfig in Jest 30. Prefer the documented jest-cli exports instead of relying on internals.
Inspect the option definitions
yargsOptions is the exported map of CLI option definitions. The package declaration does not document a complete list of keys or additional behavior.
import assert from 'node:assert/strict';
import {yargsOptions} from 'jest-cli';
assert.equal(typeof yargsOptions, 'object');
assert.notEqual(yargsOptions, null);
Jest 30 CLI changes
Rename --testPathPattern
Jest 29 code commonly uses:
jest --testPathPattern="unit/.*"
In Jest 30, use the plural option:
jest --testPathPatterns "unit/.*" "integration/.*"
Multiple patterns can be space-separated or supplied repeatedly. --testPathPattern was renamed to --testPathPatterns.
--init was removed
Do not use:
jest --init
Use the package-manager generators instead:
npm init jest@latest
yarn create jest
pnpm create jest
Filter result shape
A custom --filter implementation must return an object with an array property:
{filtered: string[]}
Returning an array directly is the older shape.
Common Jest 29-era mistakes
These changes are outside the three jest-cli exports but affect projects upgraded to Jest 30:
- Replace
expect(fn).toBeCalled()withexpect(fn).toHaveBeenCalled(); matcher aliases were removed. - Replace
jest.genMockFromModule('fs')withjest.createMockFromModule('fs');genMockFromModulewas removed. - Ensure
jest.mock()module paths use exact case. - Custom sequencers receive additional context in Jest 30.
Runtime requirements
Jest 30 requires Node 18.x or later. Node 14, 16, 19, and 21 are unsupported. The minimum TypeScript version is 5.4. jest-environment-jsdom uses JSDOM 26.
Not covered
This skill does not document the complete yargsOptions key set, Jest configuration options, test discovery, custom sequencer APIs, the detailed globalConfig shape for lower-level runner APIs, or how to construct a runnable Jest project. Those require behavior or documentation not covered by the supplied research.