jestjs/jest

Expose project matching behaviour

Open

#11.171 geöffnet am 8. März 2021

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (6.653 Forks)batch import
:rocket: Feature RequestHelp WantedPinned

Repository-Metriken

Stars
 (45.361 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 11T 22h) (11 gemergte PRs in 30 T)

Beschreibung

🚀 Feature Proposal

Expose the logic that determines what project a file belongs to. Given a file path and a Jest configuration, what options apply?

Motivation

To allow third-party tools to understand Jest configurations. E.g: https://github.com/jest-community/eslint-plugin-jest/pull/754#issuecomment-780396777

Example

I am not sure what package this logic currently resides in, but something along the lines of:

import { resolveOptions } from '@jest/options';
import { readConfig } from '@jest/config';

const config = await readConfig('/path/to/jest.config.js');
const options = await resolveOptions('/path/to/unit.test.js', config);

Pitch

The projects logic is very specific to Jest, and recreating it externally would likely be erroneous and fall out-of-date quickly.

Contributor Guide