Skip to content

Document the "official" type for what should be exported from jest.config.js #9529

Closed
@G-Rath

Description

@G-Rath

🚀 Feature Proposal

I feel a bit foolish asking this as in theory it should be somewhat obvious & easy...., but I can't figure out what type to use for the export of jest.config.js for TypeScript(-in-js) 😬

i.e with .eslintrc.js I can do:

/** @type {import('eslint').Linter.Config} */
const config = {
  ...
}

module.exports = config;

But for Jest theres a couple of different interfaces, each with their pros and cons: there's Project & Global, some with required properties, and others all optional, and then theres the normalised values...

I think it would be good to mark a type/interface as The Public Configuration Type, and put a line on the Configuring Jest page.

Motivation

This would let us be nice and type safe when configuring jest :D
It would also mean we'd not be having to use external schemas that need to be updated by third-parties.

Example

/** @type {import('jest-package').Config} */
const config = {
  ...
}

module.exports = config;

Pitch

Because it's already in the core... somewhere... 🕵

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions