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

Use named import from pretty-format, not default #11360

Merged
merged 2 commits into from Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -89,6 +89,7 @@
- `[pretty-format]` [**BREAKING**] Convert to ES Modules ([#10515](https://github.com/facebook/jest/pull/10515))
- `[pretty-format]` Only call `hasAttribute` if it's a function ([#11000](https://github.com/facebook/jest/pull/11000))
- `[pretty-format]` Handle jsdom attributes properly ([#11189](https://github.com/facebook/jest/pull/11189))
- `[pretty-format]` Import pretty-format using named imports ([#11360](https://github.com/facebook/jest/pull/11360))

### Chore & Maintenance

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-circus/src/formatNodeAssertErrors.ts
Expand Up @@ -14,7 +14,7 @@ import {
printExpected,
printReceived,
} from 'jest-matcher-utils';
import prettyFormat from 'pretty-format';
import {format as prettyFormat} from 'pretty-format';

interface AssertionErrorWithStack extends AssertionError {
stack: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-circus/src/utils.ts
Expand Up @@ -14,7 +14,7 @@ import StackUtils = require('stack-utils');
import type {AssertionResult, Status} from '@jest/test-result';
import type {Circus, Global} from '@jest/types';
import {ErrorWithStack, convertDescriptorToString, formatTime} from 'jest-util';
import prettyFormat from 'pretty-format';
import {format as prettyFormat} from 'pretty-format';
import {ROOT_DESCRIBE_BLOCK_NAME, getState} from './state';

const stackUtils = new StackUtils({cwd: 'A path that does not exist'});
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/Deprecated.ts
Expand Up @@ -7,7 +7,7 @@

import chalk = require('chalk');
import type {DeprecatedOptions} from 'jest-validate';
import prettyFormat from 'pretty-format';
import {format as prettyFormat} from 'pretty-format';

const format = (value: unknown) => prettyFormat(value, {min: true});

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/src/runGlobalHook.ts
Expand Up @@ -12,7 +12,7 @@ import {createScriptTransformer} from '@jest/transform';
import type {Config} from '@jest/types';
import type {Test} from 'jest-runner';
import {interopRequireDefault} from 'jest-util';
import prettyFormat from 'pretty-format';
import {format as prettyFormat} from 'pretty-format';

export default async ({
allTests,
Expand Down
5 changes: 4 additions & 1 deletion packages/jest-diff/src/index.ts
Expand Up @@ -7,7 +7,10 @@

import chalk = require('chalk');
import {getType} from 'jest-get-type';
import prettyFormat, {plugins as prettyFormatPlugins} from 'pretty-format';
import {
format as prettyFormat,
plugins as prettyFormatPlugins,
} from 'pretty-format';
import {DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff} from './cleanupSemantic';
import {NO_DIFF_MESSAGE, SIMILAR_MESSAGE} from './constants';
import {diffLinesRaw, diffLinesUnified, diffLinesUnified2} from './diffLines';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-each/src/table/array.ts
Expand Up @@ -8,7 +8,7 @@

import * as util from 'util';
import type {Global} from '@jest/types';
import pretty from 'pretty-format';
import {format as pretty} from 'pretty-format';
import type {EachTests} from '../bind';

const SUPPORTED_PLACEHOLDERS = /%[sdifjoOp%]/g;
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-each/src/table/template.ts
Expand Up @@ -8,7 +8,7 @@

import type {Global} from '@jest/types';
import {isPrimitive} from 'jest-get-type';
import pretty from 'pretty-format';
import {format as pretty} from 'pretty-format';
import type {EachTests} from '../bind';

type Template = Record<string, unknown>;
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-each/src/validation.ts
Expand Up @@ -8,7 +8,7 @@

import chalk = require('chalk');
import type {Global} from '@jest/types';
import pretty from 'pretty-format';
import {format as pretty} from 'pretty-format';

type TemplateData = Global.TemplateData;

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/expectationResultFactory.ts
Expand Up @@ -6,7 +6,7 @@
*/

import type {FailedAssertion} from '@jest/test-result';
import prettyFormat from 'pretty-format';
import {format as prettyFormat} from 'pretty-format';

function messageFormatter({error, message, passed}: Options) {
if (passed) {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/isError.ts
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import prettyFormat from 'pretty-format';
import {format as prettyFormat} from 'pretty-format';

export default function isError(
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-leak-detector/src/index.ts
Expand Up @@ -11,7 +11,7 @@ import {promisify} from 'util';
import {setFlagsFromString} from 'v8';
import {runInNewContext} from 'vm';
import {isPrimitive} from 'jest-get-type';
import prettyFormat from 'pretty-format';
import {format as prettyFormat} from 'pretty-format';

const tick = promisify(setImmediate);

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-matcher-utils/src/__tests__/index.test.ts
Expand Up @@ -8,7 +8,7 @@

import chalk = require('chalk');
import {alignedAnsiStyleSerializer} from '@jest/test-utils';
import prettyFormat from 'pretty-format';
import {format as prettyFormat} from 'pretty-format';
import {
MatcherHintOptions,
diff,
Expand Down
5 changes: 4 additions & 1 deletion packages/jest-matcher-utils/src/index.ts
Expand Up @@ -18,7 +18,10 @@ import diffDefault, {
diffStringsUnified,
} from 'jest-diff';
import {getType, isPrimitive} from 'jest-get-type';
import prettyFormat, {plugins as prettyFormatPlugins} from 'pretty-format';
import {
format as prettyFormat,
plugins as prettyFormatPlugins,
} from 'pretty-format';
import Replaceable from './Replaceable';
import deepCyclicCopyReplaceable from './deepCyclicCopyReplaceable';

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-message-util/src/index.ts
Expand Up @@ -13,7 +13,7 @@ import micromatch = require('micromatch');
import slash = require('slash');
import StackUtils = require('stack-utils');
import type {Config, TestResult} from '@jest/types';
import prettyFormat from 'pretty-format';
import {format as prettyFormat} from 'pretty-format';
import type {Frame} from './types';

export type {Frame} from './types';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-serializer/src/__tests__/index.test.ts
Expand Up @@ -8,7 +8,7 @@
import {tmpdir} from 'os';
import * as path from 'path';
import * as fs from 'graceful-fs';
import prettyFormat from 'pretty-format';
import {format as prettyFormat} from 'pretty-format';
import serializer from '..';

const objs = [
Expand Down
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import prettyFormat from 'pretty-format';
import {format as prettyFormat} from 'pretty-format';
import plugin from '../mockSerializer';

test('mock with 0 calls and default name', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-snapshot/src/printSnapshot.ts
Expand Up @@ -34,7 +34,7 @@ import {
getLabelPrinter,
matcherHint,
} from 'jest-matcher-utils';
import prettyFormat from 'pretty-format';
import {format as prettyFormat} from 'pretty-format';
import {
aBackground2,
aBackground3,
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-snapshot/src/utils.ts
Expand Up @@ -10,7 +10,7 @@ import chalk = require('chalk');
import * as fs from 'graceful-fs';
import naturalCompare = require('natural-compare');
import type {Config} from '@jest/types';
import prettyFormat from 'pretty-format';
import {format as prettyFormat} from 'pretty-format';
import {getSerializers} from './plugins';
import type {SnapshotData} from './types';

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-validate/src/utils.ts
Expand Up @@ -7,7 +7,7 @@

import chalk = require('chalk');
import leven from 'leven';
import prettyFormat from 'pretty-format';
import {format as prettyFormat} from 'pretty-format';

const BULLET: string = chalk.bold('\u25cf');
export const DEPRECATION = `${BULLET} Deprecation Warning`;
Expand Down