Jest Config Generator Prompt

Generate a version-compatible Jest configuration from supplied project structure, runtime, modules, transforms, test environments, aliases, coverage, and validation evidence.

Prompt Template

You are a senior JavaScript test-tooling engineer generating the smallest maintainable Jest configuration only from the repository facts, installed versions, runtime, module mode, transforms, framework, test environments, aliases, setup files, mocks, coverage rules, and validation output I provide. First determine from dated official documentation and the installed toolchain whether the project needs a Jest config, a framework-owned adapter, a package-level config, or no custom config. Treat ESM and CommonJS, JavaScript and TypeScript transforms, JSX, browser and server environments, monorepo projects, path aliases, asset mocks, setup hooks, test discovery, coverage, fake timers, and watch behavior as separate compatibility constraints. Never invent package versions, presets, transformers, config keys, paths, regexes, defaults, environment packages, compatibility claims, or passing tests.

Project purpose and framework: [details]
Sanitized repository tree and test locations: [paste]
Package manager, workspace layout, and package boundary: [details]
Exact runtime, Jest, framework adapter, transformer, TypeScript, and compiler versions: [verified versions or unknown]
Package module mode and config-file extensions allowed: [ESM, CommonJS, mixed, unknown]
Source syntax and file extensions: [details]
Existing Jest, framework, compiler, bundler, and type configuration: [paste sanitized content or none]
Test types and environments: [unit, integration, DOM, Node, other]
Current test matching and ignored paths: [details]
Aliases, package exports, module directories, and resolver behavior: [details]
Transforms and which tool owns each one: [details or unknown]
Setup files, global hooks, fixtures, and custom environments: [details]
Static assets, styles, native modules, and third-party packages needing mocks or transformation: [details]
Coverage include, exclude, thresholds, provider, and output requirements: [verified policy]
Monorepo projects, shared presets, and per-package differences: [details or none]
Development, test, coverage, watch, type-check, and CI commands: [details]
Exact sanitized error or failing import evidence: [paste]
Security and privacy boundary: [no secrets, private registry tokens, proprietary source, customer data, or internal URLs]
Validation available: [showConfig, listTests, focused test, full suite, coverage, CI]
Output scope: [minimal config, migration, monorepo projects, troubleshooting]

Provide:
1. An assumptions table marking every version, path, environment, transform, alias, setup file, mock, pattern, and coverage rule as verified, inferred, or unknown.
2. A recommendation for config-file, framework adapter, shared preset, per-project config, or no-custom-config setup, citing the supplied dated official documentation.
3. Complete minimal content for only the required config and setup files, using version-supported syntax and placeholders for unresolved values.
4. A test-discovery map showing included tests, ignored outputs, fixtures, generated files, integration tests, and monorepo boundaries.
5. A module and transform matrix for ESM, CommonJS, JavaScript, TypeScript, JSX, aliases, assets, styles, and selected third-party packages, with one owner per transformation.
6. An environment and setup map explaining Node, DOM, custom environments, setup timing, global hooks, isolation, and teardown.
7. A coverage plan that implements only the supplied include, exclude, provider, reporter, and threshold policy without hiding untested code.
8. Version-appropriate validation commands for effective config, discovered tests, one representative test, full suite, open-handle diagnosis when needed, coverage, and CI.
9. A final audit for unsupported keys, module-mode mismatch, duplicate transforms, broad ignore patterns, hidden coverage gaps, leaked globals, stale caches, secret exposure, and claims not backed by output.

Do not install packages, overwrite framework-owned configuration, weaken tests or coverage to make a suite pass, expose private source or tokens, or claim success without running the available validation.

Example Output

Verified Inputs

The supplied package has exact runtime and Jest versions, a confirmed CommonJS package mode, JavaScript source, Node unit tests, one verified alias, and an existing test command. TypeScript, JSX, browser APIs, custom transforms, global setup, asset mocks, coverage thresholds, and monorepo projects remain unverified.

Recommended Shape

Use one minimal package-level Jest config only if the supplied runner does not already own configuration. Set the verified Node environment, include the confirmed test locations, map only the supplied alias, and omit transforms, browser shims, setup files, mocks, reporters, and thresholds until their need and versions are demonstrated.

Validation Boundary

Print the effective config, list discovered tests, run one representative test, run the full suite, then collect coverage and reproduce the same commands in CI. A config that parses does not prove discovery, module loading, isolation, or teardown.

Tips for Best Results

  • ๐Ÿ’กProvide exact Jest, runtime, transformer, TypeScript, framework-adapter, and environment-package versions.
  • ๐Ÿ’กShow the real module mode, aliases, test paths, and failing import so the config does not rely on broad patterns.
  • ๐Ÿ’กValidate the effective config, discovered tests, representative imports, full suite, coverage, and CI separately.

Frequently Asked Questions

What is the Jest Config Generator Prompt prompt?

Generate a version-compatible Jest configuration from supplied project structure, runtime, modules, transforms, test environments, aliases, coverage, and validation evidence. It's a free ChatGPT prompt template from our Coding collection โ€” copy it, fill in the bracketed variables, and paste it into your AI tool.

Which AI tools work with this prompt?

It's written and tested for ChatGPT, Claude and Gemini. Any AI assistant that accepts free-form text prompts will handle it well.

How do I customize this ChatGPT prompt?

Replace the bracketed variables โ€” such as [details], [paste], [verified versions or unknown] โ€” with your own details before running it. Provide exact Jest, runtime, transformer, TypeScript, framework-adapter, and environment-package versions.

Is this prompt free to use?

Yes. Every prompt on PromptAtlas is free to copy, customize, and use โ€” no signup required.