Skip to content

Add an option for config file path in package.json #8134

Closed
@DavidBabel

Description

@DavidBabel

🚀 Feature Proposal

For now, when we want to configure jest we have three choices :

  • put the jest config in package.json
  • put the jest config in jest.config.js at root
    In both this previous choices, you can easily run your tests with a simple jest command.
  • put the jest config in whatYouWant.js anywhere in your project
    With this last choice you have to run jest -c ./path/to/whatYouWant.js

Motivation

The idea is to run a simple jest command in any of the three cases.

Example

The idea should be to add a new option in package.json. It may be something like defaultConfigFile:

{
  "name": "myModule",
  "jest" : {
    "defaultConfigFile": "./path/to/whatYouWant.js"
  }
}

In this case, it's the only option in package.json, which override the default config file search at root. The rest of the config stays in your whatYouWant.js

Pitch

Why does this feature belong in the Jest core platform?

Because it's a native configuration proposal.

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