Skip to content

Allow configuration objects in "projects" #5174

@azz

Description

@azz

Do you want to request a feature or report a bug?

Feature.


A pattern I have been repeating recently is using the "projects" feature to run many runners in the same build. To do this I do:

package.json:

{
  "jest": {
    "projects": ["jest.*.config.js"]
  }
}

jest.eslint.config.js:

module.exports = {
  runner: "jest-runner-eslint",
  displayName: "lint",
  // ...
};

jest.test.config.js:

module.exports = {
  displayName: "test",
  // ...
};

This all works fine but it is a bit annoying having three config sources. What I propose is the ability to pass configuration objects instead of paths in the "projects" array.

For example, we could express all three of the above configuration components with one file:

jest.config.js:

const lint = {
  runner: "jest-runner-eslint",
  displayName: "lint",
  // ...
};

const test =  {
  displayName: "test",
  // ...
};

module.exports = {
  projects: [lint, test]
}

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