chore: enable node protocol in imports (#16077)

This commit is contained in:
Simen Bekkhus
2026-05-01 20:57:31 +02:00
committed by GitHub
parent 5ffa35e4a3
commit d86c68032b
149 changed files with 282 additions and 258 deletions
+2 -2
View File
@@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as util from 'util';
import * as path from 'node:path';
import * as util from 'node:util';
import dedentBase from 'dedent';
import {
type ExecaSyncError,
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
require('path');
require('node:path');
// eslint-disable-next-line prefer-template, no-constant-condition
const uncoveredFunction = () => (true ? 1 + '5' : '999');
+1 -1
View File
@@ -10,5 +10,5 @@
// 'domain' has to be required before Jest performs the copy, i.e. in the global-setup phase represented by this file.
module.exports = () => {
require('domain');
require('node:domain');
};
+1 -1
View File
@@ -7,7 +7,7 @@
'use strict';
const path = require('path');
const path = require('node:path');
const fakeFile = {
file: path.resolve(__dirname, '__tests__/hasteExampleHelper.js'),
moduleName: 'fakeModuleName',
+1 -1
View File
@@ -7,7 +7,7 @@
'use strict';
import {Server} from 'http';
import {Server} from 'node:http';
const app = new Server();
+4 -4
View File
@@ -4,10 +4,10 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const crypto = require('crypto');
const fs = require('fs');
const os = require('os');
const path = require('path');
const crypto = require('node:crypto');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
const {createDirectory} = require('jest-util');
const DIR = path.join(os.tmpdir(), 'jest-global-setup-custom-transform');
+3 -3
View File
@@ -4,9 +4,9 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import * as crypto from 'crypto';
import * as os from 'os';
import * as path from 'path';
import * as crypto from 'node:crypto';
import * as os from 'node:os';
import * as path from 'node:path';
import fs from 'graceful-fs';
import {createDirectory} from 'jest-util';
+4 -4
View File
@@ -5,10 +5,10 @@
* LICENSE file in the root directory of this source tree.
*/
import example from './node_modules/example';
const crypto = require('crypto');
const fs = require('fs');
const os = require('os');
const path = require('path');
const crypto = require('node:crypto');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
const {createDirectory} = require('jest-util');
const DIR = path.join(os.tmpdir(), 'jest-global-setup-node-modules');
+4 -4
View File
@@ -4,10 +4,10 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const crypto = require('crypto');
const fs = require('fs');
const os = require('os');
const path = require('path');
const crypto = require('node:crypto');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
const {createDirectory} = require('jest-util');
const DIR = path.join(os.tmpdir(), 'jest-global-setup-project-1');
+4 -4
View File
@@ -4,10 +4,10 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const crypto = require('crypto');
const fs = require('fs');
const os = require('os');
const path = require('path');
const crypto = require('node:crypto');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
const {createDirectory} = require('jest-util');
const DIR = path.join(os.tmpdir(), 'jest-global-setup-project-2');
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
const path = require('path');
const path = require('node:path');
module.exports = {
globalSetup: '<rootDir>/setup.js',
+3 -3
View File
@@ -4,9 +4,9 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import * as crypto from 'crypto';
import * as os from 'os';
import * as path from 'path';
import * as crypto from 'node:crypto';
import * as os from 'node:os';
import * as path from 'node:path';
import fs from 'graceful-fs';
import {createDirectory} from 'jest-util';
+4 -4
View File
@@ -4,10 +4,10 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const crypto = require('crypto');
const fs = require('fs');
const os = require('os');
const path = require('path');
const crypto = require('node:crypto');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
const {createDirectory} = require('jest-util');
const DIR = path.join(os.tmpdir(), 'jest-global-teardown-project-1');
+4 -4
View File
@@ -4,10 +4,10 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const crypto = require('crypto');
const fs = require('fs');
const os = require('os');
const path = require('path');
const crypto = require('node:crypto');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
const {createDirectory} = require('jest-util');
const DIR = path.join(os.tmpdir(), 'jest-global-teardown-project-2');
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
const path = require('path');
const path = require('node:path');
module.exports = {
globalTeardown: '<rootDir>/teardown.js',
+4 -4
View File
@@ -4,10 +4,10 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const crypto = require('crypto');
const fs = require('fs');
const os = require('os');
const path = require('path');
const crypto = require('node:crypto');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
const {createDirectory} = require('jest-util');
const DIR = path.join(os.tmpdir(), 'jest-global-teardown');
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import {readFileSync} from 'node:fs';
import {readFileSync} from 'graceful-fs';
import {jest} from '@jest/globals';
// file origin: https://github.com/mdn/webassembly-examples/blob/2f2163287f86fe29deb162335bccca7d5d95ca4f/understanding-text-format/add.wasm
// source code: https://github.com/mdn/webassembly-examples/blob/2f2163287f86fe29deb162335bccca7d5d95ca4f/understanding-text-format/add.was
+1
View File
@@ -5,4 +5,5 @@
* LICENSE file in the root directory of this source tree.
*/
// eslint-disable-next-line no-restricted-imports
export * from 'node:fs';
+1 -1
View File
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
module.exports = function load(moduleId) {
return require(path.join(path.dirname(require.main.filename), moduleId));
+1 -1
View File
@@ -7,7 +7,7 @@
'use strict';
const {promisify} = require('util');
const {promisify} = require('node:util');
const wait = promisify(setTimeout);
+1 -1
View File
@@ -7,7 +7,7 @@
* @noflow
*/
const path = require('path');
const path = require('node:path');
module.exports = {
getHasteName(filePath) {
+3 -3
View File
@@ -6,9 +6,9 @@
*
*/
import * as path from 'path';
import {Writable} from 'stream';
import {stripVTControlCharacters as stripAnsi} from 'util';
import * as path from 'node:path';
import {Writable} from 'node:stream';
import {stripVTControlCharacters as stripAnsi} from 'node:util';
import dedent from 'dedent';
import execa from 'execa';
import * as fs from 'graceful-fs';
@@ -7,8 +7,8 @@
'use strict';
const fs = require('fs');
const os = require('os');
const fs = require('node:fs');
const os = require('node:os');
const JSDOMEnvironment = require('jest-environment-jsdom').TestEnvironment;
const {createDirectory} = require('jest-util');
+1 -1
View File
@@ -7,7 +7,7 @@
'use strict';
const fs = require('fs');
const fs = require('node:fs');
/**
* RetryReporter
+5 -6
View File
@@ -7,8 +7,8 @@
/* eslint-disable sort-keys */
import fs from 'fs';
import path from 'path';
import fs from 'node:fs';
import path from 'node:path';
import eslintJs from '@eslint/js';
import eslintMarkdown from '@eslint/markdown';
import eslintPluginEslintCommentsConfigs from '@eslint-community/eslint-plugin-eslint-comments/configs';
@@ -210,6 +210,7 @@ const config = defineConfig(
'no-restricted-imports': [
'error',
{message: 'Please use graceful-fs instead.', name: 'fs'},
{message: 'Please use graceful-fs instead.', name: 'node:fs'},
],
'no-restricted-modules': 'off',
'no-restricted-syntax': 'off',
@@ -312,11 +313,7 @@ const config = defineConfig(
'unicorn/prefer-reflect-apply': 'off',
'unicorn/prefer-string-raw': 'off',
'unicorn/prefer-structured-clone': 'off',
// enabling this is blocked by https://github.com/microsoft/rushstack/issues/2780
'unicorn/prefer-export-from': 'off',
// enabling this is blocked by https://github.com/jestjs/jest/pull/14297
'unicorn/prefer-node-protocol': 'off',
},
},
[
@@ -455,6 +452,8 @@ const config = defineConfig(
'jest/require-to-throw-message': 'error',
'jest/valid-expect': 'error',
'import-x/order': 'off',
// we don't wanna mess with tests
'unicorn/prefer-node-protocol': 'off',
},
},
+1 -1
View File
@@ -1,6 +1,6 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.. All Rights Reserved.
const http = require('http');
const http = require('node:http');
export default function request(url) {
return new Promise(resolve => {
+1 -1
View File
@@ -1,6 +1,6 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.. All Rights Reserved.
const fs = require('fs');
const fs = require('node:fs');
function summarizeFilesInDirectorySync(directory) {
return fs.readdirSync(directory).map(fileName => ({directory, fileName}));
+1 -1
View File
@@ -1,6 +1,6 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
const {createRequire} = require('module');
const {createRequire} = require('node:module');
module.exports = {
presets: ['@react-native/babel-preset'],
+1 -1
View File
@@ -1,4 +1,4 @@
const {resolve} = require('path');
const {resolve} = require('node:path');
module.exports = {
preset: 'react-native',
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import {createRequire} from 'module';
import {createRequire} from 'node:module';
const require = createRequire(import.meta.url);
/** @type {import('jest').Config} */
+2 -2
View File
@@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
import {createHash} from 'crypto';
import * as path from 'path';
import {createHash} from 'node:crypto';
import * as path from 'node:path';
import type {
TransformOptions as BabelTransformOptions,
PartialConfig,
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
import chalk from 'chalk';
import exit from 'exit-x';
import * as fs from 'graceful-fs';
+1 -1
View File
@@ -6,7 +6,7 @@
*
*/
import * as path from 'path';
import * as path from 'node:path';
import execa from 'execa';
import type {SCMAdapter} from './types';
+1 -1
View File
@@ -6,7 +6,7 @@
*
*/
import * as path from 'path';
import * as path from 'node:path';
import execa from 'execa';
import type {SCMAdapter} from './types';
+1 -1
View File
@@ -6,7 +6,7 @@
*
*/
import * as path from 'path';
import * as path from 'node:path';
import execa from 'execa';
import type {SCMAdapter} from './types';
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import {AssertionError} from 'assert';
import {AssertionError} from 'node:assert';
import chalk from 'chalk';
import type {Circus} from '@jest/types';
import {
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import type * as Process from 'process';
import type * as Process from 'node:process';
import type {Circus} from '@jest/types';
import {dispatchSync} from './state';
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import type * as Process from 'process';
import type * as Process from 'node:process';
import type {JestEnvironment} from '@jest/environment';
import {type JestExpect, jestExpect} from '@jest/expect';
import {
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import {AsyncLocalStorage} from 'async_hooks';
import {AsyncLocalStorage} from 'node:async_hooks';
import pLimit from 'p-limit';
import {jestExpect} from '@jest/expect';
import type {Circus, Global} from '@jest/types';
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
import co from 'co';
import dedent from 'dedent';
import isGeneratorFn from 'is-generator-fn';
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
import chalk from 'chalk';
import exit from 'exit-x';
import yargs from 'yargs';
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import {sep} from 'path';
import {sep} from 'node:path';
import {isCI} from 'ci-info';
import type {Config} from '@jest/types';
import {replacePathSepForRegex} from 'jest-regex-util';
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import {createHash} from 'crypto';
import {createHash} from 'node:crypto';
import type {ForegroundColor} from 'chalk';
type Color = typeof ForegroundColor;
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
export const NODE_MODULES = `${path.sep}node_modules${path.sep}`;
export const DEFAULT_JS_PATTERN = '\\.[jt]sx?$';
@@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
import {tmpdir} from 'os';
import * as path from 'path';
import {tmpdir} from 'node:os';
import * as path from 'node:path';
import {tryRealpath} from 'jest-util';
const getCacheDirectory: () => string = () => {
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import {availableParallelism} from 'os';
import {availableParallelism} from 'node:os';
import type {Config} from '@jest/types';
export default function getMaxWorkers(
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
import chalk from 'chalk';
import deepMerge from 'deepmerge';
import * as fs from 'graceful-fs';
+3 -3
View File
@@ -5,9 +5,9 @@
* LICENSE file in the root directory of this source tree.
*/
import {createHash} from 'crypto';
import {totalmem} from 'os';
import * as path from 'path';
import {createHash} from 'node:crypto';
import {totalmem} from 'node:os';
import * as path from 'node:path';
import chalk from 'chalk';
import merge from 'deepmerge';
import {glob} from 'glob';
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
import * as fs from 'graceful-fs';
import parseJson from 'parse-json';
import stripJsonComments from 'strip-json-comments';
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
import chalk from 'chalk';
import * as fs from 'graceful-fs';
import slash from 'slash';
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
import chalk from 'chalk';
import Resolver from 'jest-resolve';
import {ValidationError} from 'jest-validate';
+8 -3
View File
@@ -5,9 +5,14 @@
* LICENSE file in the root directory of this source tree.
*/
import {AssertionError, strict as assert} from 'assert';
import {Console} from 'console';
import {type InspectOptions, format, formatWithOptions, inspect} from 'util';
import {AssertionError, strict as assert} from 'node:assert';
import {Console} from 'node:console';
import {
type InspectOptions,
format,
formatWithOptions,
inspect,
} from 'node:util';
import chalk from 'chalk';
import {ErrorWithStack, formatTime, invariant} from 'jest-util';
import type {
+9 -4
View File
@@ -5,10 +5,15 @@
* LICENSE file in the root directory of this source tree.
*/
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 {AssertionError, strict as assert} from 'node:assert';
import {Console} from 'node:console';
import type {WriteStream} from 'node:tty';
import {
type InspectOptions,
format,
formatWithOptions,
inspect,
} from 'node:util';
import chalk from 'chalk';
import {clearLine, formatTime} from 'jest-util';
import type {LogCounters, LogMessage, LogTimers, LogType} from './types';
+2 -2
View File
@@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
import * as os from 'os';
import * as path from 'path';
import * as os from 'node:os';
import * as path from 'node:path';
import type {TestPathPatternsExecutor} from '@jest/pattern';
import type {Test, TestContext} from '@jest/test-result';
import type {Config} from '@jest/types';
+2 -2
View File
@@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
import {performance} from 'perf_hooks';
import type {WriteStream} from 'tty';
import {performance} from 'node:perf_hooks';
import type {WriteStream} from 'node:tty';
import chalk from 'chalk';
import exit from 'exit-x';
import * as fs from 'graceful-fs';
+4 -4
View File
@@ -5,10 +5,10 @@
* LICENSE file in the root directory of this source tree.
*/
import * as asyncHooks from 'async_hooks';
import {promisify, stripVTControlCharacters as stripAnsi} from 'util';
import * as v8 from 'v8';
import * as vm from 'vm';
import * as asyncHooks from 'node:async_hooks';
import {promisify, stripVTControlCharacters as stripAnsi} from 'node:util';
import * as v8 from 'node:v8';
import * as vm from 'node:vm';
import type {Config} from '@jest/types';
import {formatExecError} from 'jest-message-util';
import {ErrorWithStack} from 'jest-util';
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import type {ReadStream, WriteStream} from 'tty';
import type {ReadStream, WriteStream} from 'node:tty';
import chalk from 'chalk';
import {KEYS} from 'jest-watcher';
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import type {WriteStream} from 'tty';
import type {WriteStream} from 'node:tty';
import type {Config} from '@jest/types';
const VERSION = require('../../package.json').version;
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import type {ReadStream, WriteStream} from 'tty';
import type {ReadStream, WriteStream} from 'node:tty';
import {BaseWatchPlugin, type UsageData} from 'jest-watcher';
class QuitPlugin extends BaseWatchPlugin {
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import type {ReadStream, WriteStream} from 'tty';
import type {ReadStream, WriteStream} from 'node:tty';
import type {Config} from '@jest/types';
import {
BaseWatchPlugin,
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import type {ReadStream, WriteStream} from 'tty';
import type {ReadStream, WriteStream} from 'node:tty';
import type {Config} from '@jest/types';
import {
BaseWatchPlugin,
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import type {ReadStream, WriteStream} from 'tty';
import type {ReadStream, WriteStream} from 'node:tty';
import type {Config} from '@jest/types';
import {
BaseWatchPlugin,
+3 -3
View File
@@ -5,9 +5,9 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import {performance} from 'perf_hooks';
import type {WriteStream} from 'tty';
import * as path from 'node:path';
import {performance} from 'node:perf_hooks';
import type {WriteStream} from 'node:tty';
import chalk from 'chalk';
import exit from 'exit-x';
import * as fs from 'graceful-fs';
+2 -2
View File
@@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import type {WriteStream} from 'tty';
import * as path from 'node:path';
import type {WriteStream} from 'node:tty';
import ansiEscapes from 'ansi-escapes';
import chalk from 'chalk';
import exit from 'exit-x';
@@ -6,10 +6,10 @@
*
*/
import {createHash} from 'crypto';
import {createHash} from 'node:crypto';
// eslint-disable-next-line no-restricted-imports
import {readFileSync} from 'fs';
import {relative} from 'path';
import {readFileSync} from 'node:fs';
import {relative} from 'node:path';
import type {Config} from '@jest/types';
type OldCacheKeyOptions = {
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import {EOL} from 'os';
import {EOL} from 'node:os';
import detectNewline from 'detect-newline';
export type Pragmas = Record<string, string | Array<string>>;
+1 -1
View File
@@ -6,7 +6,7 @@
*
*/
import * as util from 'util';
import * as util from 'node:util';
import type {Global} from '@jest/types';
import {format as pretty} from 'pretty-format';
import type {EachTests} from '../bind';
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import type {Context} from 'vm';
import type {Context} from 'node:vm';
import type * as jsdom from 'jsdom';
import type {
EnvironmentContext,
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import {type Context, createContext, runInContext} from 'vm';
import {type Context, createContext, runInContext} from 'node:vm';
import type {
EnvironmentContext,
JestEnvironment,
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import type {Context} from 'vm';
import type {Context} from 'node:vm';
import type {LegacyFakeTimers, ModernFakeTimers} from '@jest/fake-timers';
import type {Circus, Config, Global} from '@jest/types';
import type {Mocked, ModuleMocker} from 'jest-mock';
@@ -7,7 +7,7 @@
/* eslint-disable local/prefer-spread-eventually */
import {promisify} from 'util';
import {promisify} from 'node:util';
import {type StackTraceConfig, formatStackTrace} from 'jest-message-util';
import type {
FunctionLike,
+2 -2
View File
@@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
import {spawn} from 'child_process';
import * as path from 'path';
import {spawn} from 'node:child_process';
import * as path from 'node:path';
import * as fs from 'graceful-fs';
import H from '../constants';
import * as fastPath from '../lib/fast_path';
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
import * as watchman from 'fb-watchman';
import H from '../constants';
import * as fastPath from '../lib/fast_path';
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
const MOCKS_PATTERN = `${path.sep}__mocks__${path.sep}`;
+5 -5
View File
@@ -5,11 +5,11 @@
* LICENSE file in the root directory of this source tree.
*/
import {createHash} from 'crypto';
import {EventEmitter} from 'events';
import {tmpdir} from 'os';
import * as path from 'path';
import {deserialize, serialize} from 'v8';
import {createHash} from 'node:crypto';
import {EventEmitter} from 'node:events';
import {tmpdir} from 'node:os';
import * as path from 'node:path';
import {deserialize, serialize} from 'node:v8';
import {type Stats, readFileSync, writeFileSync} from 'graceful-fs';
import type {Config} from '@jest/types';
import {escapePathForRegex} from 'jest-regex-util';
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
// rootDir and filename must be absolute paths (resolved)
export function relative(rootDir: string, filename: string): string {
@@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
import {execFile} from 'child_process';
import {promisify} from 'util';
import {execFile} from 'node:child_process';
import {promisify} from 'node:util';
export default async function isWatchmanInstalled(): Promise<boolean> {
try {
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
let normalizePathSep: (string: string) => string;
if (path.sep === '/') {
+1 -1
View File
@@ -6,7 +6,7 @@
*/
// eslint-disable-next-line no-restricted-imports
import type {Stats} from 'fs';
import type {Stats} from 'node:fs';
import type HasteFS from './HasteFS';
import type ModuleMap from './ModuleMap';
@@ -6,8 +6,8 @@
*
*/
import {EventEmitter} from 'events';
import * as path from 'path';
import {EventEmitter} from 'node:events';
import * as path from 'node:path';
import anymatch, {type Matcher} from 'anymatch';
import * as fs from 'graceful-fs';
// @ts-expect-error -- no types
@@ -2,10 +2,10 @@
'use strict';
const EventEmitter = require('events').EventEmitter;
const fs = require('fs');
const platform = require('os').platform();
const path = require('path');
const EventEmitter = require('node:events').EventEmitter;
const fs = require('node:fs');
const platform = require('node:os').platform();
const path = require('node:path');
const common = require('./common');
/**
@@ -5,9 +5,9 @@
* LICENSE file in the root directory of this source tree.
*/
import {strict as assert} from 'assert';
import {EventEmitter} from 'events';
import * as path from 'path';
import {strict as assert} from 'node:assert';
import {EventEmitter} from 'node:events';
import * as path from 'node:path';
import watchman from 'fb-watchman';
import fs from 'graceful-fs';
import RecrawlWarning from './RecrawlWarning';
@@ -2,8 +2,8 @@
'use strict';
const platform = require('os').platform();
const path = require('path');
const platform = require('node:os').platform();
const path = require('node:path');
const anymatch = require('anymatch');
const picomatch = require('picomatch');
const walker = require('walker');
+2 -2
View File
@@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
import {createHash} from 'crypto';
import * as path from 'path';
import {createHash} from 'node:crypto';
import * as path from 'node:path';
import * as fs from 'graceful-fs';
import {requireOrImportModule} from 'jest-util';
import blacklist from './blacklist';
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
import type {JestEnvironment} from '@jest/environment';
import {getCallsite} from '@jest/source-map';
import {
+1 -1
View File
@@ -30,7 +30,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* eslint-disable sort-keys */
import {AssertionError} from 'assert';
import {AssertionError} from 'node:assert';
import type {Circus} from '@jest/types';
import {ErrorWithStack, convertDescriptorToString, isPromise} from 'jest-util';
import assertionErrorMessage from '../assertionErrorMessage';
+1 -1
View File
@@ -30,7 +30,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* eslint-disable sort-keys, @typescript-eslint/no-empty-function */
import {AssertionError} from 'assert';
import {AssertionError} from 'node:assert';
import type {FailedAssertion, Status} from '@jest/test-result';
import type {Circus} from '@jest/types';
import {convertDescriptorToString} from 'jest-util';
+2 -2
View File
@@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
import type {AssertionError} from 'assert';
import type * as Process from 'process';
import type {AssertionError} from 'node:assert';
import type * as Process from 'node:process';
import type {AsymmetricMatchers, JestExpect} from '@jest/expect';
import type CallTracker from './jasmine/CallTracker';
import type Env from './jasmine/Env';
+3 -3
View File
@@ -6,9 +6,9 @@
*/
/// <reference lib="es2021.WeakRef" />
import {promisify} from 'util';
import {getHeapSnapshot, setFlagsFromString} from 'v8';
import {runInNewContext} from 'vm';
import {promisify} from 'node:util';
import {getHeapSnapshot, setFlagsFromString} from 'node:v8';
import {runInNewContext} from 'node:vm';
import {isPrimitive} from '@jest/get-type';
import {format as prettyFormat} from 'pretty-format';
+2 -2
View File
@@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import {fileURLToPath} from 'url';
import * as path from 'node:path';
import {fileURLToPath} from 'node:url';
import {codeFrameColumns} from '@babel/code-frame';
import chalk from 'chalk';
import * as fs from 'graceful-fs';
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
import {replacePathSepForRegex} from 'jest-regex-util';
export class TestPathPatterns {
+1 -1
View File
@@ -6,7 +6,7 @@
*
*/
import {sep} from 'path';
import {sep} from 'node:path';
export const escapePathForRegex = (dir: string): string => {
if (sep === '\\') {
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import type {WriteStream} from 'tty';
import type {WriteStream} from 'node:tty';
import type {
AggregatedResult,
Test,
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
import {mergeProcessCovs} from '@bcoe/v8-coverage';
import type {EncodedSourceMap} from '@jridgewell/trace-mapping';
import chalk from 'chalk';
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import type {WriteStream} from 'tty';
import type {WriteStream} from 'node:tty';
import chalk from 'chalk';
import {getConsoleOutput} from '@jest/console';
import type {
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import {stripVTControlCharacters as stripAnsi} from 'util';
import {stripVTControlCharacters as stripAnsi} from 'node:util';
import chalk from 'chalk';
import {type ConsoleBuffer, getConsoleOutput} from '@jest/console';
import type {
@@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as util from 'util';
import * as path from 'node:path';
import * as util from 'node:util';
import exit from 'exit-x';
import type {AggregatedResult, TestContext} 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 type {WriteStream} from 'tty';
import type {WriteStream} from 'node:tty';
import chalk from 'chalk';
import type {
AggregatedResult,
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
import chalk from 'chalk';
import slash from 'slash';
import type {Config} from '@jest/types';
+1 -1
View File
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import * as path from 'path';
import * as path from 'node:path';
import type {Config} from '@jest/types';
export default function relativePath(

Some files were not shown because too many files have changed in this diff Show More