Skip to content

Commit 199f981

Browse files
authored
chore: remove Path and Glob (#12406)
1 parent 4f4538c commit 199f981

File tree

86 files changed

+401
-490
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+401
-490
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
- `[jest-serializer]` [**BREAKING**] Deprecate package in favour of using `v8` APIs directly ([#12391](https://github.com/facebook/jest/pull/12391))
4949
- `[jest-snapshot]` [**BREAKING**] Migrate to ESM ([#12342](https://github.com/facebook/jest/pull/12342))
5050
- `[jest-transform]` Update `write-file-atomic` to v4 ([#12357](https://github.com/facebook/jest/pull/12357))
51+
- `[jest-types]` [**BREAKING**] Remove `Config.Glob` and `Config.Path` ([#12406](https://github.com/facebook/jest/pull/12406))
5152
- `[jest]` Use `index.ts` instead of `jest.ts` as main export ([#12329](https://github.com/facebook/jest/pull/12329))
5253

5354
### Performance

e2e/Utils.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface RunResult extends ExecaReturnValue {
2020
}
2121
export const run = (
2222
cmd: string,
23-
cwd?: Config.Path,
23+
cwd?: string,
2424
env?: Record<string, string>,
2525
): RunResult => {
2626
const args = cmd.split(/\s/).slice(1);
@@ -44,10 +44,7 @@ export const run = (
4444
return result;
4545
};
4646

47-
export const runYarnInstall = (
48-
cwd: Config.Path,
49-
env?: Record<string, string>,
50-
) => {
47+
export const runYarnInstall = (cwd: string, env?: Record<string, string>) => {
5148
const lockfilePath = path.resolve(cwd, 'yarn.lock');
5249
let exists = true;
5350

@@ -60,7 +57,7 @@ export const runYarnInstall = (
6057
return run(exists ? 'yarn install --immutable' : 'yarn install', cwd, env);
6158
};
6259

63-
export const linkJestPackage = (packageName: string, cwd: Config.Path) => {
60+
export const linkJestPackage = (packageName: string, cwd: string) => {
6461
const packagesDir = path.resolve(__dirname, '../packages');
6562
const packagePath = path.resolve(packagesDir, packageName);
6663
const destination = path.resolve(cwd, 'node_modules/', packageName);
@@ -182,7 +179,7 @@ const DEFAULT_PACKAGE_JSON: JestPackageJson = {
182179
};
183180

184181
export const createEmptyPackage = (
185-
directory: Config.Path,
182+
directory: string,
186183
packageJson: PackageJson = DEFAULT_PACKAGE_JSON,
187184
) => {
188185
const packageJsonWithDefaults = {

packages/babel-jest/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
},
2020
"dependencies": {
2121
"@jest/transform": "^28.0.0-alpha.1",
22-
"@jest/types": "^28.0.0-alpha.1",
2322
"@types/babel__core": "^7.1.14",
2423
"babel-plugin-istanbul": "^6.1.1",
2524
"babel-preset-jest": "^28.0.0-alpha.0",

packages/babel-jest/src/index.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import type {
2020
TransformOptions as JestTransformOptions,
2121
SyncTransformer,
2222
} from '@jest/transform';
23-
import type {Config} from '@jest/types';
2423
import {loadPartialConfig, loadPartialConfigAsync} from './loadBabelConfig';
2524

2625
const THIS_FILE = fs.readFileSync(__filename);
@@ -31,8 +30,8 @@ type CreateTransformer = SyncTransformer<TransformOptions>['createTransformer'];
3130

3231
function assertLoadedBabelConfig(
3332
babelConfig: Readonly<PartialConfig> | null,
34-
cwd: Config.Path,
35-
filename: Config.Path,
33+
cwd: string,
34+
filename: string,
3635
): asserts babelConfig {
3736
if (!babelConfig) {
3837
throw new Error(
@@ -72,7 +71,7 @@ function addIstanbulInstrumentation(
7271

7372
function getCacheKeyFromConfig(
7473
sourceText: string,
75-
sourcePath: Config.Path,
74+
sourcePath: string,
7675
babelOptions: PartialConfig,
7776
transformOptions: JestTransformOptions,
7877
): string {
@@ -104,8 +103,8 @@ function getCacheKeyFromConfig(
104103
}
105104

106105
function loadBabelConfig(
107-
cwd: Config.Path,
108-
filename: Config.Path,
106+
cwd: string,
107+
filename: string,
109108
transformOptions: TransformOptions,
110109
): PartialConfig {
111110
const babelConfig = loadPartialConfig(transformOptions);
@@ -116,8 +115,8 @@ function loadBabelConfig(
116115
}
117116

118117
async function loadBabelConfigAsync(
119-
cwd: Config.Path,
120-
filename: Config.Path,
118+
cwd: string,
119+
filename: string,
121120
transformOptions: TransformOptions,
122121
): Promise<PartialConfig> {
123122
const babelConfig = await loadPartialConfigAsync(transformOptions);
@@ -128,8 +127,8 @@ async function loadBabelConfigAsync(
128127
}
129128

130129
function loadBabelOptions(
131-
cwd: Config.Path,
132-
filename: Config.Path,
130+
cwd: string,
131+
filename: string,
133132
transformOptions: TransformOptions,
134133
jestTransformOptions: JestTransformOptions,
135134
): TransformOptions {
@@ -139,8 +138,8 @@ function loadBabelOptions(
139138
}
140139

141140
async function loadBabelOptionsAsync(
142-
cwd: Config.Path,
143-
filename: Config.Path,
141+
cwd: string,
142+
filename: string,
144143
transformOptions: TransformOptions,
145144
jestTransformOptions: JestTransformOptions,
146145
): Promise<TransformOptions> {
@@ -169,7 +168,7 @@ export const createTransformer: CreateTransformer = userOptions => {
169168
} as const;
170169

171170
function mergeBabelTransformOptions(
172-
filename: Config.Path,
171+
filename: string,
173172
transformOptions: JestTransformOptions,
174173
): TransformOptions {
175174
const {cwd} = transformOptions.config;

packages/babel-jest/tsconfig.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,5 @@
77
"include": ["./src/**/*"],
88
"exclude": ["./**/__tests__/**/*"],
99
// TODO: include `babel-preset-jest` if it's ever in TS even though we don't care about its types
10-
"references": [
11-
{"path": "../jest-transform"},
12-
{"path": "../jest-types"},
13-
{"path": "../test-utils"}
14-
]
10+
"references": [{"path": "../jest-transform"}, {"path": "../test-utils"}]
1511
}

packages/expect/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
},
2020
"dependencies": {
2121
"@jest/expect-utils": "^28.0.0-alpha.1",
22-
"@jest/types": "^28.0.0-alpha.1",
2322
"jest-get-type": "^28.0.0-alpha.0",
2423
"jest-matcher-utils": "^28.0.0-alpha.1",
2524
"jest-message-util": "^28.0.0-alpha.1"

packages/expect/src/types.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88

99
import type {EqualsFunction, Tester} from '@jest/expect-utils';
10-
import type {Config} from '@jest/types';
1110
import type * as jestMatcherUtils from 'jest-matcher-utils';
1211
import {INTERNAL_MATCHER_FLAG} from './jestMatchersObject';
1312

@@ -56,7 +55,7 @@ export interface MatcherState {
5655
isNot: boolean;
5756
promise: string;
5857
suppressedErrors: Array<Error>;
59-
testPath?: Config.Path;
58+
testPath?: string;
6059
utils: typeof jestMatcherUtils & {
6160
iterableEquality: Tester;
6261
subsetEquality: Tester;

packages/expect/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
{"path": "../jest-get-type"},
1212
{"path": "../jest-matcher-utils"},
1313
{"path": "../jest-message-util"},
14-
{"path": "../jest-types"},
1514
{"path": "../test-utils"}
1615
]
1716
}

packages/jest-changed-files/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"./package.json": "./package.json"
1818
},
1919
"dependencies": {
20-
"@jest/types": "^28.0.0-alpha.1",
2120
"execa": "^5.0.0",
2221
"throat": "^6.0.1"
2322
},

packages/jest-changed-files/src/git.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88

99
import * as path from 'path';
1010
import execa = require('execa');
11-
import type {Config} from '@jest/types';
1211
import type {SCMAdapter} from './types';
1312

1413
const findChangedFilesUsingCommand = async (
1514
args: Array<string>,
16-
cwd: Config.Path,
17-
): Promise<Array<Config.Path>> => {
15+
cwd: string,
16+
): Promise<Array<string>> => {
1817
let result: execa.ExecaReturnValue;
1918

2019
try {

0 commit comments

Comments
 (0)