mirror of https://github.com/facebook/jest.git
Stop using `import X = require('…')`. (#15659)
This commit is contained in:
parent
8fcefef178
commit
a2218e4f79
|
@ -16,11 +16,6 @@ module.exports = {
|
|||
exclude: /react-native/,
|
||||
overrides: [
|
||||
{
|
||||
plugins: [
|
||||
require.resolve(
|
||||
'./scripts/babel-plugin-jest-replace-ts-require-assignment.js',
|
||||
),
|
||||
],
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-typescript',
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
sync as spawnSync,
|
||||
} from 'execa';
|
||||
import * as fs from 'graceful-fs';
|
||||
import which = require('which');
|
||||
import which from 'which';
|
||||
import type {Config} from '@jest/types';
|
||||
|
||||
const dedent = dedentBase.withOptions({escapeSpecialCharacters: true});
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
import {tmpdir} from 'os';
|
||||
import * as path from 'path';
|
||||
import * as fs from 'graceful-fs';
|
||||
import semver = require('semver');
|
||||
import slash = require('slash');
|
||||
import * as semver from 'semver';
|
||||
import slash from 'slash';
|
||||
import {findRepos, getChangedFilesForRoots} from 'jest-changed-files';
|
||||
import {
|
||||
cleanup,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import slash = require('slash');
|
||||
import slash from 'slash';
|
||||
import runJest from '../runJest';
|
||||
|
||||
const MULTIPLE_CONFIGS_WARNING_TEXT = 'Multiple configurations found';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import {tmpdir} from 'os';
|
||||
import * as path from 'path';
|
||||
import semver = require('semver');
|
||||
import * as semver from 'semver';
|
||||
import {cleanup, run, testIfHg, testIfSl, writeFiles} from '../Utils';
|
||||
import runJest from '../runJest';
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import path = require('path');
|
||||
import execa = require('execa');
|
||||
import path from 'path';
|
||||
import execa from 'execa';
|
||||
import {onNodeVersions} from '@jest/test-utils';
|
||||
import type {ReadJestConfigOptions, readInitialOptions} from 'jest-config';
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import {tmpdir} from 'os';
|
||||
import {resolve} from 'path';
|
||||
import findProcess = require('find-process');
|
||||
import findProcess from 'find-process';
|
||||
import {
|
||||
cleanup,
|
||||
generateTestFilesToForceUsingWorkers,
|
||||
|
|
|
@ -10,7 +10,7 @@ import * as path from 'path';
|
|||
import {Writable} from 'stream';
|
||||
import {stripVTControlCharacters as stripAnsi} from 'util';
|
||||
import dedent from 'dedent';
|
||||
import execa = require('execa');
|
||||
import execa from 'execa';
|
||||
import * as fs from 'graceful-fs';
|
||||
import {TestPathPatterns} from '@jest/pattern';
|
||||
import type {FormattedTestResults} from '@jest/test-result';
|
||||
|
|
|
@ -13,9 +13,9 @@ import {
|
|||
transformSync as babelTransform,
|
||||
transformAsync as babelTransformAsync,
|
||||
} from '@babel/core';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import * as fs from 'graceful-fs';
|
||||
import slash = require('slash');
|
||||
import slash from 'slash';
|
||||
import type {
|
||||
TransformOptions as JestTransformOptions,
|
||||
SyncTransformer,
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import chalk = require('chalk');
|
||||
import exit = require('exit-x');
|
||||
import chalk from 'chalk';
|
||||
import exit from 'exit-x';
|
||||
import * as fs from 'graceful-fs';
|
||||
import prompts = require('prompts');
|
||||
import prompts from 'prompts';
|
||||
import {constants} from 'jest-config';
|
||||
import {clearLine, tryRealpath} from 'jest-util';
|
||||
import {MalformedPackageJsonError, NotFoundPackageJsonError} from './errors';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import execa = require('execa');
|
||||
import execa from 'execa';
|
||||
import type {SCMAdapter} from './types';
|
||||
|
||||
const findChangedFilesUsingCommand = async (
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import execa = require('execa');
|
||||
import execa from 'execa';
|
||||
import type {SCMAdapter} from './types';
|
||||
|
||||
const env = {...process.env, HGPLAIN: '1'};
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import pLimit = require('p-limit');
|
||||
import pLimit from 'p-limit';
|
||||
import {isNonNullable} from 'jest-util';
|
||||
import git from './git';
|
||||
import hg from './hg';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import execa = require('execa');
|
||||
import execa from 'execa';
|
||||
import type {SCMAdapter} from './types';
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import {sync as spawnSync} from 'execa';
|
||||
import * as fs from 'graceful-fs';
|
||||
import tempy = require('tempy');
|
||||
import tempy from 'tempy';
|
||||
|
||||
const CIRCUS_PATH = require.resolve('../').replaceAll('\\', '\\\\');
|
||||
const CIRCUS_RUN_PATH = require.resolve('../run').replaceAll('\\', '\\\\');
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import {AssertionError} from 'assert';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {Circus} from '@jest/types';
|
||||
import {
|
||||
type DiffOptions,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import {AsyncLocalStorage} from 'async_hooks';
|
||||
import pLimit = require('p-limit');
|
||||
import pLimit from 'p-limit';
|
||||
import {jestExpect} from '@jest/expect';
|
||||
import type {Circus, Global} from '@jest/types';
|
||||
import {invariant} from 'jest-util';
|
||||
|
|
|
@ -9,8 +9,8 @@ import * as path from 'path';
|
|||
import co from 'co';
|
||||
import dedent from 'dedent';
|
||||
import isGeneratorFn from 'is-generator-fn';
|
||||
import slash = require('slash');
|
||||
import StackUtils = require('stack-utils');
|
||||
import slash from 'slash';
|
||||
import StackUtils from 'stack-utils';
|
||||
import type {Status, TestCaseResult} from '@jest/test-result';
|
||||
import type {Circus, Global} from '@jest/types';
|
||||
import {
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import chalk = require('chalk');
|
||||
import exit = require('exit-x');
|
||||
import yargs = require('yargs');
|
||||
import chalk from 'chalk';
|
||||
import exit from 'exit-x';
|
||||
import yargs from 'yargs';
|
||||
import {getVersion, runCLI} from '@jest/core';
|
||||
import type {AggregatedResult} from '@jest/test-result';
|
||||
import type {Config} from '@jest/types';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {DeprecatedOptions} from 'jest-validate';
|
||||
|
||||
function formatDeprecation(message: string): string {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import {getType} from '@jest/get-type';
|
||||
import type {Config} from '@jest/types';
|
||||
import {ValidationError} from 'jest-validate';
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import {createHash} from 'crypto';
|
||||
import * as path from 'path';
|
||||
import semver = require('semver');
|
||||
import * as semver from 'semver';
|
||||
import type {Config} from '@jest/types';
|
||||
import {escapeStrForRegex} from 'jest-regex-util';
|
||||
import Defaults from '../Defaults';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import path = require('path');
|
||||
import path from 'path';
|
||||
import * as fs from 'graceful-fs';
|
||||
import {requireOrImportModule} from 'jest-util';
|
||||
import readConfigFileAndSetRootDir from '../readConfigFileAndSetRootDir';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import * as fs from 'graceful-fs';
|
||||
import type {Config} from '@jest/types';
|
||||
import {tryRealpath} from 'jest-util';
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
import {createHash} from 'crypto';
|
||||
import {totalmem} from 'os';
|
||||
import * as path from 'path';
|
||||
import chalk = require('chalk');
|
||||
import merge = require('deepmerge');
|
||||
import chalk from 'chalk';
|
||||
import merge from 'deepmerge';
|
||||
import {glob} from 'glob';
|
||||
import {statSync} from 'graceful-fs';
|
||||
import micromatch = require('micromatch');
|
||||
import micromatch from 'micromatch';
|
||||
import {TestPathPatterns} from '@jest/pattern';
|
||||
import type {Config} from '@jest/types';
|
||||
import {replacePathSepForRegex} from 'jest-regex-util';
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
import * as path from 'path';
|
||||
import {isNativeError} from 'util/types';
|
||||
import * as fs from 'graceful-fs';
|
||||
import parseJson = require('parse-json');
|
||||
import stripJsonComments = require('strip-json-comments');
|
||||
import parseJson from 'parse-json';
|
||||
import stripJsonComments from 'strip-json-comments';
|
||||
import type {Config} from '@jest/types';
|
||||
import {extract, parse} from 'jest-docblock';
|
||||
import {interopRequireDefault, requireOrImportModule} from 'jest-util';
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import * as fs from 'graceful-fs';
|
||||
import slash = require('slash');
|
||||
import slash from 'slash';
|
||||
import {ValidationError} from 'jest-validate';
|
||||
import {
|
||||
JEST_CONFIG_BASE_NAME,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import Resolver from 'jest-resolve';
|
||||
import {ValidationError} from 'jest-validate';
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import {AssertionError, strict as assert} from 'assert';
|
||||
import {Console} from 'console';
|
||||
import {type InspectOptions, format, formatWithOptions, inspect} from 'util';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import {ErrorWithStack, formatTime, invariant} from 'jest-util';
|
||||
import type {
|
||||
ConsoleBuffer,
|
||||
|
|
|
@ -9,7 +9,7 @@ import {AssertionError, strict as assert} from 'assert';
|
|||
import {Console} from 'console';
|
||||
import type {WriteStream} from 'tty';
|
||||
import {type InspectOptions, format, formatWithOptions, inspect} from 'util';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import {clearLine, formatTime} from 'jest-util';
|
||||
import type {LogCounters, LogMessage, LogTimers, LogType} from './types';
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import {Writable} from 'stream';
|
||||
import type {WriteStream} from 'tty';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import CustomConsole from '../CustomConsole';
|
||||
|
||||
describe('CustomConsole', () => {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import BufferedConsole from '../BufferedConsole';
|
||||
|
||||
describe('CustomConsole', () => {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {Config} from '@jest/types';
|
||||
import {
|
||||
type StackTraceConfig,
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import ansiEscapes = require('ansi-escapes');
|
||||
import chalk = require('chalk');
|
||||
import ansiEscapes from 'ansi-escapes';
|
||||
import chalk from 'chalk';
|
||||
import type {AggregatedResult, AssertionLocation} from '@jest/test-result';
|
||||
import {pluralize, specialChars} from 'jest-util';
|
||||
import {KEYS} from 'jest-watcher';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import micromatch = require('micromatch');
|
||||
import micromatch from 'micromatch';
|
||||
import type {TestPathPatternsExecutor} from '@jest/pattern';
|
||||
import type {Test, TestContext} from '@jest/test-result';
|
||||
import type {Config} from '@jest/types';
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import ansiEscapes = require('ansi-escapes');
|
||||
import chalk = require('chalk');
|
||||
import ansiEscapes from 'ansi-escapes';
|
||||
import chalk from 'chalk';
|
||||
import type {AggregatedResult, AssertionLocation} from '@jest/test-result';
|
||||
import {pluralize, specialChars} from 'jest-util';
|
||||
import {KEYS} from 'jest-watcher';
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import {GITHUB_ACTIONS} from 'ci-info';
|
||||
import exit = require('exit-x');
|
||||
import exit from 'exit-x';
|
||||
import {
|
||||
CoverageReporter,
|
||||
DefaultReporter,
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
import {performance} from 'perf_hooks';
|
||||
import type {WriteStream} from 'tty';
|
||||
import chalk = require('chalk');
|
||||
import exit = require('exit-x');
|
||||
import chalk from 'chalk';
|
||||
import exit from 'exit-x';
|
||||
import * as fs from 'graceful-fs';
|
||||
import {CustomConsole} from '@jest/console';
|
||||
import type {AggregatedResult, TestContext} from '@jest/test-result';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {Config} from '@jest/types';
|
||||
import {
|
||||
type ChangedFilesPromise,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {Config} from '@jest/types';
|
||||
import {pluralize} from 'jest-util';
|
||||
import type {TestRunData} from './types';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {Config} from '@jest/types';
|
||||
import {isInteractive} from 'jest-util';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
|
||||
export default function getNoTestFoundPassWithNoTests(): string {
|
||||
return chalk.bold('No tests found, exiting with code 0');
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {Config} from '@jest/types';
|
||||
import {isInteractive} from 'jest-util';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {Config} from '@jest/types';
|
||||
import {pluralize} from 'jest-util';
|
||||
import type {Stats, TestRunData} from './types';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {Config} from '@jest/types';
|
||||
import getProjectDisplayName from './getProjectDisplayName';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {Config} from '@jest/types';
|
||||
import getProjectDisplayName from './getProjectDisplayName';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {Config} from '@jest/types';
|
||||
import {isNonNullable} from 'jest-util';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import type {ReadStream, WriteStream} from 'tty';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import {KEYS} from 'jest-watcher';
|
||||
|
||||
export default function handleDeprecationWarnings(
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
import * as path from 'path';
|
||||
import {performance} from 'perf_hooks';
|
||||
import type {WriteStream} from 'tty';
|
||||
import chalk = require('chalk');
|
||||
import exit = require('exit-x');
|
||||
import chalk from 'chalk';
|
||||
import exit from 'exit-x';
|
||||
import * as fs from 'graceful-fs';
|
||||
import {CustomConsole} from '@jest/console';
|
||||
import {
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
import * as path from 'path';
|
||||
import type {WriteStream} from 'tty';
|
||||
import ansiEscapes = require('ansi-escapes');
|
||||
import chalk = require('chalk');
|
||||
import exit = require('exit-x');
|
||||
import slash = require('slash');
|
||||
import ansiEscapes from 'ansi-escapes';
|
||||
import chalk from 'chalk';
|
||||
import exit from 'exit-x';
|
||||
import slash from 'slash';
|
||||
import {TestPathPatterns} from '@jest/pattern';
|
||||
import type {TestContext} from '@jest/test-result';
|
||||
import type {Config} from '@jest/types';
|
||||
|
|
|
@ -431,7 +431,7 @@ The `jest-diff` package does not assume that the 2 labels have equal length.
|
|||
For consistency with most diff tools, you might exchange the colors:
|
||||
|
||||
```ts
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
|
||||
const options = {
|
||||
aColor: chalk.red,
|
||||
|
@ -444,7 +444,7 @@ const options = {
|
|||
Although the default inverse of foreground and background colors is hard to beat for changed substrings **within lines**, especially because it highlights spaces, if you want bold font weight on yellow background color:
|
||||
|
||||
```ts
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
|
||||
const options = {
|
||||
changeColor: chalk.bold.bgYellowBright,
|
||||
|
@ -534,7 +534,7 @@ A patch mark like `@@ -12,7 +12,9 @@` accounts for omitted common lines.
|
|||
If you want patch marks to have the same dim color as common lines:
|
||||
|
||||
```ts
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
|
||||
const options = {
|
||||
expand: false,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import {stripVTControlCharacters as stripAnsi} from 'util';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import {alignedAnsiStyleSerializer} from '@jest/test-utils';
|
||||
import {diff} from '../';
|
||||
import {NO_DIFF_MESSAGE} from '../constants';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import {getType} from '@jest/get-type';
|
||||
import {
|
||||
type PrettyFormatOptions,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {CompareKeys} from 'pretty-format';
|
||||
import type {DiffOptions, DiffOptionsNormalized} from './types';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import {EOL} from 'os';
|
||||
import detectNewline = require('detect-newline');
|
||||
import detectNewline from 'detect-newline';
|
||||
|
||||
type Pragmas = Record<string, string | Array<string>>;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {Global} from '@jest/types';
|
||||
import {format as pretty} from 'pretty-format';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import watchman = require('fb-watchman');
|
||||
import * as watchman from 'fb-watchman';
|
||||
import H from '../constants';
|
||||
import * as fastPath from '../lib/fast_path';
|
||||
import normalizePathSep from '../lib/normalizePathSep';
|
||||
|
|
|
@ -10,7 +10,7 @@ import {EventEmitter} from 'events';
|
|||
import * as path from 'path';
|
||||
import anymatch, {type Matcher} from 'anymatch';
|
||||
import * as fs from 'graceful-fs';
|
||||
import micromatch = require('micromatch');
|
||||
import micromatch from 'micromatch';
|
||||
// @ts-expect-error -- no types
|
||||
import walker from 'walker';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import {
|
||||
type DiffOptions,
|
||||
diff,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
import co from 'co';
|
||||
import isGeneratorFn from 'is-generator-fn';
|
||||
import pLimit = require('p-limit');
|
||||
import pLimit from 'p-limit';
|
||||
import type {Config, Global} from '@jest/types';
|
||||
import {isPromise} from 'jest-util';
|
||||
import isError from './isError';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import {alignedAnsiStyleSerializer} from '@jest/test-utils';
|
||||
import {format as prettyFormat} from 'pretty-format';
|
||||
import {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk, {type Chalk} from 'chalk';
|
||||
import {getType, isPrimitive} from '@jest/get-type';
|
||||
import {
|
||||
DIFF_DELETE,
|
||||
|
@ -61,11 +61,11 @@ export type MatcherHintOptions = {
|
|||
|
||||
export type DiffOptions = ImportDiffOptions;
|
||||
|
||||
export const EXPECTED_COLOR = chalk.green;
|
||||
export const RECEIVED_COLOR = chalk.red;
|
||||
export const INVERTED_COLOR = chalk.inverse;
|
||||
export const BOLD_WEIGHT = chalk.bold;
|
||||
export const DIM_COLOR = chalk.dim;
|
||||
export const EXPECTED_COLOR: Chalk = chalk.green;
|
||||
export const RECEIVED_COLOR: Chalk = chalk.red;
|
||||
export const INVERTED_COLOR: Chalk = chalk.inverse;
|
||||
export const BOLD_WEIGHT: Chalk = chalk.bold;
|
||||
export const DIM_COLOR: Chalk = chalk.dim;
|
||||
|
||||
const MULTILINE_REGEXP = /\n/;
|
||||
const SPACE_SYMBOL = '\u{00B7}'; // middle dot
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
*/
|
||||
|
||||
import {readFileSync} from 'graceful-fs';
|
||||
import slash = require('slash');
|
||||
import tempy = require('tempy');
|
||||
import slash from 'slash';
|
||||
import tempy from 'tempy';
|
||||
import {
|
||||
formatExecError,
|
||||
formatResultsErrors,
|
||||
|
|
|
@ -9,11 +9,11 @@ import * as path from 'path';
|
|||
import {fileURLToPath} from 'url';
|
||||
import {types} from 'util';
|
||||
import {codeFrameColumns} from '@babel/code-frame';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import * as fs from 'graceful-fs';
|
||||
import micromatch = require('micromatch');
|
||||
import slash = require('slash');
|
||||
import StackUtils = require('stack-utils');
|
||||
import micromatch from 'micromatch';
|
||||
import slash from 'slash';
|
||||
import StackUtils from 'stack-utils';
|
||||
import type {Config, TestResult} from '@jest/types';
|
||||
import {format as prettyFormat} from 'pretty-format';
|
||||
import type {Frame} from './types';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import yargs = require('yargs');
|
||||
import yargs from 'yargs';
|
||||
import type {Config} from '@jest/types';
|
||||
import {deprecationEntries} from 'jest-config';
|
||||
import {validateCLIOptions} from 'jest-validate';
|
||||
|
@ -17,9 +17,10 @@ import {VERSION} from './version';
|
|||
|
||||
const REPL_SCRIPT = require.resolve('./repl');
|
||||
|
||||
export function run(): Promise<void> {
|
||||
const argv = yargs.usage(args.usage).options(args.options)
|
||||
.argv as Config.Argv;
|
||||
export async function run(): Promise<void> {
|
||||
const argv = (await yargs(process.argv.slice(2))
|
||||
.usage(args.usage)
|
||||
.options(args.options).argv) as Config.Argv;
|
||||
|
||||
validateCLIOptions(argv, {...args.options, deprecationEntries});
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
import {availableParallelism} from 'os';
|
||||
import * as path from 'path';
|
||||
import * as util from 'util';
|
||||
import chalk = require('chalk');
|
||||
import yargs = require('yargs');
|
||||
import chalk from 'chalk';
|
||||
import yargs from 'yargs';
|
||||
import {CustomConsole} from '@jest/console';
|
||||
import type {JestEnvironment} from '@jest/environment';
|
||||
import {createScriptTransformer} from '@jest/transform';
|
||||
|
@ -29,17 +29,17 @@ export async function run(
|
|||
if (cliArgv) {
|
||||
argv = cliArgv;
|
||||
} else {
|
||||
argv = yargs
|
||||
argv = (await yargs(process.argv.slice(2))
|
||||
.usage(args.usage)
|
||||
.help(false)
|
||||
.version(false)
|
||||
.options(args.options).argv as Config.Argv;
|
||||
.options(args.options).argv) as Config.Argv;
|
||||
|
||||
validateCLIOptions(argv, {...args.options, deprecationEntries});
|
||||
}
|
||||
|
||||
if (argv.help === true) {
|
||||
yargs.showHelp();
|
||||
yargs().showHelp();
|
||||
process.on('exit', () => (process.exitCode = 1));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -8,14 +8,16 @@
|
|||
import * as path from 'path';
|
||||
import {mergeProcessCovs} from '@bcoe/v8-coverage';
|
||||
import type {EncodedSourceMap} from '@jridgewell/trace-mapping';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import {glob} from 'glob';
|
||||
import * as fs from 'graceful-fs';
|
||||
import istanbulCoverage = require('istanbul-lib-coverage');
|
||||
import istanbulReport = require('istanbul-lib-report');
|
||||
import libSourceMaps = require('istanbul-lib-source-maps');
|
||||
import istanbulReports = require('istanbul-reports');
|
||||
import v8toIstanbul = require('v8-to-istanbul');
|
||||
/* eslint-disable import-x/default */
|
||||
import istanbulCoverage from 'istanbul-lib-coverage';
|
||||
import istanbulReport from 'istanbul-lib-report';
|
||||
import libSourceMaps from 'istanbul-lib-source-maps';
|
||||
import istanbulReports from 'istanbul-reports';
|
||||
/* eslint-enable import-x/default */
|
||||
import v8toIstanbul from 'v8-to-istanbul';
|
||||
import type {
|
||||
AggregatedResult,
|
||||
RuntimeTransformResult,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import exit = require('exit-x');
|
||||
import exit from 'exit-x';
|
||||
import * as fs from 'graceful-fs';
|
||||
import type {Config} from '@jest/types';
|
||||
import generateEmptyCoverage, {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import type {WriteStream} from 'tty';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import {getConsoleOutput} from '@jest/console';
|
||||
import type {
|
||||
AggregatedResult,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import {stripVTControlCharacters as stripAnsi} from 'util';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {
|
||||
AggregatedResult,
|
||||
AssertionResult,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import * as path from 'path';
|
||||
import * as util from 'util';
|
||||
import exit = require('exit-x');
|
||||
import exit from 'exit-x';
|
||||
import type {AggregatedResult, TestContext} from '@jest/test-result';
|
||||
import type {Config} from '@jest/types';
|
||||
import {pluralize} from 'jest-util';
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import stringLength = require('string-length');
|
||||
import chalk from 'chalk';
|
||||
import stringLength from 'string-length';
|
||||
import type {
|
||||
AggregatedResult,
|
||||
Test,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {
|
||||
AggregatedResult,
|
||||
SnapshotSummary,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import type {WriteStream} from 'tty';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {
|
||||
AggregatedResult,
|
||||
AssertionResult,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import * as path from 'path';
|
||||
import {stripVTControlCharacters as stripAnsi} from 'util';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import {makeProjectConfig} from '@jest/test-utils';
|
||||
import printDisplayName from '../printDisplayName';
|
||||
import trimAndFormatPath from '../trimAndFormatPath';
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import chalk = require('chalk');
|
||||
import slash = require('slash');
|
||||
import chalk from 'chalk';
|
||||
import slash from 'slash';
|
||||
import type {Config} from '@jest/types';
|
||||
import relativePath from './relativePath';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {TestResult} from '@jest/test-result';
|
||||
import type {Config} from '@jest/types';
|
||||
import {formatTime} from 'jest-util';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {TestResult} from '@jest/test-result';
|
||||
import {pluralize} from 'jest-util';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {SnapshotSummary} from '@jest/test-result';
|
||||
import type {Config} from '@jest/types';
|
||||
import {pluralize} from 'jest-util';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {AggregatedResult, Test, TestCaseResult} from '@jest/test-result';
|
||||
import {formatTime, pluralize} from 'jest-util';
|
||||
import type {SummaryOptions} from './types';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import istanbulReport = require('istanbul-lib-report');
|
||||
import * as istanbulReport from 'istanbul-lib-report';
|
||||
import type {Config} from '@jest/types';
|
||||
|
||||
export default function getWatermarks(
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import type {Config} from '@jest/types';
|
||||
|
||||
export default function printDisplayName(config: Config.ProjectConfig): string {
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import chalk = require('chalk');
|
||||
import slash = require('slash');
|
||||
import chalk from 'chalk';
|
||||
import slash from 'slash';
|
||||
import type {Config} from '@jest/types';
|
||||
import relativePath from './relativePath';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import slash = require('slash');
|
||||
import slash from 'slash';
|
||||
|
||||
export default class ModuleNotFoundError extends Error {
|
||||
public code = 'MODULE_NOT_FOUND';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import module = require('module');
|
||||
import module from 'module';
|
||||
|
||||
const BUILTIN_MODULES = new Set(module.builtinModules);
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import chalk = require('chalk');
|
||||
import slash = require('slash');
|
||||
import chalk from 'chalk';
|
||||
import slash from 'slash';
|
||||
import type {IModuleMap} from 'jest-haste-map';
|
||||
import {tryRealpath} from 'jest-util';
|
||||
import ModuleNotFoundError from './ModuleNotFoundError';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import {ValidationError} from 'jest-validate';
|
||||
import Resolver from './resolver';
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
"@types/node": "*",
|
||||
"chalk": "^4.1.2",
|
||||
"emittery": "^0.13.1",
|
||||
"exit-x": "^0.2.2",
|
||||
"graceful-fs": "^4.2.11",
|
||||
"jest-docblock": "workspace:*",
|
||||
"jest-environment-node": "workspace:*",
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import Emittery = require('emittery');
|
||||
import pLimit = require('p-limit');
|
||||
import chalk from 'chalk';
|
||||
import Emittery from 'emittery';
|
||||
import pLimit from 'p-limit';
|
||||
import type {
|
||||
Test,
|
||||
TestEvents,
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
import {runInContext} from 'node:vm';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import * as fs from 'graceful-fs';
|
||||
import sourcemapSupport = require('source-map-support');
|
||||
import * as sourcemapSupport from 'source-map-support';
|
||||
import {
|
||||
BufferedConsole,
|
||||
CustomConsole,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import exit = require('exit-x');
|
||||
import exit from 'exit-x';
|
||||
import type {
|
||||
SerializableError,
|
||||
TestFileEvent,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import * as path from 'path';
|
||||
import {glob} from 'glob';
|
||||
import slash = require('slash');
|
||||
import slash from 'slash';
|
||||
import type {Config} from '@jest/types';
|
||||
|
||||
const OUTSIDE_JEST_VM_PROTOCOL = 'jest-main:';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import nativeModule = require('module');
|
||||
import nativeModule from 'module';
|
||||
import * as path from 'path';
|
||||
import {URL, fileURLToPath, pathToFileURL} from 'url';
|
||||
import {
|
||||
|
@ -21,8 +21,8 @@ import {
|
|||
import {parse as parseCjs} from 'cjs-module-lexer';
|
||||
import {CoverageInstrumenter, type V8Coverage} from 'collect-v8-coverage';
|
||||
import * as fs from 'graceful-fs';
|
||||
import slash = require('slash');
|
||||
import stripBOM = require('strip-bom');
|
||||
import slash from 'slash';
|
||||
import stripBOM from 'strip-bom';
|
||||
import type {
|
||||
Jest,
|
||||
JestEnvironment,
|
||||
|
|
|
@ -11,7 +11,7 @@ jest.mock('graceful-fs', () => ({
|
|||
}));
|
||||
|
||||
import * as path from 'path';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import * as fs from 'graceful-fs';
|
||||
import {
|
||||
SNAPSHOT_GUIDE_LINK,
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import * as fs from 'graceful-fs';
|
||||
import naturalCompare = require('natural-compare');
|
||||
import naturalCompare from 'natural-compare';
|
||||
import type {Config} from '@jest/types';
|
||||
import type {SnapshotData} from './types';
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import type {
|
|||
CustomParser as PrettierCustomParser,
|
||||
BuiltInParserName as PrettierParserName,
|
||||
} from 'prettier-v2';
|
||||
import semver = require('semver');
|
||||
import * as semver from 'semver';
|
||||
import {createSyncFn} from 'synckit';
|
||||
import type {InlineSnapshot} from './types';
|
||||
import {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import {createTranspilingRequire} from '@jest/transform';
|
||||
import type {Config} from '@jest/types';
|
||||
import {interopRequireDefault} from 'jest-util';
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import ansiRegex = require('ansi-regex');
|
||||
import styles = require('ansi-styles');
|
||||
import chalk = require('chalk');
|
||||
import ansiRegex from 'ansi-regex';
|
||||
import styles from 'ansi-styles';
|
||||
import chalk from 'chalk';
|
||||
import type {SyncExpectationResult} from 'expect';
|
||||
import format from 'pretty-format';
|
||||
import {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import chalk = require('chalk');
|
||||
import chalk from 'chalk';
|
||||
import {getObjectSubset} from '@jest/expect-utils';
|
||||
import {getType, isPrimitive} from '@jest/get-type';
|
||||
import {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import {TraceMap, originalPositionFor} from '@jridgewell/trace-mapping';
|
||||
import callsites = require('callsites');
|
||||
import callsites from 'callsites';
|
||||
import {readFileSync} from 'graceful-fs';
|
||||
import type {SourceMapRegistry} from './types';
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue