mirror of https://github.com/facebook/jest.git
chore: use consistent type imports (#14662)
This commit is contained in:
parent
79a4ff4985
commit
5ce83ac4bc
|
@ -46,6 +46,11 @@ module.exports = {
|
||||||
rules: {
|
rules: {
|
||||||
'@typescript-eslint/array-type': ['error', {default: 'generic'}],
|
'@typescript-eslint/array-type': ['error', {default: 'generic'}],
|
||||||
'@typescript-eslint/ban-types': 'error',
|
'@typescript-eslint/ban-types': 'error',
|
||||||
|
'@typescript-eslint/consistent-type-imports': [
|
||||||
|
'error',
|
||||||
|
{fixStyle: 'inline-type-imports', disallowTypeAnnotations: false},
|
||||||
|
],
|
||||||
|
'@typescript-eslint/no-import-type-side-effects': 'error',
|
||||||
'@typescript-eslint/no-inferrable-types': 'error',
|
'@typescript-eslint/no-inferrable-types': 'error',
|
||||||
'@typescript-eslint/no-unused-vars': [
|
'@typescript-eslint/no-unused-vars': [
|
||||||
'error',
|
'error',
|
||||||
|
@ -278,6 +283,16 @@ module.exports = {
|
||||||
'no-restricted-imports': 'off',
|
'no-restricted-imports': 'off',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
files: ['examples/angular/**/*'],
|
||||||
|
rules: {
|
||||||
|
// Angular DI for some reason doesn't work with type imports
|
||||||
|
'@typescript-eslint/consistent-type-imports': [
|
||||||
|
'error',
|
||||||
|
{prefer: 'no-type-imports', disallowTypeAnnotations: false},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
files: 'packages/**/*.ts',
|
files: 'packages/**/*.ts',
|
||||||
rules: {
|
rules: {
|
||||||
|
@ -416,6 +431,7 @@ module.exports = {
|
||||||
'handle-callback-err': 'off',
|
'handle-callback-err': 'off',
|
||||||
'id-length': 'off',
|
'id-length': 'off',
|
||||||
'id-match': 'off',
|
'id-match': 'off',
|
||||||
|
'import/no-duplicates': 'error',
|
||||||
'import/no-extraneous-dependencies': [
|
'import/no-extraneous-dependencies': [
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
|
|
|
@ -736,7 +736,7 @@ export function setDateNow(now: number): jest.Spied<typeof Date.now> {
|
||||||
```
|
```
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import {afterEach, expect, jest, test} from '@jest/globals';
|
import {afterEach, expect, type jest, test} from '@jest/globals';
|
||||||
import {setDateNow} from './__utils__/setDateNow';
|
import {setDateNow} from './__utils__/setDateNow';
|
||||||
|
|
||||||
let spiedDateNow: jest.Spied<typeof Date.now> | undefined = undefined;
|
let spiedDateNow: jest.Spied<typeof Date.now> | undefined = undefined;
|
||||||
|
|
|
@ -9,9 +9,9 @@ import * as path from 'path';
|
||||||
import * as util from 'util';
|
import * as util from 'util';
|
||||||
import dedent from 'dedent';
|
import dedent from 'dedent';
|
||||||
import {
|
import {
|
||||||
ExecaSyncError,
|
type ExecaSyncError,
|
||||||
SyncOptions as ExecaSyncOptions,
|
type SyncOptions as ExecaSyncOptions,
|
||||||
ExecaSyncReturnValue,
|
type ExecaSyncReturnValue,
|
||||||
sync as spawnSync,
|
sync as spawnSync,
|
||||||
} from 'execa';
|
} from 'execa';
|
||||||
import * as fs from 'graceful-fs';
|
import * as fs from 'graceful-fs';
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import runJest, {RunJestResult} from '../runJest';
|
import runJest, {type RunJestResult} from '../runJest';
|
||||||
|
|
||||||
const getLog = (result: RunJestResult) => result.stdout.split('\n')[1].trim();
|
const getLog = (result: RunJestResult) => result.stdout.split('\n')[1].trim();
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import {skipSuiteOnJasmine} from '@jest/test-utils';
|
import {skipSuiteOnJasmine} from '@jest/test-utils';
|
||||||
import {extractSummary} from '../Utils';
|
import {extractSummary} from '../Utils';
|
||||||
import runJest, {RunJestResult} from '../runJest';
|
import runJest, {type RunJestResult} from '../runJest';
|
||||||
|
|
||||||
skipSuiteOnJasmine();
|
skipSuiteOnJasmine();
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
import {resolve} from 'path';
|
import {resolve} from 'path';
|
||||||
import run, {
|
import run, {
|
||||||
RunJestJsonResult,
|
type RunJestJsonResult,
|
||||||
RunJestResult,
|
type RunJestResult,
|
||||||
json as runWithJson,
|
json as runWithJson,
|
||||||
} from '../runJest';
|
} from '../runJest';
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import {tmpdir} from 'os';
|
import {tmpdir} from 'os';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import {
|
import {
|
||||||
PackageJson,
|
type PackageJson,
|
||||||
cleanup,
|
cleanup,
|
||||||
createEmptyPackage,
|
createEmptyPackage,
|
||||||
runYarnInstall,
|
runYarnInstall,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* eslint-disable no-duplicate-imports */
|
/* eslint-disable no-duplicate-imports, import/no-duplicates */
|
||||||
import {jest} from '@jest/globals';
|
import {jest} from '@jest/globals';
|
||||||
import {jest as aliasedJest} from '@jest/globals';
|
import {jest as aliasedJest} from '@jest/globals';
|
||||||
import * as JestGlobals from '@jest/globals';
|
import * as JestGlobals from '@jest/globals';
|
||||||
|
|
|
@ -18,9 +18,11 @@ import staticImportedStatefulFromCjs from '../fromCjs.mjs';
|
||||||
import {double} from '../index';
|
import {double} from '../index';
|
||||||
import defaultFromCjs, {half, namedFunction} from '../namedExport.cjs';
|
import defaultFromCjs, {half, namedFunction} from '../namedExport.cjs';
|
||||||
import {bag} from '../namespaceExport.js';
|
import {bag} from '../namespaceExport.js';
|
||||||
|
/* eslint-disable import/no-duplicates */
|
||||||
import staticImportedStateful from '../stateful.mjs';
|
import staticImportedStateful from '../stateful.mjs';
|
||||||
import staticImportedStatefulWithQuery from '../stateful.mjs?query=1';
|
import staticImportedStatefulWithQuery from '../stateful.mjs?query=1';
|
||||||
import staticImportedStatefulWithAnotherQuery from '../stateful.mjs?query=2';
|
import staticImportedStatefulWithAnotherQuery from '../stateful.mjs?query=2';
|
||||||
|
/* eslint-enable */
|
||||||
|
|
||||||
test('should have correct import.meta', () => {
|
test('should have correct import.meta', () => {
|
||||||
expect(typeof require).toBe('undefined');
|
expect(typeof require).toBe('undefined');
|
||||||
|
|
|
@ -6,7 +6,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import pLimit from 'p-limit';
|
import pLimit from 'p-limit';
|
||||||
import {Test, TestResult, createEmptyTestResult} from '@jest/test-result';
|
import {
|
||||||
|
type Test,
|
||||||
|
type TestResult,
|
||||||
|
createEmptyTestResult,
|
||||||
|
} from '@jest/test-result';
|
||||||
import type {Config} from '@jest/types';
|
import type {Config} from '@jest/types';
|
||||||
import type {
|
import type {
|
||||||
OnTestFailure,
|
OnTestFailure,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {SnapshotResolver} from 'jest-snapshot';
|
import type {SnapshotResolver} from 'jest-snapshot';
|
||||||
|
|
||||||
const snapshotResolver: SnapshotResolver = {
|
const snapshotResolver: SnapshotResolver = {
|
||||||
resolveSnapshotPath: (testPath, snapshotExtension) =>
|
resolveSnapshotPath: (testPath, snapshotExtension) =>
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
import {JestEnvironment} from '@jest/environment';
|
import type {JestEnvironment} from '@jest/environment';
|
||||||
import {TestResult, createEmptyTestResult} from '@jest/test-result';
|
import {type TestResult, createEmptyTestResult} from '@jest/test-result';
|
||||||
import {Config} from '@jest/types';
|
import type {Config} from '@jest/types';
|
||||||
import Runtime from 'jest-runtime';
|
import type Runtime from 'jest-runtime';
|
||||||
|
|
||||||
export default async function testRunner(
|
export default async function testRunner(
|
||||||
globalConfig: Config.GlobalConfig,
|
globalConfig: Config.GlobalConfig,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import Memory from './Memory';
|
import type Memory from './Memory';
|
||||||
import sub from './sub';
|
import sub from './sub';
|
||||||
import sum from './sum';
|
import sum from './sum';
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
import {createHash} from 'crypto';
|
import {createHash} from 'crypto';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import {
|
import {
|
||||||
PartialConfig,
|
type PartialConfig,
|
||||||
TransformOptions,
|
type TransformOptions,
|
||||||
transformSync as babelTransform,
|
transformSync as babelTransform,
|
||||||
transformAsync as babelTransformAsync,
|
transformAsync as babelTransformAsync,
|
||||||
} from '@babel/core';
|
} from '@babel/core';
|
||||||
|
|
|
@ -10,17 +10,17 @@ import type {PluginObj} from '@babel/core';
|
||||||
import {statement} from '@babel/template';
|
import {statement} from '@babel/template';
|
||||||
import type {NodePath} from '@babel/traverse';
|
import type {NodePath} from '@babel/traverse';
|
||||||
import {
|
import {
|
||||||
BlockStatement,
|
type BlockStatement,
|
||||||
CallExpression,
|
type CallExpression,
|
||||||
Expression,
|
type Expression,
|
||||||
Identifier,
|
type Identifier,
|
||||||
ImportDeclaration,
|
type ImportDeclaration,
|
||||||
MemberExpression,
|
type MemberExpression,
|
||||||
Node,
|
type Node,
|
||||||
Program,
|
type Program,
|
||||||
Super,
|
type Super,
|
||||||
VariableDeclaration,
|
type VariableDeclaration,
|
||||||
VariableDeclarator,
|
type VariableDeclarator,
|
||||||
callExpression,
|
callExpression,
|
||||||
emptyStatement,
|
emptyStatement,
|
||||||
isIdentifier,
|
isIdentifier,
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
import {expectAssignable, expectError, expectType} from 'tsd-lite';
|
import {expectAssignable, expectError, expectType} from 'tsd-lite';
|
||||||
import type {EqualsFunction} from '@jest/expect-utils';
|
import type {EqualsFunction} from '@jest/expect-utils';
|
||||||
import {
|
import {
|
||||||
MatcherContext,
|
type MatcherContext,
|
||||||
MatcherFunction,
|
type MatcherFunction,
|
||||||
MatcherFunctionWithContext,
|
type MatcherFunctionWithContext,
|
||||||
Matchers,
|
type Matchers,
|
||||||
Tester,
|
type Tester,
|
||||||
TesterContext,
|
type TesterContext,
|
||||||
expect,
|
expect,
|
||||||
} from 'expect';
|
} from 'expect';
|
||||||
import type * as jestMatcherUtils from 'jest-matcher-utils';
|
import type * as jestMatcherUtils from 'jest-matcher-utils';
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Tester, equals} from '@jest/expect-utils';
|
import {type Tester, equals} from '@jest/expect-utils';
|
||||||
import jestExpect from '../';
|
import jestExpect from '../';
|
||||||
|
|
||||||
// Test test file demonstrates and tests the capability of recursive custom
|
// Test test file demonstrates and tests the capability of recursive custom
|
||||||
|
|
|
@ -23,7 +23,7 @@ import {getType, isPrimitive} from 'jest-get-type';
|
||||||
import {
|
import {
|
||||||
DIM_COLOR,
|
DIM_COLOR,
|
||||||
EXPECTED_COLOR,
|
EXPECTED_COLOR,
|
||||||
MatcherHintOptions,
|
type MatcherHintOptions,
|
||||||
RECEIVED_COLOR,
|
RECEIVED_COLOR,
|
||||||
SUGGEST_TO_CONTAIN_EQUAL,
|
SUGGEST_TO_CONTAIN_EQUAL,
|
||||||
ensureExpectedIsNonNegativeInteger,
|
ensureExpectedIsNonNegativeInteger,
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {getType, isPrimitive} from 'jest-get-type';
|
||||||
import {
|
import {
|
||||||
DIM_COLOR,
|
DIM_COLOR,
|
||||||
EXPECTED_COLOR,
|
EXPECTED_COLOR,
|
||||||
MatcherHintOptions,
|
type MatcherHintOptions,
|
||||||
RECEIVED_COLOR,
|
RECEIVED_COLOR,
|
||||||
diff,
|
diff,
|
||||||
ensureExpectedIsNonNegativeInteger,
|
ensureExpectedIsNonNegativeInteger,
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
import {isError} from '@jest/expect-utils';
|
import {isError} from '@jest/expect-utils';
|
||||||
import {
|
import {
|
||||||
EXPECTED_COLOR,
|
EXPECTED_COLOR,
|
||||||
MatcherHintOptions,
|
type MatcherHintOptions,
|
||||||
RECEIVED_COLOR,
|
RECEIVED_COLOR,
|
||||||
matcherErrorMessage,
|
matcherErrorMessage,
|
||||||
matcherHint,
|
matcherHint,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import type {EqualsFunction, Tester} from '@jest/expect-utils';
|
import type {EqualsFunction, Tester} from '@jest/expect-utils';
|
||||||
import type * as jestMatcherUtils from 'jest-matcher-utils';
|
import type * as jestMatcherUtils from 'jest-matcher-utils';
|
||||||
import {INTERNAL_MATCHER_FLAG} from './jestMatchersObject';
|
import type {INTERNAL_MATCHER_FLAG} from './jestMatchersObject';
|
||||||
|
|
||||||
export type SyncExpectationResult = {
|
export type SyncExpectationResult = {
|
||||||
pass: boolean;
|
pass: boolean;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {AssertionError} from 'assert';
|
||||||
import chalk = require('chalk');
|
import chalk = require('chalk');
|
||||||
import type {Circus} from '@jest/types';
|
import type {Circus} from '@jest/types';
|
||||||
import {
|
import {
|
||||||
DiffOptions,
|
type DiffOptions,
|
||||||
diff,
|
diff,
|
||||||
printExpected,
|
printExpected,
|
||||||
printReceived,
|
printReceived,
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
|
|
||||||
import type * as Process from 'process';
|
import type * as Process from 'process';
|
||||||
import type {JestEnvironment} from '@jest/environment';
|
import type {JestEnvironment} from '@jest/environment';
|
||||||
import {JestExpect, jestExpect} from '@jest/expect';
|
import {type JestExpect, jestExpect} from '@jest/expect';
|
||||||
import {
|
import {
|
||||||
AssertionResult,
|
type AssertionResult,
|
||||||
Status,
|
type Status,
|
||||||
TestFileEvent,
|
type TestFileEvent,
|
||||||
TestResult,
|
type TestResult,
|
||||||
createEmptyTestResult,
|
createEmptyTestResult,
|
||||||
} from '@jest/test-result';
|
} from '@jest/test-result';
|
||||||
import type {Circus, Config, Global} from '@jest/types';
|
import type {Circus, Config, Global} from '@jest/types';
|
||||||
|
|
|
@ -10,7 +10,10 @@ import pLimit = require('p-limit');
|
||||||
import {jestExpect} from '@jest/expect';
|
import {jestExpect} from '@jest/expect';
|
||||||
import type {Circus, Global} from '@jest/types';
|
import type {Circus, Global} from '@jest/types';
|
||||||
import {invariant} from 'jest-util';
|
import {invariant} from 'jest-util';
|
||||||
import shuffleArray, {RandomNumberGenerator, rngBuilder} from './shuffleArray';
|
import shuffleArray, {
|
||||||
|
type RandomNumberGenerator,
|
||||||
|
rngBuilder,
|
||||||
|
} from './shuffleArray';
|
||||||
import {dispatch, getState} from './state';
|
import {dispatch, getState} from './state';
|
||||||
import {RETRY_TIMES} from './types';
|
import {RETRY_TIMES} from './types';
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import type {Config} from '@jest/types';
|
||||||
import {escapeStrForRegex} from 'jest-regex-util';
|
import {escapeStrForRegex} from 'jest-regex-util';
|
||||||
import Defaults from '../Defaults';
|
import Defaults from '../Defaults';
|
||||||
import {DEFAULT_JS_PATTERN} from '../constants';
|
import {DEFAULT_JS_PATTERN} from '../constants';
|
||||||
import normalize, {AllOptions} from '../normalize';
|
import normalize, {type AllOptions} from '../normalize';
|
||||||
|
|
||||||
const DEFAULT_CSS_PATTERN = '\\.(css)$';
|
const DEFAULT_CSS_PATTERN = '\\.(css)$';
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import {AssertionError, strict as assert} from 'assert';
|
import {AssertionError, strict as assert} from 'assert';
|
||||||
import {Console} from 'console';
|
import {Console} from 'console';
|
||||||
import {InspectOptions, format, formatWithOptions, inspect} from 'util';
|
import {type InspectOptions, format, formatWithOptions, inspect} from 'util';
|
||||||
import chalk = require('chalk');
|
import chalk = require('chalk');
|
||||||
import {ErrorWithStack, formatTime, invariant} from 'jest-util';
|
import {ErrorWithStack, formatTime, invariant} from 'jest-util';
|
||||||
import type {
|
import type {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import {AssertionError, strict as assert} from 'assert';
|
import {AssertionError, strict as assert} from 'assert';
|
||||||
import {Console} from 'console';
|
import {Console} from 'console';
|
||||||
import type {WriteStream} from 'tty';
|
import type {WriteStream} from 'tty';
|
||||||
import {InspectOptions, format, formatWithOptions, inspect} from 'util';
|
import {type InspectOptions, format, formatWithOptions, inspect} from 'util';
|
||||||
import chalk = require('chalk');
|
import chalk = require('chalk');
|
||||||
import {clearLine, formatTime} from 'jest-util';
|
import {clearLine, formatTime} from 'jest-util';
|
||||||
import type {LogCounters, LogMessage, LogTimers, LogType} from './types';
|
import type {LogCounters, LogMessage, LogTimers, LogType} from './types';
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
import chalk = require('chalk');
|
import chalk = require('chalk');
|
||||||
import type {Config} from '@jest/types';
|
import type {Config} from '@jest/types';
|
||||||
import {
|
import {
|
||||||
StackTraceConfig,
|
type StackTraceConfig,
|
||||||
StackTraceOptions,
|
type StackTraceOptions,
|
||||||
formatStackTrace,
|
formatStackTrace,
|
||||||
} from 'jest-message-util';
|
} from 'jest-message-util';
|
||||||
import type {ConsoleBuffer} from './types';
|
import type {ConsoleBuffer} from './types';
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
import {
|
import {
|
||||||
PatternPrompt,
|
PatternPrompt,
|
||||||
Prompt,
|
type Prompt,
|
||||||
ScrollOptions,
|
type ScrollOptions,
|
||||||
printPatternCaret,
|
printPatternCaret,
|
||||||
printRestoredPatternCaret,
|
printRestoredPatternCaret,
|
||||||
} from 'jest-watcher';
|
} from 'jest-watcher';
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
import {
|
import {
|
||||||
PatternPrompt,
|
PatternPrompt,
|
||||||
Prompt,
|
type Prompt,
|
||||||
ScrollOptions,
|
type ScrollOptions,
|
||||||
printPatternCaret,
|
printPatternCaret,
|
||||||
printRestoredPatternCaret,
|
printRestoredPatternCaret,
|
||||||
} from 'jest-watcher';
|
} from 'jest-watcher';
|
||||||
|
|
|
@ -12,20 +12,20 @@ import {
|
||||||
CoverageReporter,
|
CoverageReporter,
|
||||||
DefaultReporter,
|
DefaultReporter,
|
||||||
GitHubActionsReporter,
|
GitHubActionsReporter,
|
||||||
BaseReporter as JestReporter,
|
type BaseReporter as JestReporter,
|
||||||
NotifyReporter,
|
NotifyReporter,
|
||||||
Reporter,
|
type Reporter,
|
||||||
ReporterContext,
|
type ReporterContext,
|
||||||
SummaryReporter,
|
SummaryReporter,
|
||||||
SummaryReporterOptions,
|
type SummaryReporterOptions,
|
||||||
VerboseReporter,
|
VerboseReporter,
|
||||||
} from '@jest/reporters';
|
} from '@jest/reporters';
|
||||||
import {
|
import {
|
||||||
AggregatedResult,
|
type AggregatedResult,
|
||||||
SerializableError,
|
type SerializableError,
|
||||||
Test,
|
type Test,
|
||||||
TestContext,
|
type TestContext,
|
||||||
TestResult,
|
type TestResult,
|
||||||
addResult,
|
addResult,
|
||||||
buildFailureTestResult,
|
buildFailureTestResult,
|
||||||
makeEmptyAggregatedTestResult,
|
makeEmptyAggregatedTestResult,
|
||||||
|
|
|
@ -7,7 +7,10 @@
|
||||||
|
|
||||||
import chalk = require('chalk');
|
import chalk = require('chalk');
|
||||||
import type {Config} from '@jest/types';
|
import type {Config} from '@jest/types';
|
||||||
import {ChangedFilesPromise, getChangedFilesForRoots} from 'jest-changed-files';
|
import {
|
||||||
|
type ChangedFilesPromise,
|
||||||
|
getChangedFilesForRoots,
|
||||||
|
} from 'jest-changed-files';
|
||||||
import {formatExecError} from 'jest-message-util';
|
import {formatExecError} from 'jest-message-util';
|
||||||
|
|
||||||
export default function getChangedFilesPromise(
|
export default function getChangedFilesPromise(
|
||||||
|
|
|
@ -9,9 +9,9 @@ import type {AggregatedResult, AssertionLocation} from '@jest/test-result';
|
||||||
import type {Config} from '@jest/types';
|
import type {Config} from '@jest/types';
|
||||||
import {
|
import {
|
||||||
BaseWatchPlugin,
|
BaseWatchPlugin,
|
||||||
JestHookSubscriber,
|
type JestHookSubscriber,
|
||||||
UpdateConfigCallback,
|
type UpdateConfigCallback,
|
||||||
UsageData,
|
type UsageData,
|
||||||
} from 'jest-watcher';
|
} from 'jest-watcher';
|
||||||
import FailedTestsInteractiveMode from '../FailedTestsInteractiveMode';
|
import FailedTestsInteractiveMode from '../FailedTestsInteractiveMode';
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type {ReadStream, WriteStream} from 'tty';
|
import type {ReadStream, WriteStream} from 'tty';
|
||||||
import {BaseWatchPlugin, UsageData} from 'jest-watcher';
|
import {BaseWatchPlugin, type UsageData} from 'jest-watcher';
|
||||||
|
|
||||||
class QuitPlugin extends BaseWatchPlugin {
|
class QuitPlugin extends BaseWatchPlugin {
|
||||||
isInternal: true;
|
isInternal: true;
|
||||||
|
|
|
@ -10,8 +10,8 @@ import type {Config} from '@jest/types';
|
||||||
import {
|
import {
|
||||||
BaseWatchPlugin,
|
BaseWatchPlugin,
|
||||||
Prompt,
|
Prompt,
|
||||||
UpdateConfigCallback,
|
type UpdateConfigCallback,
|
||||||
UsageData,
|
type UsageData,
|
||||||
} from 'jest-watcher';
|
} from 'jest-watcher';
|
||||||
import TestNamePatternPrompt from '../TestNamePatternPrompt';
|
import TestNamePatternPrompt from '../TestNamePatternPrompt';
|
||||||
import activeFilters from '../lib/activeFiltersMessage';
|
import activeFilters from '../lib/activeFiltersMessage';
|
||||||
|
|
|
@ -10,8 +10,8 @@ import type {Config} from '@jest/types';
|
||||||
import {
|
import {
|
||||||
BaseWatchPlugin,
|
BaseWatchPlugin,
|
||||||
Prompt,
|
Prompt,
|
||||||
UpdateConfigCallback,
|
type UpdateConfigCallback,
|
||||||
UsageData,
|
type UsageData,
|
||||||
} from 'jest-watcher';
|
} from 'jest-watcher';
|
||||||
import TestPathPatternPrompt from '../TestPathPatternPrompt';
|
import TestPathPatternPrompt from '../TestPathPatternPrompt';
|
||||||
import activeFilters from '../lib/activeFiltersMessage';
|
import activeFilters from '../lib/activeFiltersMessage';
|
||||||
|
|
|
@ -9,9 +9,9 @@ import type {ReadStream, WriteStream} from 'tty';
|
||||||
import type {Config} from '@jest/types';
|
import type {Config} from '@jest/types';
|
||||||
import {
|
import {
|
||||||
BaseWatchPlugin,
|
BaseWatchPlugin,
|
||||||
JestHookSubscriber,
|
type JestHookSubscriber,
|
||||||
UpdateConfigCallback,
|
type UpdateConfigCallback,
|
||||||
UsageData,
|
type UsageData,
|
||||||
} from 'jest-watcher';
|
} from 'jest-watcher';
|
||||||
|
|
||||||
class UpdateSnapshotsPlugin extends BaseWatchPlugin {
|
class UpdateSnapshotsPlugin extends BaseWatchPlugin {
|
||||||
|
|
|
@ -9,7 +9,11 @@
|
||||||
|
|
||||||
import type {AggregatedResult, AssertionLocation} from '@jest/test-result';
|
import type {AggregatedResult, AssertionLocation} from '@jest/test-result';
|
||||||
import type {Config} from '@jest/types';
|
import type {Config} from '@jest/types';
|
||||||
import {BaseWatchPlugin, JestHookSubscriber, UsageData} from 'jest-watcher';
|
import {
|
||||||
|
BaseWatchPlugin,
|
||||||
|
type JestHookSubscriber,
|
||||||
|
type UsageData,
|
||||||
|
} from 'jest-watcher';
|
||||||
import SnapshotInteractiveMode from '../SnapshotInteractiveMode';
|
import SnapshotInteractiveMode from '../SnapshotInteractiveMode';
|
||||||
|
|
||||||
class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin {
|
class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin {
|
||||||
|
|
|
@ -13,10 +13,10 @@ import exit = require('exit');
|
||||||
import * as fs from 'graceful-fs';
|
import * as fs from 'graceful-fs';
|
||||||
import {CustomConsole} from '@jest/console';
|
import {CustomConsole} from '@jest/console';
|
||||||
import {
|
import {
|
||||||
AggregatedResult,
|
type AggregatedResult,
|
||||||
Test,
|
type Test,
|
||||||
TestContext,
|
type TestContext,
|
||||||
TestResultsProcessor,
|
type TestResultsProcessor,
|
||||||
formatTestResults,
|
formatTestResults,
|
||||||
makeEmptyAggregatedTestResult,
|
makeEmptyAggregatedTestResult,
|
||||||
} from '@jest/test-result';
|
} from '@jest/test-result';
|
||||||
|
@ -25,11 +25,13 @@ import type {Config} from '@jest/types';
|
||||||
import type {ChangedFiles, ChangedFilesPromise} from 'jest-changed-files';
|
import type {ChangedFiles, ChangedFilesPromise} from 'jest-changed-files';
|
||||||
import Resolver from 'jest-resolve';
|
import Resolver from 'jest-resolve';
|
||||||
import {requireOrImportModule, tryRealpath} from 'jest-util';
|
import {requireOrImportModule, tryRealpath} from 'jest-util';
|
||||||
import {JestHook, JestHookEmitter, TestWatcher} from 'jest-watcher';
|
import {JestHook, type JestHookEmitter, type TestWatcher} from 'jest-watcher';
|
||||||
import type FailedTestsCache from './FailedTestsCache';
|
import type FailedTestsCache from './FailedTestsCache';
|
||||||
import SearchSource from './SearchSource';
|
import SearchSource from './SearchSource';
|
||||||
import {TestSchedulerContext, createTestScheduler} from './TestScheduler';
|
import {type TestSchedulerContext, createTestScheduler} from './TestScheduler';
|
||||||
import collectNodeHandles, {HandleCollectionResult} from './collectHandles';
|
import collectNodeHandles, {
|
||||||
|
type HandleCollectionResult,
|
||||||
|
} from './collectHandles';
|
||||||
import getNoTestsFoundMessage from './getNoTestsFoundMessage';
|
import getNoTestsFoundMessage from './getNoTestsFoundMessage';
|
||||||
import runGlobalHook from './runGlobalHook';
|
import runGlobalHook from './runGlobalHook';
|
||||||
import type {Filter, TestRunData} from './types';
|
import type {Filter, TestRunData} from './types';
|
||||||
|
|
|
@ -24,12 +24,12 @@ import {
|
||||||
} from 'jest-util';
|
} from 'jest-util';
|
||||||
import {ValidationError} from 'jest-validate';
|
import {ValidationError} from 'jest-validate';
|
||||||
import {
|
import {
|
||||||
AllowedConfigOptions,
|
type AllowedConfigOptions,
|
||||||
JestHook,
|
JestHook,
|
||||||
KEYS,
|
KEYS,
|
||||||
TestWatcher,
|
TestWatcher,
|
||||||
WatchPlugin,
|
type WatchPlugin,
|
||||||
WatchPluginClass,
|
type WatchPluginClass,
|
||||||
} from 'jest-watcher';
|
} from 'jest-watcher';
|
||||||
import FailedTestsCache from './FailedTestsCache';
|
import FailedTestsCache from './FailedTestsCache';
|
||||||
import SearchSource from './SearchSource';
|
import SearchSource from './SearchSource';
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import chalk = require('chalk');
|
import chalk = require('chalk');
|
||||||
import {getType} from 'jest-get-type';
|
import {getType} from 'jest-get-type';
|
||||||
import {
|
import {
|
||||||
PrettyFormatOptions,
|
type PrettyFormatOptions,
|
||||||
format as prettyFormat,
|
format as prettyFormat,
|
||||||
plugins as prettyFormatPlugins,
|
plugins as prettyFormatPlugins,
|
||||||
} from 'pretty-format';
|
} from 'pretty-format';
|
||||||
|
|
|
@ -5,7 +5,12 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff} from './cleanupSemantic';
|
import {
|
||||||
|
DIFF_DELETE,
|
||||||
|
DIFF_EQUAL,
|
||||||
|
DIFF_INSERT,
|
||||||
|
type Diff,
|
||||||
|
} from './cleanupSemantic';
|
||||||
import type {DiffOptionsColor, DiffOptionsNormalized} from './types';
|
import type {DiffOptionsColor, DiffOptionsNormalized} from './types';
|
||||||
|
|
||||||
const formatTrailingSpaces = (
|
const formatTrailingSpaces = (
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {DIFF_EQUAL, Diff, cleanupSemantic} from './cleanupSemantic';
|
import {DIFF_EQUAL, type Diff, cleanupSemantic} from './cleanupSemantic';
|
||||||
import {diffLinesUnified, printDiffLines} from './diffLines';
|
import {diffLinesUnified, printDiffLines} from './diffLines';
|
||||||
import diffStrings from './diffStrings';
|
import diffStrings from './diffStrings';
|
||||||
import getAlignedDiffs from './getAlignedDiffs';
|
import getAlignedDiffs from './getAlignedDiffs';
|
||||||
|
|
|
@ -10,7 +10,7 @@ import * as util from 'util';
|
||||||
import type {Global} from '@jest/types';
|
import type {Global} from '@jest/types';
|
||||||
import {format as pretty} from 'pretty-format';
|
import {format as pretty} from 'pretty-format';
|
||||||
import type {EachTests} from '../bind';
|
import type {EachTests} from '../bind';
|
||||||
import {Templates, interpolateVariables} from './interpolation';
|
import {type Templates, interpolateVariables} from './interpolation';
|
||||||
|
|
||||||
const SUPPORTED_PLACEHOLDERS = /%[sdifjoOp#]/g;
|
const SUPPORTED_PLACEHOLDERS = /%[sdifjoOp#]/g;
|
||||||
const PRETTY_PLACEHOLDER = '%p';
|
const PRETTY_PLACEHOLDER = '%p';
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
import type {Global} from '@jest/types';
|
import type {Global} from '@jest/types';
|
||||||
import type {EachTests} from '../bind';
|
import type {EachTests} from '../bind';
|
||||||
import {
|
import {
|
||||||
Headings,
|
type Headings,
|
||||||
Template,
|
type Template,
|
||||||
Templates,
|
type Templates,
|
||||||
interpolateVariables,
|
interpolateVariables,
|
||||||
} from './interpolation';
|
} from './interpolation';
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Context, createContext, runInContext} from 'vm';
|
import {type Context, createContext, runInContext} from 'vm';
|
||||||
import type {
|
import type {
|
||||||
EnvironmentContext,
|
EnvironmentContext,
|
||||||
JestEnvironment,
|
JestEnvironment,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
/* eslint-disable local/prefer-spread-eventually */
|
/* eslint-disable local/prefer-spread-eventually */
|
||||||
|
|
||||||
import {promisify} from 'util';
|
import {promisify} from 'util';
|
||||||
import {StackTraceConfig, formatStackTrace} from 'jest-message-util';
|
import {type StackTraceConfig, formatStackTrace} from 'jest-message-util';
|
||||||
import type {
|
import type {
|
||||||
FunctionLike,
|
FunctionLike,
|
||||||
Mock,
|
Mock,
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
FakeTimerWithContext,
|
type FakeTimerWithContext,
|
||||||
FakeMethod as FakeableAPI,
|
type FakeMethod as FakeableAPI,
|
||||||
InstalledClock,
|
type InstalledClock,
|
||||||
FakeTimerInstallOpts as SinonFakeTimersConfig,
|
type FakeTimerInstallOpts as SinonFakeTimersConfig,
|
||||||
withGlobal,
|
withGlobal,
|
||||||
} from '@sinonjs/fake-timers';
|
} from '@sinonjs/fake-timers';
|
||||||
import type {Config} from '@jest/types';
|
import type {Config} from '@jest/types';
|
||||||
|
|
|
@ -10,11 +10,11 @@ import {EventEmitter} from 'events';
|
||||||
import {tmpdir} from 'os';
|
import {tmpdir} from 'os';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import {deserialize, serialize} from 'v8';
|
import {deserialize, serialize} from 'v8';
|
||||||
import {Stats, readFileSync, writeFileSync} from 'graceful-fs';
|
import {type Stats, readFileSync, writeFileSync} from 'graceful-fs';
|
||||||
import type {Config} from '@jest/types';
|
import type {Config} from '@jest/types';
|
||||||
import {escapePathForRegex} from 'jest-regex-util';
|
import {escapePathForRegex} from 'jest-regex-util';
|
||||||
import {invariant, requireOrImportModule} from 'jest-util';
|
import {invariant, requireOrImportModule} from 'jest-util';
|
||||||
import {JestWorkerFarm, Worker} from 'jest-worker';
|
import {type JestWorkerFarm, Worker} from 'jest-worker';
|
||||||
import HasteFS from './HasteFS';
|
import HasteFS from './HasteFS';
|
||||||
import HasteModuleMap from './ModuleMap';
|
import HasteModuleMap from './ModuleMap';
|
||||||
import H from './constants';
|
import H from './constants';
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import {EventEmitter} from 'events';
|
import {EventEmitter} from 'events';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import anymatch, {Matcher} from 'anymatch';
|
import anymatch, {type Matcher} from 'anymatch';
|
||||||
import * as fs from 'graceful-fs';
|
import * as fs from 'graceful-fs';
|
||||||
import micromatch = require('micromatch');
|
import micromatch = require('micromatch');
|
||||||
// @ts-expect-error no types
|
// @ts-expect-error no types
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Suite, {Attributes} from '../jasmine/Suite';
|
import Suite, {type Attributes} from '../jasmine/Suite';
|
||||||
|
|
||||||
describe('Suite', () => {
|
describe('Suite', () => {
|
||||||
let suite: Suite;
|
let suite: Suite;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import queueRunner, {Options, QueueableFn} from '../queueRunner';
|
import queueRunner, {type Options, type QueueableFn} from '../queueRunner';
|
||||||
|
|
||||||
describe('queueRunner', () => {
|
describe('queueRunner', () => {
|
||||||
it('runs every function in the queue.', async () => {
|
it('runs every function in the queue.', async () => {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import chalk = require('chalk');
|
import chalk = require('chalk');
|
||||||
import {
|
import {
|
||||||
DiffOptions,
|
type DiffOptions,
|
||||||
diff,
|
diff,
|
||||||
printExpected,
|
printExpected,
|
||||||
printReceived,
|
printReceived,
|
||||||
|
|
|
@ -36,10 +36,10 @@ import {ErrorWithStack, convertDescriptorToString, isPromise} from 'jest-util';
|
||||||
import assertionErrorMessage from '../assertionErrorMessage';
|
import assertionErrorMessage from '../assertionErrorMessage';
|
||||||
import isError from '../isError';
|
import isError from '../isError';
|
||||||
import queueRunner, {
|
import queueRunner, {
|
||||||
Options as QueueRunnerOptions,
|
type Options as QueueRunnerOptions,
|
||||||
QueueableFn,
|
type QueueableFn,
|
||||||
} from '../queueRunner';
|
} from '../queueRunner';
|
||||||
import treeProcessor, {TreeNode} from '../treeProcessor';
|
import treeProcessor, {type TreeNode} from '../treeProcessor';
|
||||||
import type {
|
import type {
|
||||||
AssertionErrorWithStack,
|
AssertionErrorWithStack,
|
||||||
Jasmine,
|
Jasmine,
|
||||||
|
|
|
@ -37,7 +37,7 @@ import {convertDescriptorToString} from 'jest-util';
|
||||||
import ExpectationFailed from '../ExpectationFailed';
|
import ExpectationFailed from '../ExpectationFailed';
|
||||||
import assertionErrorMessage from '../assertionErrorMessage';
|
import assertionErrorMessage from '../assertionErrorMessage';
|
||||||
import expectationResultFactory, {
|
import expectationResultFactory, {
|
||||||
Options as ExpectationResultFactoryOptions,
|
type Options as ExpectationResultFactoryOptions,
|
||||||
} from '../expectationResultFactory';
|
} from '../expectationResultFactory';
|
||||||
import type {QueueableFn, default as queueRunner} from '../queueRunner';
|
import type {QueueableFn, default as queueRunner} from '../queueRunner';
|
||||||
import type {AssertionErrorWithStack} from '../types';
|
import type {AssertionErrorWithStack} from '../types';
|
||||||
|
|
|
@ -31,7 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
/* eslint-disable sort-keys, local/prefer-rest-params-eventually */
|
/* eslint-disable sort-keys, local/prefer-rest-params-eventually */
|
||||||
|
|
||||||
import type {Spy} from '../types';
|
import type {Spy} from '../types';
|
||||||
import CallTracker, {Context} from './CallTracker';
|
import CallTracker, {type Context} from './CallTracker';
|
||||||
import SpyStrategy from './SpyStrategy';
|
import SpyStrategy from './SpyStrategy';
|
||||||
|
|
||||||
interface Fn extends Record<string, unknown> {
|
interface Fn extends Record<string, unknown> {
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AssertionResult,
|
type AssertionResult,
|
||||||
TestResult,
|
type TestResult,
|
||||||
createEmptyTestResult,
|
createEmptyTestResult,
|
||||||
} from '@jest/test-result';
|
} from '@jest/test-result';
|
||||||
import type {Config} from '@jest/types';
|
import type {Config} from '@jest/types';
|
||||||
|
|
|
@ -10,7 +10,7 @@ import chalk = require('chalk');
|
||||||
import {alignedAnsiStyleSerializer} from '@jest/test-utils';
|
import {alignedAnsiStyleSerializer} from '@jest/test-utils';
|
||||||
import {format as prettyFormat} from 'pretty-format';
|
import {format as prettyFormat} from 'pretty-format';
|
||||||
import {
|
import {
|
||||||
MatcherHintOptions,
|
type MatcherHintOptions,
|
||||||
diff,
|
diff,
|
||||||
ensureNoExpected,
|
ensureNoExpected,
|
||||||
ensureNumbers,
|
ensureNumbers,
|
||||||
|
|
|
@ -12,8 +12,8 @@ import {
|
||||||
DIFF_DELETE,
|
DIFF_DELETE,
|
||||||
DIFF_EQUAL,
|
DIFF_EQUAL,
|
||||||
DIFF_INSERT,
|
DIFF_INSERT,
|
||||||
Diff,
|
type Diff,
|
||||||
DiffOptions as ImportDiffOptions,
|
type DiffOptions as ImportDiffOptions,
|
||||||
diff as diffDefault,
|
diff as diffDefault,
|
||||||
diffStringsRaw,
|
diffStringsRaw,
|
||||||
diffStringsUnified,
|
diffStringsUnified,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {expectType} from 'tsd-lite';
|
import {expectType} from 'tsd-lite';
|
||||||
import {MockMetadata, Mocked, ModuleMocker} from 'jest-mock';
|
import {type MockMetadata, type Mocked, ModuleMocker} from 'jest-mock';
|
||||||
|
|
||||||
class ExampleClass {
|
class ExampleClass {
|
||||||
memberA: Array<number>;
|
memberA: Array<number>;
|
||||||
|
|
|
@ -14,12 +14,12 @@ import {
|
||||||
expectType,
|
expectType,
|
||||||
} from 'tsd-lite';
|
} from 'tsd-lite';
|
||||||
import {
|
import {
|
||||||
Mock,
|
type Mock,
|
||||||
Replaced,
|
type Replaced,
|
||||||
SpiedClass,
|
type SpiedClass,
|
||||||
SpiedFunction,
|
type SpiedFunction,
|
||||||
SpiedGetter,
|
type SpiedGetter,
|
||||||
SpiedSetter,
|
type SpiedSetter,
|
||||||
fn,
|
fn,
|
||||||
replaceProperty,
|
replaceProperty,
|
||||||
spyOn,
|
spyOn,
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
/* eslint-disable local/ban-types-eventually, local/prefer-rest-params-eventually */
|
/* eslint-disable local/ban-types-eventually, local/prefer-rest-params-eventually */
|
||||||
|
|
||||||
import * as util from 'util';
|
import * as util from 'util';
|
||||||
import {Context, createContext, runInContext, runInNewContext} from 'vm';
|
import {type Context, createContext, runInContext, runInNewContext} from 'vm';
|
||||||
import {ModuleMocker, fn, mocked, spyOn} from '../';
|
import {ModuleMocker, fn, mocked, spyOn} from '../';
|
||||||
|
|
||||||
describe('moduleMocker', () => {
|
describe('moduleMocker', () => {
|
||||||
|
|
|
@ -7,11 +7,11 @@
|
||||||
|
|
||||||
import {expectError, expectType} from 'tsd-lite';
|
import {expectError, expectType} from 'tsd-lite';
|
||||||
import {
|
import {
|
||||||
AggregatedResult,
|
type AggregatedResult,
|
||||||
Config,
|
type Config,
|
||||||
SnapshotSummary,
|
type SnapshotSummary,
|
||||||
SummaryOptions,
|
type SummaryOptions,
|
||||||
TestResult,
|
type TestResult,
|
||||||
utils,
|
utils,
|
||||||
} from '@jest/reporters';
|
} from '@jest/reporters';
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ import type {
|
||||||
} from '@jest/test-result';
|
} from '@jest/test-result';
|
||||||
import type {Config} from '@jest/types';
|
import type {Config} from '@jest/types';
|
||||||
import {clearLine, isInteractive} from 'jest-util';
|
import {clearLine, isInteractive} from 'jest-util';
|
||||||
import {JestWorkerFarm, Worker} from 'jest-worker';
|
import {type JestWorkerFarm, Worker} from 'jest-worker';
|
||||||
import BaseReporter from './BaseReporter';
|
import BaseReporter from './BaseReporter';
|
||||||
import getWatermarks from './getWatermarks';
|
import getWatermarks from './getWatermarks';
|
||||||
import type {ReporterContext} from './types';
|
import type {ReporterContext} from './types';
|
||||||
|
|
|
@ -9,7 +9,7 @@ import exit = require('exit');
|
||||||
import * as fs from 'graceful-fs';
|
import * as fs from 'graceful-fs';
|
||||||
import type {Config} from '@jest/types';
|
import type {Config} from '@jest/types';
|
||||||
import generateEmptyCoverage, {
|
import generateEmptyCoverage, {
|
||||||
CoverageWorkerResult,
|
type CoverageWorkerResult,
|
||||||
} from './generateEmptyCoverage';
|
} from './generateEmptyCoverage';
|
||||||
import type {ReporterContext} from './types';
|
import type {ReporterContext} from './types';
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import type {V8Coverage} from 'collect-v8-coverage';
|
import type {V8Coverage} from 'collect-v8-coverage';
|
||||||
import * as fs from 'graceful-fs';
|
import * as fs from 'graceful-fs';
|
||||||
import {FileCoverage, createFileCoverage} from 'istanbul-lib-coverage';
|
import {type FileCoverage, createFileCoverage} from 'istanbul-lib-coverage';
|
||||||
import {readInitialCoverage} from 'istanbul-lib-instrument';
|
import {readInitialCoverage} from 'istanbul-lib-instrument';
|
||||||
import {createScriptTransformer, shouldInstrument} from '@jest/transform';
|
import {createScriptTransformer, shouldInstrument} from '@jest/transform';
|
||||||
import type {Config} from '@jest/types';
|
import type {Config} from '@jest/types';
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import type {IHasteFS} from 'jest-haste-map';
|
import type {IHasteFS} from 'jest-haste-map';
|
||||||
import type {ResolveModuleConfig, default as Resolver} from 'jest-resolve';
|
import type {ResolveModuleConfig, default as Resolver} from 'jest-resolve';
|
||||||
import {SnapshotResolver, isSnapshotPath} from 'jest-snapshot';
|
import {type SnapshotResolver, isSnapshotPath} from 'jest-snapshot';
|
||||||
|
|
||||||
export type ResolvedModule = {
|
export type ResolvedModule = {
|
||||||
file: string;
|
file: string;
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as fs from 'graceful-fs';
|
import * as fs from 'graceful-fs';
|
||||||
import {sync as resolveSync} from 'resolve';
|
import {sync as resolveSync} from 'resolve';
|
||||||
import {IModuleMap, ModuleMap} from 'jest-haste-map';
|
import {type IModuleMap, ModuleMap} from 'jest-haste-map';
|
||||||
import userResolver from '../__mocks__/userResolver';
|
import userResolver from '../__mocks__/userResolver';
|
||||||
import userResolverAsync from '../__mocks__/userResolverAsync';
|
import userResolverAsync from '../__mocks__/userResolverAsync';
|
||||||
import defaultResolver, {PackageFilter} from '../defaultResolver';
|
import defaultResolver, {type PackageFilter} from '../defaultResolver';
|
||||||
import nodeModulesPaths from '../nodeModulesPaths';
|
import nodeModulesPaths from '../nodeModulesPaths';
|
||||||
import Resolver from '../resolver';
|
import Resolver from '../resolver';
|
||||||
import type {ResolverConfig} from '../types';
|
import type {ResolverConfig} from '../types';
|
||||||
|
|
|
@ -7,7 +7,10 @@
|
||||||
|
|
||||||
import {dirname, isAbsolute, resolve as pathResolve} from 'path';
|
import {dirname, isAbsolute, resolve as pathResolve} from 'path';
|
||||||
import pnpResolver from 'jest-pnp-resolver';
|
import pnpResolver from 'jest-pnp-resolver';
|
||||||
import {SyncOpts as UpstreamResolveOptions, sync as resolveSync} from 'resolve';
|
import {
|
||||||
|
type SyncOpts as UpstreamResolveOptions,
|
||||||
|
sync as resolveSync,
|
||||||
|
} from 'resolve';
|
||||||
import * as resolve from 'resolve.exports';
|
import * as resolve from 'resolve.exports';
|
||||||
import {
|
import {
|
||||||
findClosestPackageJson,
|
findClosestPackageJson,
|
||||||
|
|
|
@ -14,9 +14,9 @@ import type {IModuleMap} from 'jest-haste-map';
|
||||||
import {tryRealpath} from 'jest-util';
|
import {tryRealpath} from 'jest-util';
|
||||||
import ModuleNotFoundError from './ModuleNotFoundError';
|
import ModuleNotFoundError from './ModuleNotFoundError';
|
||||||
import defaultResolver, {
|
import defaultResolver, {
|
||||||
AsyncResolver,
|
type AsyncResolver,
|
||||||
Resolver as ResolverInterface,
|
type Resolver as ResolverInterface,
|
||||||
SyncResolver,
|
type SyncResolver,
|
||||||
} from './defaultResolver';
|
} from './defaultResolver';
|
||||||
import {clearFsCache} from './fileWalkers';
|
import {clearFsCache} from './fileWalkers';
|
||||||
import isBuiltinModule from './isBuiltinModule';
|
import isBuiltinModule from './isBuiltinModule';
|
||||||
|
|
|
@ -8,19 +8,19 @@
|
||||||
import {expectType} from 'tsd-lite';
|
import {expectType} from 'tsd-lite';
|
||||||
import {
|
import {
|
||||||
CallbackTestRunner,
|
CallbackTestRunner,
|
||||||
CallbackTestRunnerInterface,
|
type CallbackTestRunnerInterface,
|
||||||
Config,
|
type Config,
|
||||||
EmittingTestRunner,
|
EmittingTestRunner,
|
||||||
EmittingTestRunnerInterface,
|
type EmittingTestRunnerInterface,
|
||||||
OnTestFailure,
|
type OnTestFailure,
|
||||||
OnTestStart,
|
type OnTestStart,
|
||||||
OnTestSuccess,
|
type OnTestSuccess,
|
||||||
Test,
|
type Test,
|
||||||
TestEvents,
|
type TestEvents,
|
||||||
TestRunnerContext,
|
type TestRunnerContext,
|
||||||
TestRunnerOptions,
|
type TestRunnerOptions,
|
||||||
TestWatcher,
|
type TestWatcher,
|
||||||
UnsubscribeFn,
|
type UnsubscribeFn,
|
||||||
} from 'jest-runner';
|
} from 'jest-runner';
|
||||||
|
|
||||||
const globalConfig = {} as Config.GlobalConfig;
|
const globalConfig = {} as Config.GlobalConfig;
|
||||||
|
|
|
@ -16,10 +16,18 @@ import type {
|
||||||
} from '@jest/test-result';
|
} from '@jest/test-result';
|
||||||
import {deepCyclicCopy} from 'jest-util';
|
import {deepCyclicCopy} from 'jest-util';
|
||||||
import type {TestWatcher} from 'jest-watcher';
|
import type {TestWatcher} from 'jest-watcher';
|
||||||
import {JestWorkerFarm, PromiseWithCustomMessage, Worker} from 'jest-worker';
|
import {
|
||||||
|
type JestWorkerFarm,
|
||||||
|
type PromiseWithCustomMessage,
|
||||||
|
Worker,
|
||||||
|
} from 'jest-worker';
|
||||||
import runTest from './runTest';
|
import runTest from './runTest';
|
||||||
import type {SerializableResolver} from './testWorker';
|
import type {SerializableResolver} from './testWorker';
|
||||||
import {EmittingTestRunner, TestRunnerOptions, UnsubscribeFn} from './types';
|
import {
|
||||||
|
EmittingTestRunner,
|
||||||
|
type TestRunnerOptions,
|
||||||
|
type UnsubscribeFn,
|
||||||
|
} from './types';
|
||||||
|
|
||||||
export type {Test, TestEvents} from '@jest/test-result';
|
export type {Test, TestEvents} from '@jest/test-result';
|
||||||
export type {Config} from '@jest/types';
|
export type {Config} from '@jest/types';
|
||||||
|
|
|
@ -12,8 +12,8 @@ import sourcemapSupport = require('source-map-support');
|
||||||
import {
|
import {
|
||||||
BufferedConsole,
|
BufferedConsole,
|
||||||
CustomConsole,
|
CustomConsole,
|
||||||
LogMessage,
|
type LogMessage,
|
||||||
LogType,
|
type LogType,
|
||||||
NullConsole,
|
NullConsole,
|
||||||
getConsoleOutput,
|
getConsoleOutput,
|
||||||
} from '@jest/console';
|
} from '@jest/console';
|
||||||
|
@ -24,6 +24,7 @@ import type {Config} from '@jest/types';
|
||||||
import * as docblock from 'jest-docblock';
|
import * as docblock from 'jest-docblock';
|
||||||
import LeakDetector from 'jest-leak-detector';
|
import LeakDetector from 'jest-leak-detector';
|
||||||
import {formatExecError} from 'jest-message-util';
|
import {formatExecError} from 'jest-message-util';
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
||||||
import Resolver, {resolveTestEnvironment} from 'jest-resolve';
|
import Resolver, {resolveTestEnvironment} from 'jest-resolve';
|
||||||
import type RuntimeClass from 'jest-runtime';
|
import type RuntimeClass from 'jest-runtime';
|
||||||
import {ErrorWithStack, interopRequireDefault, setGlobal} from 'jest-util';
|
import {ErrorWithStack, interopRequireDefault, setGlobal} from 'jest-util';
|
||||||
|
|
|
@ -13,7 +13,7 @@ import type {
|
||||||
TestResult,
|
TestResult,
|
||||||
} from '@jest/test-result';
|
} from '@jest/test-result';
|
||||||
import type {Config} from '@jest/types';
|
import type {Config} from '@jest/types';
|
||||||
import HasteMap, {SerializableModuleMap} from 'jest-haste-map';
|
import HasteMap, {type SerializableModuleMap} from 'jest-haste-map';
|
||||||
import {separateMessageFromStack} from 'jest-message-util';
|
import {separateMessageFromStack} from 'jest-message-util';
|
||||||
import type Resolver from 'jest-resolve';
|
import type Resolver from 'jest-resolve';
|
||||||
import Runtime from 'jest-runtime';
|
import Runtime from 'jest-runtime';
|
||||||
|
|
|
@ -14,12 +14,12 @@ import {
|
||||||
SourceTextModule,
|
SourceTextModule,
|
||||||
// @ts-expect-error: experimental, not added to the types
|
// @ts-expect-error: experimental, not added to the types
|
||||||
SyntheticModule,
|
SyntheticModule,
|
||||||
Context as VMContext,
|
type Context as VMContext,
|
||||||
// @ts-expect-error: experimental, not added to the types
|
// @ts-expect-error: experimental, not added to the types
|
||||||
Module as VMModule,
|
type Module as VMModule,
|
||||||
} from 'vm';
|
} from 'vm';
|
||||||
import {parse as parseCjs} from 'cjs-module-lexer';
|
import {parse as parseCjs} from 'cjs-module-lexer';
|
||||||
import {CoverageInstrumenter, V8Coverage} from 'collect-v8-coverage';
|
import {CoverageInstrumenter, type V8Coverage} from 'collect-v8-coverage';
|
||||||
import * as fs from 'graceful-fs';
|
import * as fs from 'graceful-fs';
|
||||||
import slash = require('slash');
|
import slash = require('slash');
|
||||||
import stripBOM = require('strip-bom');
|
import stripBOM = require('strip-bom');
|
||||||
|
@ -39,19 +39,19 @@ import type {
|
||||||
V8CoverageResult,
|
V8CoverageResult,
|
||||||
} from '@jest/test-result';
|
} from '@jest/test-result';
|
||||||
import {
|
import {
|
||||||
CallerTransformOptions,
|
type CallerTransformOptions,
|
||||||
ScriptTransformer,
|
type ScriptTransformer,
|
||||||
ShouldInstrumentOptions,
|
type ShouldInstrumentOptions,
|
||||||
TransformationOptions,
|
type TransformationOptions,
|
||||||
handlePotentialSyntaxError,
|
handlePotentialSyntaxError,
|
||||||
shouldInstrument,
|
shouldInstrument,
|
||||||
} from '@jest/transform';
|
} from '@jest/transform';
|
||||||
import type {Config, Global} from '@jest/types';
|
import type {Config, Global} from '@jest/types';
|
||||||
import HasteMap, {IHasteMap, IModuleMap} from 'jest-haste-map';
|
import HasteMap, {type IHasteMap, type IModuleMap} from 'jest-haste-map';
|
||||||
import {formatStackTrace, separateMessageFromStack} from 'jest-message-util';
|
import {formatStackTrace, separateMessageFromStack} from 'jest-message-util';
|
||||||
import type {MockMetadata, ModuleMocker} from 'jest-mock';
|
import type {MockMetadata, ModuleMocker} from 'jest-mock';
|
||||||
import {escapePathForRegex} from 'jest-regex-util';
|
import {escapePathForRegex} from 'jest-regex-util';
|
||||||
import Resolver, {ResolveModuleConfig} from 'jest-resolve';
|
import Resolver, {type ResolveModuleConfig} from 'jest-resolve';
|
||||||
import {EXTENSION as SnapshotExtension} from 'jest-snapshot';
|
import {EXTENSION as SnapshotExtension} from 'jest-snapshot';
|
||||||
import {
|
import {
|
||||||
createDirectory,
|
createDirectory,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Static, Type} from '@sinclair/typebox';
|
import {type Static, Type} from '@sinclair/typebox';
|
||||||
|
|
||||||
const RawSnapshotFormat = Type.Partial(
|
const RawSnapshotFormat = Type.Partial(
|
||||||
Type.Object({
|
Type.Object({
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
import {expectError, expectType} from 'tsd-lite';
|
import {expectError, expectType} from 'tsd-lite';
|
||||||
import type {ExpectationResult} from 'expect';
|
import type {ExpectationResult} from 'expect';
|
||||||
import {
|
import {
|
||||||
Context,
|
type Context,
|
||||||
SnapshotState,
|
type SnapshotState,
|
||||||
toMatchInlineSnapshot,
|
toMatchInlineSnapshot,
|
||||||
toMatchSnapshot,
|
toMatchSnapshot,
|
||||||
toThrowErrorMatchingInlineSnapshot,
|
toThrowErrorMatchingInlineSnapshot,
|
||||||
|
|
|
@ -7,7 +7,10 @@
|
||||||
|
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import {makeProjectConfig} from '@jest/test-utils';
|
import {makeProjectConfig} from '@jest/test-utils';
|
||||||
import {SnapshotResolver, buildSnapshotResolver} from '../SnapshotResolver';
|
import {
|
||||||
|
type SnapshotResolver,
|
||||||
|
buildSnapshotResolver,
|
||||||
|
} from '../SnapshotResolver';
|
||||||
|
|
||||||
describe('defaults', () => {
|
describe('defaults', () => {
|
||||||
let snapshotResolver: SnapshotResolver;
|
let snapshotResolver: SnapshotResolver;
|
||||||
|
|
|
@ -11,7 +11,7 @@ import chalk = require('chalk');
|
||||||
import type {SyncExpectationResult} from 'expect';
|
import type {SyncExpectationResult} from 'expect';
|
||||||
import format from 'pretty-format';
|
import format from 'pretty-format';
|
||||||
import {
|
import {
|
||||||
Context,
|
type Context,
|
||||||
toMatchInlineSnapshot,
|
toMatchInlineSnapshot,
|
||||||
toMatchSnapshot,
|
toMatchSnapshot,
|
||||||
toThrowErrorMatchingInlineSnapshot,
|
toThrowErrorMatchingInlineSnapshot,
|
||||||
|
|
|
@ -12,14 +12,14 @@ import type {MatcherFunctionWithContext} from 'expect';
|
||||||
import {
|
import {
|
||||||
BOLD_WEIGHT,
|
BOLD_WEIGHT,
|
||||||
EXPECTED_COLOR,
|
EXPECTED_COLOR,
|
||||||
MatcherHintOptions,
|
type MatcherHintOptions,
|
||||||
RECEIVED_COLOR,
|
RECEIVED_COLOR,
|
||||||
matcherErrorMessage,
|
matcherErrorMessage,
|
||||||
matcherHint,
|
matcherHint,
|
||||||
printWithType,
|
printWithType,
|
||||||
stringify,
|
stringify,
|
||||||
} from 'jest-matcher-utils';
|
} from 'jest-matcher-utils';
|
||||||
import {EXTENSION, SnapshotResolver} from './SnapshotResolver';
|
import {EXTENSION, type SnapshotResolver} from './SnapshotResolver';
|
||||||
import {
|
import {
|
||||||
PROPERTIES_ARG,
|
PROPERTIES_ARG,
|
||||||
SNAPSHOT_ARG,
|
SNAPSHOT_ARG,
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Plugin as PrettyFormatPlugin,
|
type Plugin as PrettyFormatPlugin,
|
||||||
Plugins as PrettyFormatPlugins,
|
type Plugins as PrettyFormatPlugins,
|
||||||
plugins as prettyFormatPlugins,
|
plugins as prettyFormatPlugins,
|
||||||
} from 'pretty-format';
|
} from 'pretty-format';
|
||||||
import jestMockSerializer from './mockSerializer';
|
import jestMockSerializer from './mockSerializer';
|
||||||
|
|
|
@ -11,8 +11,8 @@ import {
|
||||||
DIFF_DELETE,
|
DIFF_DELETE,
|
||||||
DIFF_EQUAL,
|
DIFF_EQUAL,
|
||||||
DIFF_INSERT,
|
DIFF_INSERT,
|
||||||
Diff,
|
type Diff,
|
||||||
DiffOptionsColor,
|
type DiffOptionsColor,
|
||||||
diffLinesUnified,
|
diffLinesUnified,
|
||||||
diffLinesUnified2,
|
diffLinesUnified2,
|
||||||
diffStringsRaw,
|
diffStringsRaw,
|
||||||
|
@ -23,7 +23,7 @@ import {
|
||||||
BOLD_WEIGHT,
|
BOLD_WEIGHT,
|
||||||
EXPECTED_COLOR,
|
EXPECTED_COLOR,
|
||||||
INVERTED_COLOR,
|
INVERTED_COLOR,
|
||||||
MatcherHintOptions,
|
type MatcherHintOptions,
|
||||||
RECEIVED_COLOR,
|
RECEIVED_COLOR,
|
||||||
getLabelPrinter,
|
getLabelPrinter,
|
||||||
matcherHint,
|
matcherHint,
|
||||||
|
|
|
@ -19,7 +19,7 @@ import * as fs from 'graceful-fs';
|
||||||
import naturalCompare = require('natural-compare');
|
import naturalCompare = require('natural-compare');
|
||||||
import type {Config} from '@jest/types';
|
import type {Config} from '@jest/types';
|
||||||
import {
|
import {
|
||||||
OptionsReceived as PrettyFormatOptions,
|
type OptionsReceived as PrettyFormatOptions,
|
||||||
format as prettyFormat,
|
format as prettyFormat,
|
||||||
} from 'pretty-format';
|
} from 'pretty-format';
|
||||||
import {getSerializers} from './plugins';
|
import {getSerializers} from './plugins';
|
||||||
|
|
|
@ -20,7 +20,7 @@ Another use-case for `@types/jest` is a typed Jest config as those types are not
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
// jest.config.ts
|
// jest.config.ts
|
||||||
import {Config} from '@jest/types';
|
import type {Config} from '@jest/types';
|
||||||
|
|
||||||
const config: Config.InitialOptions = {
|
const config: Config.InitialOptions = {
|
||||||
// some typed config
|
// some typed config
|
||||||
|
|
|
@ -8,17 +8,17 @@
|
||||||
import FifoQueue from './FifoQueue';
|
import FifoQueue from './FifoQueue';
|
||||||
import {
|
import {
|
||||||
CHILD_MESSAGE_CALL,
|
CHILD_MESSAGE_CALL,
|
||||||
ChildMessage,
|
type ChildMessage,
|
||||||
OnCustomMessage,
|
type OnCustomMessage,
|
||||||
OnEnd,
|
type OnEnd,
|
||||||
OnStart,
|
type OnStart,
|
||||||
PromiseWithCustomMessage,
|
type PromiseWithCustomMessage,
|
||||||
QueueChildMessage,
|
type QueueChildMessage,
|
||||||
TaskQueue,
|
type TaskQueue,
|
||||||
WorkerCallback,
|
type WorkerCallback,
|
||||||
WorkerFarmOptions,
|
type WorkerFarmOptions,
|
||||||
WorkerInterface,
|
type WorkerInterface,
|
||||||
WorkerSchedulingPolicy,
|
type WorkerSchedulingPolicy,
|
||||||
} from './types';
|
} from './types';
|
||||||
|
|
||||||
export default class Farm {
|
export default class Farm {
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
import FifoQueue from '../FifoQueue';
|
import FifoQueue from '../FifoQueue';
|
||||||
import {
|
import {
|
||||||
CHILD_MESSAGE_CALL,
|
CHILD_MESSAGE_CALL,
|
||||||
ChildMessageCall,
|
type ChildMessageCall,
|
||||||
QueueChildMessage,
|
type QueueChildMessage,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
|
|
||||||
it('returns the shared tasks in FIFO ordering', () => {
|
it('returns the shared tasks in FIFO ordering', () => {
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
import PriorityQueue from '../PriorityQueue';
|
import PriorityQueue from '../PriorityQueue';
|
||||||
import {
|
import {
|
||||||
CHILD_MESSAGE_CALL,
|
CHILD_MESSAGE_CALL,
|
||||||
ChildMessageCall,
|
type ChildMessageCall,
|
||||||
QueueChildMessage,
|
type QueueChildMessage,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
|
|
||||||
it('returns the tasks in order', () => {
|
it('returns the tasks in order', () => {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {tmpdir} from 'os';
|
||||||
import {join} from 'path';
|
import {join} from 'path';
|
||||||
import {writeFileSync} from 'graceful-fs';
|
import {writeFileSync} from 'graceful-fs';
|
||||||
import LeakDetector from 'jest-leak-detector';
|
import LeakDetector from 'jest-leak-detector';
|
||||||
import {JestWorkerFarm, Worker} from '../../build';
|
import {type JestWorkerFarm, Worker} from '../../build';
|
||||||
|
|
||||||
describe('WorkerThreads leaks', () => {
|
describe('WorkerThreads leaks', () => {
|
||||||
let workerFile: string;
|
let workerFile: string;
|
||||||
|
|
|
@ -9,10 +9,10 @@ import mergeStream = require('merge-stream');
|
||||||
import {
|
import {
|
||||||
CHILD_MESSAGE_CALL_SETUP,
|
CHILD_MESSAGE_CALL_SETUP,
|
||||||
CHILD_MESSAGE_END,
|
CHILD_MESSAGE_END,
|
||||||
PoolExitResult,
|
type PoolExitResult,
|
||||||
WorkerInterface,
|
type WorkerInterface,
|
||||||
WorkerOptions,
|
type WorkerOptions,
|
||||||
WorkerPoolOptions,
|
type WorkerPoolOptions,
|
||||||
WorkerStates,
|
WorkerStates,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CHILD_MESSAGE_END,
|
CHILD_MESSAGE_END,
|
||||||
WorkerInterface,
|
type WorkerInterface,
|
||||||
WorkerOptions,
|
type WorkerOptions,
|
||||||
WorkerPoolOptions,
|
type WorkerPoolOptions,
|
||||||
} from '../../types';
|
} from '../../types';
|
||||||
import BaseWorkerPool from '../BaseWorkerPool';
|
import BaseWorkerPool from '../BaseWorkerPool';
|
||||||
|
|
||||||
|
|
|
@ -5,25 +5,25 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {ChildProcess, ForkOptions, fork} from 'child_process';
|
import {type ChildProcess, type ForkOptions, fork} from 'child_process';
|
||||||
import {totalmem} from 'os';
|
import {totalmem} from 'os';
|
||||||
import mergeStream = require('merge-stream');
|
import mergeStream = require('merge-stream');
|
||||||
import {stdout as stdoutSupportsColor} from 'supports-color';
|
import {stdout as stdoutSupportsColor} from 'supports-color';
|
||||||
import {
|
import {
|
||||||
CHILD_MESSAGE_INITIALIZE,
|
CHILD_MESSAGE_INITIALIZE,
|
||||||
CHILD_MESSAGE_MEM_USAGE,
|
CHILD_MESSAGE_MEM_USAGE,
|
||||||
ChildMessage,
|
type ChildMessage,
|
||||||
OnCustomMessage,
|
type OnCustomMessage,
|
||||||
OnEnd,
|
type OnEnd,
|
||||||
OnStart,
|
type OnStart,
|
||||||
PARENT_MESSAGE_CLIENT_ERROR,
|
PARENT_MESSAGE_CLIENT_ERROR,
|
||||||
PARENT_MESSAGE_CUSTOM,
|
PARENT_MESSAGE_CUSTOM,
|
||||||
PARENT_MESSAGE_MEM_USAGE,
|
PARENT_MESSAGE_MEM_USAGE,
|
||||||
PARENT_MESSAGE_OK,
|
PARENT_MESSAGE_OK,
|
||||||
PARENT_MESSAGE_SETUP_ERROR,
|
PARENT_MESSAGE_SETUP_ERROR,
|
||||||
ParentMessage,
|
type ParentMessage,
|
||||||
WorkerInterface,
|
type WorkerInterface,
|
||||||
WorkerOptions,
|
type WorkerOptions,
|
||||||
WorkerStates,
|
WorkerStates,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import WorkerAbstract from './WorkerAbstract';
|
import WorkerAbstract from './WorkerAbstract';
|
||||||
|
|
|
@ -11,18 +11,18 @@ import mergeStream = require('merge-stream');
|
||||||
import {
|
import {
|
||||||
CHILD_MESSAGE_INITIALIZE,
|
CHILD_MESSAGE_INITIALIZE,
|
||||||
CHILD_MESSAGE_MEM_USAGE,
|
CHILD_MESSAGE_MEM_USAGE,
|
||||||
ChildMessage,
|
type ChildMessage,
|
||||||
OnCustomMessage,
|
type OnCustomMessage,
|
||||||
OnEnd,
|
type OnEnd,
|
||||||
OnStart,
|
type OnStart,
|
||||||
PARENT_MESSAGE_CLIENT_ERROR,
|
PARENT_MESSAGE_CLIENT_ERROR,
|
||||||
PARENT_MESSAGE_CUSTOM,
|
PARENT_MESSAGE_CUSTOM,
|
||||||
PARENT_MESSAGE_MEM_USAGE,
|
PARENT_MESSAGE_MEM_USAGE,
|
||||||
PARENT_MESSAGE_OK,
|
PARENT_MESSAGE_OK,
|
||||||
PARENT_MESSAGE_SETUP_ERROR,
|
PARENT_MESSAGE_SETUP_ERROR,
|
||||||
ParentMessage,
|
type ParentMessage,
|
||||||
WorkerInterface,
|
type WorkerInterface,
|
||||||
WorkerOptions,
|
type WorkerOptions,
|
||||||
WorkerStates,
|
WorkerStates,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import WorkerAbstract from './WorkerAbstract';
|
import WorkerAbstract from './WorkerAbstract';
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
import {EventEmitter, PassThrough} from 'stream';
|
import {EventEmitter, PassThrough} from 'stream';
|
||||||
import {
|
import {
|
||||||
WorkerEvents,
|
WorkerEvents,
|
||||||
WorkerInterface,
|
type WorkerInterface,
|
||||||
WorkerOptions,
|
type WorkerOptions,
|
||||||
WorkerStates,
|
WorkerStates,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
|
|
||||||
|
|
|
@ -13,13 +13,13 @@ import {
|
||||||
CHILD_MESSAGE_CALL,
|
CHILD_MESSAGE_CALL,
|
||||||
CHILD_MESSAGE_INITIALIZE,
|
CHILD_MESSAGE_INITIALIZE,
|
||||||
CHILD_MESSAGE_MEM_USAGE,
|
CHILD_MESSAGE_MEM_USAGE,
|
||||||
ChildMessage,
|
type ChildMessage,
|
||||||
ChildMessageCall,
|
type ChildMessageCall,
|
||||||
PARENT_MESSAGE_CLIENT_ERROR,
|
PARENT_MESSAGE_CLIENT_ERROR,
|
||||||
PARENT_MESSAGE_CUSTOM,
|
PARENT_MESSAGE_CUSTOM,
|
||||||
PARENT_MESSAGE_MEM_USAGE,
|
PARENT_MESSAGE_MEM_USAGE,
|
||||||
PARENT_MESSAGE_OK,
|
PARENT_MESSAGE_OK,
|
||||||
WorkerOptions,
|
type WorkerOptions,
|
||||||
} from '../../types';
|
} from '../../types';
|
||||||
|
|
||||||
jest.useFakeTimers();
|
jest.useFakeTimers();
|
||||||
|
|
|
@ -11,11 +11,11 @@ import getStream = require('get-stream');
|
||||||
import {
|
import {
|
||||||
CHILD_MESSAGE_CALL,
|
CHILD_MESSAGE_CALL,
|
||||||
CHILD_MESSAGE_INITIALIZE,
|
CHILD_MESSAGE_INITIALIZE,
|
||||||
ChildMessageCall,
|
type ChildMessageCall,
|
||||||
PARENT_MESSAGE_CLIENT_ERROR,
|
PARENT_MESSAGE_CLIENT_ERROR,
|
||||||
PARENT_MESSAGE_CUSTOM,
|
PARENT_MESSAGE_CUSTOM,
|
||||||
PARENT_MESSAGE_OK,
|
PARENT_MESSAGE_OK,
|
||||||
WorkerOptions,
|
type WorkerOptions,
|
||||||
} from '../../types';
|
} from '../../types';
|
||||||
|
|
||||||
let Worker: typeof import('../NodeThreadsWorker').default;
|
let Worker: typeof import('../NodeThreadsWorker').default;
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {transformFileAsync} from '@babel/core';
|
||||||
import {
|
import {
|
||||||
CHILD_MESSAGE_CALL,
|
CHILD_MESSAGE_CALL,
|
||||||
WorkerEvents,
|
WorkerEvents,
|
||||||
WorkerOptions,
|
type WorkerOptions,
|
||||||
WorkerStates,
|
WorkerStates,
|
||||||
} from '../../types';
|
} from '../../types';
|
||||||
import ChildProcessWorker, {SIGKILL_DELAY} from '../ChildProcessWorker';
|
import ChildProcessWorker, {SIGKILL_DELAY} from '../ChildProcessWorker';
|
||||||
|
|
|
@ -12,14 +12,14 @@ import {
|
||||||
CHILD_MESSAGE_END,
|
CHILD_MESSAGE_END,
|
||||||
CHILD_MESSAGE_INITIALIZE,
|
CHILD_MESSAGE_INITIALIZE,
|
||||||
CHILD_MESSAGE_MEM_USAGE,
|
CHILD_MESSAGE_MEM_USAGE,
|
||||||
ChildMessageCall,
|
type ChildMessageCall,
|
||||||
ChildMessageInitialize,
|
type ChildMessageInitialize,
|
||||||
PARENT_MESSAGE_CLIENT_ERROR,
|
PARENT_MESSAGE_CLIENT_ERROR,
|
||||||
PARENT_MESSAGE_ERROR,
|
type PARENT_MESSAGE_ERROR,
|
||||||
PARENT_MESSAGE_MEM_USAGE,
|
PARENT_MESSAGE_MEM_USAGE,
|
||||||
PARENT_MESSAGE_OK,
|
PARENT_MESSAGE_OK,
|
||||||
PARENT_MESSAGE_SETUP_ERROR,
|
PARENT_MESSAGE_SETUP_ERROR,
|
||||||
ParentMessageMemUsage,
|
type ParentMessageMemUsage,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
|
|
||||||
type UnknownFunction = (...args: Array<unknown>) => unknown | Promise<unknown>;
|
type UnknownFunction = (...args: Array<unknown>) => unknown | Promise<unknown>;
|
||||||
|
|
|
@ -13,14 +13,14 @@ import {
|
||||||
CHILD_MESSAGE_END,
|
CHILD_MESSAGE_END,
|
||||||
CHILD_MESSAGE_INITIALIZE,
|
CHILD_MESSAGE_INITIALIZE,
|
||||||
CHILD_MESSAGE_MEM_USAGE,
|
CHILD_MESSAGE_MEM_USAGE,
|
||||||
ChildMessageCall,
|
type ChildMessageCall,
|
||||||
ChildMessageInitialize,
|
type ChildMessageInitialize,
|
||||||
PARENT_MESSAGE_CLIENT_ERROR,
|
PARENT_MESSAGE_CLIENT_ERROR,
|
||||||
PARENT_MESSAGE_ERROR,
|
type PARENT_MESSAGE_ERROR,
|
||||||
PARENT_MESSAGE_MEM_USAGE,
|
PARENT_MESSAGE_MEM_USAGE,
|
||||||
PARENT_MESSAGE_OK,
|
PARENT_MESSAGE_OK,
|
||||||
PARENT_MESSAGE_SETUP_ERROR,
|
PARENT_MESSAGE_SETUP_ERROR,
|
||||||
ParentMessageMemUsage,
|
type ParentMessageMemUsage,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
|
|
||||||
type UnknownFunction = (...args: Array<unknown>) => unknown | Promise<unknown>;
|
type UnknownFunction = (...args: Array<unknown>) => unknown | Promise<unknown>;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
/* eslint-disable local/prefer-rest-params-eventually */
|
/* eslint-disable local/prefer-rest-params-eventually */
|
||||||
|
|
||||||
import prettyFormat, {PrettyFormatOptions} from '../';
|
import prettyFormat, {type PrettyFormatOptions} from '../';
|
||||||
|
|
||||||
function returnArguments(..._args: Array<unknown>) {
|
function returnArguments(..._args: Array<unknown>) {
|
||||||
return arguments;
|
return arguments;
|
||||||
|
|
|
@ -736,7 +736,7 @@ export function setDateNow(now: number): jest.Spied<typeof Date.now> {
|
||||||
```
|
```
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import {afterEach, expect, jest, test} from '@jest/globals';
|
import {afterEach, expect, type jest, test} from '@jest/globals';
|
||||||
import {setDateNow} from './__utils__/setDateNow';
|
import {setDateNow} from './__utils__/setDateNow';
|
||||||
|
|
||||||
let spiedDateNow: jest.Spied<typeof Date.now> | undefined = undefined;
|
let spiedDateNow: jest.Spied<typeof Date.now> | undefined = undefined;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue