Skip to content

Commit

Permalink
fix: remove defensive code marked for removal (#12353)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Feb 10, 2022
1 parent 45f5a43 commit a651b65
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -23,7 +23,10 @@
- `[*]` [**BREAKING**] Drop support for `typescript@3.8`, minimum version is now `4.2` ([#11142](https://github.com/facebook/jest/pull/11142))
- `[*]` Bundle all `.d.ts` files into a single `index.d.ts` per module ([#12345](https://github.com/facebook/jest/pull/12345))
- `[expect]` [**BREAKING**] Remove support for importing `build/utils` ([#12323](https://github.com/facebook/jest/pull/12323))
- `[jest-config]` [**BREAKING**] Remove `getTestEnvironment` export ([#12353](https://github.com/facebook/jest/pull/12353))
- `[@jest/core]` Use `index.ts` instead of `jest.ts` as main export ([#12329](https://github.com/facebook/jest/pull/12329))
- `[jest-resolve]` [**BREAKING**] Make `requireResolveFunction` argument mandatory ([#12353](https://github.com/facebook/jest/pull/12353))
- `[jest-runner]` [**BREAKING**] Remove some type exports from `@jest/test-result` ([#12353](https://github.com/facebook/jest/pull/12353))
- `[jest]` Use `index.ts` instead of `jest.ts` as main export ([#12329](https://github.com/facebook/jest/pull/12329))

### Performance
Expand Down
3 changes: 0 additions & 3 deletions packages/jest-config/src/index.ts
Expand Up @@ -16,9 +16,6 @@ import readConfigFileAndSetRootDir from './readConfigFileAndSetRootDir';
import resolveConfigPath from './resolveConfigPath';
import {isJSONString, replaceRootDirInPath} from './utils';

// TODO: remove export in Jest 28
export {resolveTestEnvironment as getTestEnvironment} from 'jest-resolve';

export {isJSONString} from './utils';
export {default as normalize} from './normalize';
export {default as deprecationEntries} from './Deprecated';
Expand Down
20 changes: 8 additions & 12 deletions packages/jest-resolve/src/utils.ts
Expand Up @@ -96,12 +96,11 @@ const resolveWithPrefix = (
export const resolveTestEnvironment = ({
rootDir,
testEnvironment: filePath,
// TODO: remove default in Jest 28
requireResolveFunction = require.resolve,
requireResolveFunction,
}: {
rootDir: Config.Path;
testEnvironment: string;
requireResolveFunction?: (moduleName: string) => string;
requireResolveFunction: (moduleName: string) => string;
}): string =>
resolveWithPrefix(undefined, {
filePath,
Expand All @@ -125,12 +124,11 @@ export const resolveWatchPlugin = (
{
filePath,
rootDir,
// TODO: remove default in Jest 28
requireResolveFunction = require.resolve,
requireResolveFunction,
}: {
filePath: string;
rootDir: Config.Path;
requireResolveFunction?: (moduleName: string) => string;
requireResolveFunction: (moduleName: string) => string;
},
): string =>
resolveWithPrefix(resolver, {
Expand All @@ -155,12 +153,11 @@ export const resolveRunner = (
{
filePath,
rootDir,
// TODO: remove default in Jest 28
requireResolveFunction = require.resolve,
requireResolveFunction,
}: {
filePath: string;
rootDir: Config.Path;
requireResolveFunction?: (moduleName: string) => string;
requireResolveFunction: (moduleName: string) => string;
},
): string =>
resolveWithPrefix(resolver, {
Expand All @@ -177,12 +174,11 @@ export const resolveSequencer = (
{
filePath,
rootDir,
// TODO: remove default in Jest 28
requireResolveFunction = require.resolve,
requireResolveFunction,
}: {
filePath: string;
rootDir: Config.Path;
requireResolveFunction?: (moduleName: string) => string;
requireResolveFunction: (moduleName: string) => string;
},
): string =>
resolveWithPrefix(resolver, {
Expand Down
3 changes: 0 additions & 3 deletions packages/jest-runner/src/index.ts
Expand Up @@ -28,9 +28,6 @@ import type {
TestWatcher,
} from './types';

// TODO: remove re-export in Jest 28
export type {Test, TestFileEvent, TestEvents} from '@jest/test-result';

const TEST_WORKER_PATH = require.resolve('./testWorker');

interface WorkerInterface extends Worker {
Expand Down

0 comments on commit a651b65

Please sign in to comment.