Stop using `import X = require('…')`. (#15659)

This commit is contained in:
Christoph Nakazawa 2025-06-06 08:49:41 +09:00 committed by GitHub
parent 8fcefef178
commit a2218e4f79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
128 changed files with 191 additions and 222 deletions

View File

@ -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',

View File

@ -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});

View File

@ -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,

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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,

View File

@ -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';

View File

@ -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,

View File

@ -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';

View File

@ -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 (

View File

@ -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'};

View File

@ -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';

View File

@ -7,7 +7,7 @@
*/
import * as path from 'path';
import execa = require('execa');
import execa from 'execa';
import type {SCMAdapter} from './types';
/**

View File

@ -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('\\', '\\\\');

View File

@ -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,

View File

@ -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';

View File

@ -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 {

View File

@ -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';

View File

@ -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 {

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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,

View File

@ -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';

View File

@ -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,

View File

@ -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';

View File

@ -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', () => {

View File

@ -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', () => {

View File

@ -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,

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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,

View File

@ -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';

View File

@ -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,

View File

@ -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';

View File

@ -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';

View File

@ -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');

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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(

View File

@ -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 {

View File

@ -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';

View File

@ -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,

View File

@ -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';

View File

@ -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,

View File

@ -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';

View File

@ -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>>;

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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,

View File

@ -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';

View File

@ -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 {

View File

@ -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

View File

@ -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,

View File

@ -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';

View File

@ -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});

View File

@ -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;
}

View File

@ -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,

View File

@ -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, {

View File

@ -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,

View File

@ -6,7 +6,7 @@
*/
import {stripVTControlCharacters as stripAnsi} from 'util';
import chalk = require('chalk');
import chalk from 'chalk';
import type {
AggregatedResult,
AssertionResult,

View File

@ -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';

View File

@ -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,

View File

@ -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,

View File

@ -6,7 +6,7 @@
*/
import type {WriteStream} from 'tty';
import chalk = require('chalk');
import chalk from 'chalk';
import type {
AggregatedResult,
AssertionResult,

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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(

View File

@ -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 {

View File

@ -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';

View File

@ -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';

View File

@ -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);

View File

@ -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';

View File

@ -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';

View File

@ -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:*",

View File

@ -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,

View File

@ -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,

View File

@ -6,7 +6,7 @@
*
*/
import exit = require('exit-x');
import exit from 'exit-x';
import type {
SerializableError,
TestFileEvent,

View File

@ -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:';

View File

@ -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,

View File

@ -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,

View File

@ -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';

View File

@ -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 {

View File

@ -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';

View File

@ -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 {

View File

@ -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 {

View File

@ -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