jestjs/jest

Expose project matching behaviour

开放

#11,171 创建于 2021年3月8日

 (2 条评论) (0 个反应) (0 位负责人)TypeScript (6,653 个派生)batch import
:rocket: Feature RequestHelp WantedPinned

仓库指标

星标
 (45,361 个星标)
PR 合并指标
 (平均合并 11天 22小时) (30 天内合并 11 个 PR)

描述

🚀 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.

贡献者指南