Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove deprecated exports from jest-util #8863

Merged
merged 6 commits into from
Aug 22, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- `[*]` [**BREAKING**] Upgrade to Micromatch v4 ([#8852](https://github.com/facebook/jest/pull/8852))
- `[docs]` Fix broken link pointing to legacy JS file in "Snapshot Testing".
- `[jest-environment-jsdom]` [**BREAKING**] Upgrade JSDOM from v11 to v15 ([#8851](https://github.com/facebook/jest/pull/8851))
- `[jest-util]` [**BREAKING**] Remove deprecated exports ([#8863](https://github.com/facebook/jest/pull/8863))

### Performance

Expand Down
3 changes: 2 additions & 1 deletion packages/jest-core/src/runJest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as path from 'path';
import chalk from 'chalk';
import {sync as realpath} from 'realpath-native';
import {CustomConsole} from '@jest/console';
import {formatTestResults, interopRequireDefault} from 'jest-util';
import {interopRequireDefault} from 'jest-util';
import exit = require('exit');
import * as fs from 'graceful-fs';
import {JestHook, JestHookEmitter} from 'jest-watcher';
Expand All @@ -18,6 +18,7 @@ import {Test} from 'jest-runner';
import {Config} from '@jest/types';
import {
AggregatedResult,
formatTestResults,
makeEmptyAggregatedTestResult,
} from '@jest/test-result';
// eslint-disable-next-line import/no-extraneous-dependencies
Expand Down
3 changes: 2 additions & 1 deletion packages/jest-fake-timers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"dependencies": {
"@jest/types": "^24.9.0",
"jest-message-util": "^24.9.0",
"jest-mock": "^24.9.0"
"jest-mock": "^24.9.0",
"jest-util": "^24.9.0"
},
"engines": {
"node": ">= 8"
Expand Down
11 changes: 1 addition & 10 deletions packages/jest-fake-timers/src/jestFakeTimers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import {ModuleMocker} from 'jest-mock';
import {StackTraceConfig, formatStackTrace} from 'jest-message-util';
import {setGlobal} from 'jest-util';

type Callback = (...args: Array<unknown>) => void;

Expand Down Expand Up @@ -42,16 +43,6 @@ type TimerConfig<Ref> = {

const MS_IN_A_YEAR = 31536000000;

// TODO: Copied from `jest-util` to avoid cyclic dependency. Import from `jest-util` in the next major
const setGlobal = (
globalToMutate: NodeJS.Global | Window,
key: string,
value: unknown,
) => {
// @ts-ignore: no index
globalToMutate[key] = value;
};

export default class FakeTimers<TimerRef> {
private _cancelledTicks!: Record<string, boolean>;
private _config: StackTraceConfig;
Expand Down
3 changes: 2 additions & 1 deletion packages/jest-fake-timers/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"references": [
{"path": "../jest-message-util"},
{"path": "../jest-mock"}
{"path": "../jest-mock"},
{"path": "../jest-util"}
]
}
1 change: 1 addition & 0 deletions packages/jest-jasmine2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dependencies": {
"@babel/traverse": "^7.1.0",
"@jest/environment": "^24.9.0",
"@jest/source-map": "^24.9.0",
"@jest/test-result": "^24.9.0",
"@jest/types": "^24.9.0",
"chalk": "^2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {JestEnvironment} from '@jest/environment';
import {SnapshotStateType} from 'jest-snapshot';
import Runtime = require('jest-runtime');

import {getCallsite} from 'jest-util';
import {getCallsite} from '@jest/source-map';
import installEach from './each';
import {installErrorOnPrivate} from './errorOnPrivate';
import JasmineReporter from './reporter';
Expand Down
1 change: 1 addition & 0 deletions packages/jest-jasmine2/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
{"path": "../jest-message-util"},
{"path": "../jest-runtime"},
{"path": "../jest-snapshot"},
{"path": "../jest-source-map"},
{"path": "../jest-test-result"},
{"path": "../jest-types"},
{"path": "../jest-util"},
Expand Down
1 change: 1 addition & 0 deletions packages/jest-reporters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "build/index.js",
"types": "build/index.d.ts",
"dependencies": {
"@jest/console": "^24.9.0",
"@jest/environment": "^24.9.0",
"@jest/test-result": "^24.9.0",
"@jest/transform": "^24.9.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/jest-reporters/src/default_reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

import {Config} from '@jest/types';
import {AggregatedResult, TestResult} from '@jest/test-result';
import {clearLine, getConsoleOutput, isInteractive} from 'jest-util';
import {clearLine, isInteractive} from 'jest-util';
import {getConsoleOutput} from '@jest/console';
import chalk from 'chalk';
import {ReporterOnStartOptions, Test} from './types';
import BaseReporter from './base_reporter';
Expand Down
1 change: 1 addition & 0 deletions packages/jest-reporters/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"outDir": "build"
},
"references": [
{"path": "../jest-console"},
{"path": "../jest-environment"},
{"path": "../jest-haste-map"},
{"path": "../jest-resolve"},
Expand Down
10 changes: 1 addition & 9 deletions packages/jest-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,10 @@
"main": "build/index.js",
"types": "build/index.d.ts",
"dependencies": {
"@jest/console": "^24.9.0",
"@jest/fake-timers": "^24.9.0",
"@jest/source-map": "^24.9.0",
"@jest/test-result": "^24.9.0",
"@jest/types": "^24.9.0",
"callsites": "^3.0.0",
"chalk": "^2.0.1",
"graceful-fs": "^4.1.15",
"is-ci": "^2.0.0",
"mkdirp": "^0.5.1",
"slash": "^3.0.0",
"source-map": "^0.6.0"
"mkdirp": "^0.5.1"
},
"devDependencies": {
"@types/graceful-fs": "^4.1.2",
Expand Down
72 changes: 0 additions & 72 deletions packages/jest-util/src/__tests__/getFailedSnapshot.test.ts

This file was deleted.

26 changes: 0 additions & 26 deletions packages/jest-util/src/getFailedSnapshotTests.ts

This file was deleted.

21 changes: 1 addition & 20 deletions packages/jest-util/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,9 @@
* LICENSE file in the root directory of this source tree.
*/

// TODO: Remove these exports in the next major
import {JestFakeTimers as FakeTimers} from '@jest/fake-timers';
import {getCallsite} from '@jest/source-map';
import {
BufferedConsole,
CustomConsole,
NullConsole,
getConsoleOutput,
} from '@jest/console';
import {formatTestResults} from '@jest/test-result';
import clearLine from './clearLine';
import createDirectory from './createDirectory';
import ErrorWithStack from './ErrorWithStack';
import getFailedSnapshotTests from './getFailedSnapshotTests';
import installCommonGlobals from './installCommonGlobals';
import interopRequireDefault from './interopRequireDefault';
import isInteractive from './isInteractive';
Expand All @@ -32,20 +21,12 @@ import testPathPatternToRegExp from './testPathPatternToRegExp';
import * as preRunMessage from './preRunMessage';
import pluralize from './pluralize';

export = {
BufferedConsole,
Console: CustomConsole,
export {
ErrorWithStack,
FakeTimers,
NullConsole,
clearLine,
convertDescriptorToString,
createDirectory,
deepCyclicCopy,
formatTestResults,
getCallsite,
getConsoleOutput,
getFailedSnapshotTests,
installCommonGlobals,
interopRequireDefault,
isInteractive,
Expand Down
4 changes: 0 additions & 4 deletions packages/jest-util/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"outDir": "build"
},
"references": [
{"path": "../jest-console"},
{"path": "../jest-fake-timers"},
{"path": "../jest-source-map"},
{"path": "../jest-test-result"},
{"path": "../jest-types"}
]
}