Skip to content

Instantly share code, notes, and snippets.

@SimenB
Last active February 9, 2022 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SimenB/4f583a1a737b913a0328985bbf8df617 to your computer and use it in GitHub Desktop.
Save SimenB/4f583a1a737b913a0328985bbf8df617 to your computer and use it in GitHub Desktop.
Diff after bundling all definition files into a single one
diff --git i/packages/babel-jest/build/index.d.ts w/packages/babel-jest/build/index.d.ts
index af24afc1aa..42f9689b46 100644
--- i/packages/babel-jest/build/index.d.ts
+++ w/packages/babel-jest/build/index.d.ts
@@ -4,7 +4,10 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-import {TransformOptions} from '@babel/core';
import type {SyncTransformer} from '@jest/transform';
+import {TransformOptions} from '@babel/core';
+
declare const transformer: SyncTransformer<TransformOptions>;
export default transformer;
+
+export {};
diff --git i/packages/babel-jest/build/loadBabelConfig.d.ts w/packages/babel-jest/build/loadBabelConfig.d.ts
deleted file mode 100644
index 8a331fe7e2..0000000000
--- i/packages/babel-jest/build/loadBabelConfig.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export {loadPartialConfig, loadPartialConfigAsync} from '@babel/core';
diff --git i/packages/babel-plugin-jest-hoist/build/index.d.ts w/packages/babel-plugin-jest-hoist/build/index.d.ts
index 12a4f2373c..06e9621c0e 100644
--- i/packages/babel-plugin-jest-hoist/build/index.d.ts
+++ w/packages/babel-plugin-jest-hoist/build/index.d.ts
@@ -3,11 +3,14 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- *
*/
-import type {PluginObj} from '@babel/core';
import {Identifier} from '@babel/types';
-export default function jestHoist(): PluginObj<{
+import type {PluginObj} from '@babel/core';
+
+declare function jestHoist(): PluginObj<{
declareJestObjGetterIdentifier: () => Identifier;
jestObjGetterIdentifier?: Identifier;
}>;
+export default jestHoist;
+
+export {};
diff --git i/packages/diff-sequences/build/index.d.ts w/packages/diff-sequences/build/index.d.ts
index adb7ea0a5e..5598ec926a 100644
--- i/packages/diff-sequences/build/index.d.ts
+++ w/packages/diff-sequences/build/index.d.ts
@@ -3,25 +3,36 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- *
*/
-declare type IsCommon = (
- aIndex: number, // caller can assume: 0 <= aIndex && aIndex < aLength
- bIndex: number,
-) => boolean;
-declare type FoundSubsequence = (
- nCommon: number, // caller can assume: 0 < nCommon
- aCommon: number, // caller can assume: 0 <= aCommon && aCommon < aLength
- bCommon: number,
-) => void;
export declare type Callbacks = {
foundSubsequence: FoundSubsequence;
isCommon: IsCommon;
};
-export default function diffSequence(
+
+declare function diffSequence(
aLength: number,
bLength: number,
isCommon: IsCommon,
foundSubsequence: FoundSubsequence,
): void;
+export default diffSequence;
+
+declare type FoundSubsequence = (
+ nCommon: number, // caller can assume: 0 < nCommon
+ aCommon: number, // caller can assume: 0 <= aCommon && aCommon < aLength
+ bCommon: number,
+) => void;
+
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ */
+declare type IsCommon = (
+ aIndex: number, // caller can assume: 0 <= aIndex && aIndex < aLength
+ bIndex: number,
+) => boolean;
+
export {};
diff --git i/packages/expect-utils/build/index.d.ts w/packages/expect-utils/build/index.d.ts
index 5ea303e42a..2f162ef2e7 100644
--- i/packages/expect-utils/build/index.d.ts
+++ w/packages/expect-utils/build/index.d.ts
@@ -1,3 +1,83 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+export declare const arrayBufferEquality: (
+ a: unknown,
+ b: unknown,
+) => boolean | undefined;
+
+export declare function emptyObject(obj: unknown): boolean;
+
+export declare const equals: EqualsFunction;
+
+export declare type EqualsFunction = (
+ a: unknown,
+ b: unknown,
+ customTesters?: Array<Tester>,
+ strictCheck?: boolean,
+) => boolean;
+
+export declare const getObjectSubset: (
+ object: any,
+ subset: any,
+ seenReferences?: WeakMap<object, boolean>,
+) => any;
+
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ */
+declare type GetPath = {
+ hasEndProp?: boolean;
+ lastTraversedObject: unknown;
+ traversedPath: Array<string>;
+ value?: unknown;
+};
+
+export declare const getPath: (
+ object: Record<string, any>,
+ propertyPath: string | Array<string>,
+) => GetPath;
+
+export declare function isA(typeName: string, value: unknown): boolean;
+
+export declare const isError: (value: unknown) => value is Error;
+
+export declare const isOneline: (
+ expected: unknown,
+ received: unknown,
+) => boolean;
+
+export declare const iterableEquality: (
+ a: any,
+ b: any,
+ aStack?: Array<any>,
+ bStack?: Array<any>,
+) => boolean | undefined;
+
+export declare const partition: <T>(
+ items: T[],
+ predicate: (arg: T) => boolean,
+) => [T[], T[]];
+
+export declare const pathAsArray: (propertyPath: string) => Array<any>;
+
+export declare const sparseArrayEquality: (
+ a: unknown,
+ b: unknown,
+) => boolean | undefined;
+
+export declare const subsetEquality: (
+ object: unknown,
+ subset: unknown,
+) => boolean | undefined;
+
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
@@ -5,7 +85,8 @@
* LICENSE file in the root directory of this source tree.
*
*/
-export {equals, isA} from './jasmineUtils';
-export type {EqualsFunction} from './jasmineUtils';
-export * from './utils';
-export type {Tester} from './types';
+export declare type Tester = (a: any, b: any) => boolean | undefined;
+
+export declare const typeEquality: (a: any, b: any) => boolean | undefined;
+
+export {};
diff --git i/packages/expect-utils/build/jasmineUtils.d.ts w/packages/expect-utils/build/jasmineUtils.d.ts
deleted file mode 100644
index 486c3fdb35..0000000000
--- i/packages/expect-utils/build/jasmineUtils.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import type {Tester} from './types';
-export declare type EqualsFunction = (
- a: unknown,
- b: unknown,
- customTesters?: Array<Tester>,
- strictCheck?: boolean,
-) => boolean;
-export declare const equals: EqualsFunction;
-export declare function isA(typeName: string, value: unknown): boolean;
-export declare function isImmutableUnorderedKeyed(maybeKeyed: any): boolean;
-export declare function isImmutableUnorderedSet(maybeSet: any): boolean;
diff --git i/packages/expect-utils/build/types.d.ts w/packages/expect-utils/build/types.d.ts
deleted file mode 100644
index d6368a939a..0000000000
--- i/packages/expect-utils/build/types.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-export declare type Tester = (a: any, b: any) => boolean | undefined;
diff --git i/packages/expect-utils/build/utils.d.ts w/packages/expect-utils/build/utils.d.ts
deleted file mode 100644
index d28b6394d2..0000000000
--- i/packages/expect-utils/build/utils.d.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-declare type GetPath = {
- hasEndProp?: boolean;
- lastTraversedObject: unknown;
- traversedPath: Array<string>;
- value?: unknown;
-};
-export declare const getPath: (
- object: Record<string, any>,
- propertyPath: string | Array<string>,
-) => GetPath;
-export declare const getObjectSubset: (
- object: any,
- subset: any,
- seenReferences?: WeakMap<object, boolean>,
-) => any;
-export declare const iterableEquality: (
- a: any,
- b: any,
- aStack?: Array<any>,
- bStack?: Array<any>,
-) => boolean | undefined;
-export declare const subsetEquality: (
- object: unknown,
- subset: unknown,
-) => boolean | undefined;
-export declare const typeEquality: (a: any, b: any) => boolean | undefined;
-export declare const arrayBufferEquality: (
- a: unknown,
- b: unknown,
-) => boolean | undefined;
-export declare const sparseArrayEquality: (
- a: unknown,
- b: unknown,
-) => boolean | undefined;
-export declare const partition: <T>(
- items: T[],
- predicate: (arg: T) => boolean,
-) => [T[], T[]];
-export declare const pathAsArray: (propertyPath: string) => Array<any>;
-export declare const isError: (value: unknown) => value is Error;
-export declare function emptyObject(obj: unknown): boolean;
-export declare const isOneline: (
- expected: unknown,
- received: unknown,
-) => boolean;
-export {};
diff --git i/packages/expect/build/asymmetricMatchers.d.ts w/packages/expect/build/asymmetricMatchers.d.ts
deleted file mode 100644
index 4e1307dcd8..0000000000
--- i/packages/expect/build/asymmetricMatchers.d.ts
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {
- AsymmetricMatcher as AsymmetricMatcherInterface,
- MatcherState,
-} from './types';
-export declare function hasProperty(
- obj: object | null,
- property: string,
-): boolean;
-export declare abstract class AsymmetricMatcher<
- T,
- State extends MatcherState = MatcherState,
-> implements AsymmetricMatcherInterface
-{
- protected sample: T;
- protected inverse: boolean;
- $$typeof: symbol;
- constructor(sample: T, inverse?: boolean);
- protected getMatcherContext(): State;
- abstract asymmetricMatch(other: unknown): boolean;
- abstract toString(): string;
- getExpectedType?(): string;
- toAsymmetricMatcher?(): string;
-}
-declare class Any extends AsymmetricMatcher<any> {
- constructor(sample: unknown);
- asymmetricMatch(other: unknown): boolean;
- toString(): string;
- getExpectedType(): string;
- toAsymmetricMatcher(): string;
-}
-declare class Anything extends AsymmetricMatcher<void> {
- asymmetricMatch(other: unknown): boolean;
- toString(): string;
- toAsymmetricMatcher(): string;
-}
-declare class ArrayContaining extends AsymmetricMatcher<Array<unknown>> {
- constructor(sample: Array<unknown>, inverse?: boolean);
- asymmetricMatch(other: Array<unknown>): boolean;
- toString(): string;
- getExpectedType(): string;
-}
-declare class ObjectContaining extends AsymmetricMatcher<
- Record<string, unknown>
-> {
- constructor(sample: Record<string, unknown>, inverse?: boolean);
- asymmetricMatch(other: any): boolean;
- toString(): string;
- getExpectedType(): string;
-}
-declare class StringContaining extends AsymmetricMatcher<string> {
- constructor(sample: string, inverse?: boolean);
- asymmetricMatch(other: string): boolean;
- toString(): string;
- getExpectedType(): string;
-}
-declare class StringMatching extends AsymmetricMatcher<RegExp> {
- constructor(sample: string | RegExp, inverse?: boolean);
- asymmetricMatch(other: string): boolean;
- toString(): string;
- getExpectedType(): string;
-}
-declare class CloseTo extends AsymmetricMatcher<number> {
- private precision;
- constructor(sample: number, precision?: number, inverse?: boolean);
- asymmetricMatch(other: number): boolean;
- toString(): string;
- getExpectedType(): string;
-}
-export declare const any: (expectedObject: unknown) => Any;
-export declare const anything: () => Anything;
-export declare const arrayContaining: (
- sample: Array<unknown>,
-) => ArrayContaining;
-export declare const arrayNotContaining: (
- sample: Array<unknown>,
-) => ArrayContaining;
-export declare const objectContaining: (
- sample: Record<string, unknown>,
-) => ObjectContaining;
-export declare const objectNotContaining: (
- sample: Record<string, unknown>,
-) => ObjectContaining;
-export declare const stringContaining: (expected: string) => StringContaining;
-export declare const stringNotContaining: (
- expected: string,
-) => StringContaining;
-export declare const stringMatching: (
- expected: string | RegExp,
-) => StringMatching;
-export declare const stringNotMatching: (
- expected: string | RegExp,
-) => StringMatching;
-export declare const closeTo: (
- expected: number,
- precision?: number | undefined,
-) => CloseTo;
-export declare const notCloseTo: (
- expected: number,
- precision?: number | undefined,
-) => CloseTo;
-export {};
diff --git i/packages/expect/build/extractExpectedAssertionsErrors.d.ts w/packages/expect/build/extractExpectedAssertionsErrors.d.ts
deleted file mode 100644
index e8fb348aa2..0000000000
--- i/packages/expect/build/extractExpectedAssertionsErrors.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {Expect} from './types';
-declare const extractExpectedAssertionsErrors: Expect['extractExpectedAssertionsErrors'];
-export default extractExpectedAssertionsErrors;
diff --git i/packages/expect/build/index.d.ts w/packages/expect/build/index.d.ts
index 90ce09aa05..504207874a 100644
--- i/packages/expect/build/index.d.ts
+++ w/packages/expect/build/index.d.ts
@@ -3,14 +3,360 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- *
*/
-import type {Expect, SyncExpectationResult} from './types';
-export type {Expect, MatcherState, Matchers} from './types';
+import type {Config} from '@jest/types';
+import type {EqualsFunction} from '@jest/expect-utils';
+import type * as jestMatcherUtils from 'jest-matcher-utils';
+import type {Tester} from '@jest/expect-utils';
+
+declare interface AsymmetricMatcher {
+ asymmetricMatch(other: unknown): boolean;
+ toString(): string;
+ getExpectedType?(): string;
+ toAsymmetricMatcher?(): string;
+}
+
+declare interface AsymmetricMatchers {
+ any(sample: unknown): AsymmetricMatcher;
+ anything(): AsymmetricMatcher;
+ arrayContaining(sample: Array<unknown>): AsymmetricMatcher;
+ closeTo(sample: number, precision?: number): AsymmetricMatcher;
+ objectContaining(sample: Record<string, unknown>): AsymmetricMatcher;
+ stringContaining(sample: string): AsymmetricMatcher;
+ stringMatching(sample: string | RegExp): AsymmetricMatcher;
+}
+
+declare type AsyncExpectationResult = Promise<SyncExpectationResult>;
+
+export declare type Expect<State extends MatcherState = MatcherState> = {
+ <T = unknown>(actual: T): Matchers<void, T>;
+ addSnapshotSerializer(serializer: unknown): void;
+ assertions(numberOfAssertions: number): void;
+ extend<T extends MatcherState = State>(matchers: MatchersObject<T>): void;
+ extractExpectedAssertionsErrors: () => ExpectedAssertionsErrors;
+ getState(): State;
+ hasAssertions(): void;
+ setState(state: Partial<State>): void;
+} & AsymmetricMatchers & {
+ not: Omit<AsymmetricMatchers, 'any' | 'anything'>;
+ };
+
+declare const expect_2: Expect;
+export default expect_2;
+export {expect_2 as expect};
+
+declare type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;
+
+declare type ExpectedAssertionsErrors = Array<{
+ actual: string | number;
+ error: Error;
+ expected: string;
+}>;
+
+declare const INTERNAL_MATCHER_FLAG: unique symbol;
+
export declare class JestAssertionError extends Error {
matcherResult?: Omit<SyncExpectationResult, 'message'> & {
message: string;
};
}
-export declare const expect: Expect;
-export default expect;
+
+export declare interface Matchers<R, T = unknown> {
+ /**
+ * Ensures the last call to a mock function was provided specific args.
+ */
+ lastCalledWith(...expected: [unknown, ...Array<unknown>]): R;
+ /**
+ * Ensure that the last call to a mock function has returned a specified value.
+ */
+ lastReturnedWith(expected: unknown): R;
+ /**
+ * If you know how to test something, `.not` lets you test its opposite.
+ */
+ not: Matchers<R, T>;
+ /**
+ * Ensure that a mock function is called with specific arguments on an Nth call.
+ */
+ nthCalledWith(nth: number, ...expected: [unknown, ...Array<unknown>]): R;
+ /**
+ * Ensure that the nth call to a mock function has returned a specified value.
+ */
+ nthReturnedWith(nth: number, expected: unknown): R;
+ /**
+ * Use resolves to unwrap the value of a fulfilled promise so any other
+ * matcher can be chained. If the promise is rejected the assertion fails.
+ */
+ resolves: Matchers<Promise<R>, T>;
+ /**
+ * Unwraps the reason of a rejected promise so any other matcher can be chained.
+ * If the promise is fulfilled the assertion fails.
+ */
+ rejects: Matchers<Promise<R>, T>;
+ /**
+ * Checks that a value is what you expect. It uses `===` to check strict equality.
+ * Don't use `toBe` with floating-point numbers.
+ */
+ toBe(expected: unknown): R;
+ /**
+ * Ensures that a mock function is called.
+ */
+ toBeCalled(): R;
+ /**
+ * Ensures that a mock function is called an exact number of times.
+ */
+ toBeCalledTimes(expected: number): R;
+ /**
+ * Ensure that a mock function is called with specific arguments.
+ */
+ toBeCalledWith(...expected: [unknown, ...Array<unknown>]): R;
+ /**
+ * Using exact equality with floating point numbers is a bad idea.
+ * Rounding means that intuitive things fail.
+ * The default for `precision` is 2.
+ */
+ toBeCloseTo(expected: number, precision?: number): R;
+ /**
+ * Ensure that a variable is not undefined.
+ */
+ toBeDefined(): R;
+ /**
+ * When you don't care what a value is, you just want to
+ * ensure a value is false in a boolean context.
+ */
+ toBeFalsy(): R;
+ /**
+ * For comparing floating point numbers.
+ */
+ toBeGreaterThan(expected: number | bigint): R;
+ /**
+ * For comparing floating point numbers.
+ */
+ toBeGreaterThanOrEqual(expected: number | bigint): R;
+ /**
+ * Ensure that an object is an instance of a class.
+ * This matcher uses `instanceof` underneath.
+ */
+ toBeInstanceOf(expected: unknown): R;
+ /**
+ * For comparing floating point numbers.
+ */
+ toBeLessThan(expected: number | bigint): R;
+ /**
+ * For comparing floating point numbers.
+ */
+ toBeLessThanOrEqual(expected: number | bigint): R;
+ /**
+ * This is the same as `.toBe(null)` but the error messages are a bit nicer.
+ * So use `.toBeNull()` when you want to check that something is null.
+ */
+ toBeNull(): R;
+ /**
+ * Use when you don't care what a value is, you just want to ensure a value
+ * is true in a boolean context. In JavaScript, there are six falsy values:
+ * `false`, `0`, `''`, `null`, `undefined`, and `NaN`. Everything else is truthy.
+ */
+ toBeTruthy(): R;
+ /**
+ * Used to check that a variable is undefined.
+ */
+ toBeUndefined(): R;
+ /**
+ * Used to check that a variable is NaN.
+ */
+ toBeNaN(): R;
+ /**
+ * Used when you want to check that an item is in a list.
+ * For testing the items in the list, this uses `===`, a strict equality check.
+ */
+ toContain(expected: unknown): R;
+ /**
+ * Used when you want to check that an item is in a list.
+ * For testing the items in the list, this matcher recursively checks the
+ * equality of all fields, rather than checking for object identity.
+ */
+ toContainEqual(expected: unknown): R;
+ /**
+ * Used when you want to check that two objects have the same value.
+ * This matcher recursively checks the equality of all fields, rather than checking for object identity.
+ */
+ toEqual(expected: unknown): R;
+ /**
+ * Ensures that a mock function is called.
+ */
+ toHaveBeenCalled(): R;
+ /**
+ * Ensures that a mock function is called an exact number of times.
+ */
+ toHaveBeenCalledTimes(expected: number): R;
+ /**
+ * Ensure that a mock function is called with specific arguments.
+ */
+ toHaveBeenCalledWith(...expected: [unknown, ...Array<unknown>]): R;
+ /**
+ * Ensure that a mock function is called with specific arguments on an Nth call.
+ */
+ toHaveBeenNthCalledWith(
+ nth: number,
+ ...expected: [unknown, ...Array<unknown>]
+ ): R;
+ /**
+ * If you have a mock function, you can use `.toHaveBeenLastCalledWith`
+ * to test what arguments it was last called with.
+ */
+ toHaveBeenLastCalledWith(...expected: [unknown, ...Array<unknown>]): R;
+ /**
+ * Use to test the specific value that a mock function last returned.
+ * If the last call to the mock function threw an error, then this matcher will fail
+ * no matter what value you provided as the expected return value.
+ */
+ toHaveLastReturnedWith(expected: unknown): R;
+ /**
+ * Used to check that an object has a `.length` property
+ * and it is set to a certain numeric value.
+ */
+ toHaveLength(expected: number): R;
+ /**
+ * Use to test the specific value that a mock function returned for the nth call.
+ * If the nth call to the mock function threw an error, then this matcher will fail
+ * no matter what value you provided as the expected return value.
+ */
+ toHaveNthReturnedWith(nth: number, expected: unknown): R;
+ /**
+ * Use to check if property at provided reference keyPath exists for an object.
+ * For checking deeply nested properties in an object you may use dot notation or an array containing
+ * the keyPath for deep references.
+ *
+ * Optionally, you can provide a value to check if it's equal to the value present at keyPath
+ * on the target object. This matcher uses 'deep equality' (like `toEqual()`) and recursively checks
+ * the equality of all fields.
+ *
+ * @example
+ *
+ * expect(houseForSale).toHaveProperty('kitchen.area', 20);
+ */
+ toHaveProperty(
+ expectedPath: string | Array<string>,
+ expectedValue?: unknown,
+ ): R;
+ /**
+ * Use to test that the mock function successfully returned (i.e., did not throw an error) at least one time
+ */
+ toHaveReturned(): R;
+ /**
+ * Use to ensure that a mock function returned successfully (i.e., did not throw an error) an exact number of times.
+ * Any calls to the mock function that throw an error are not counted toward the number of times the function returned.
+ */
+ toHaveReturnedTimes(expected: number): R;
+ /**
+ * Use to ensure that a mock function returned a specific value.
+ */
+ toHaveReturnedWith(expected: unknown): R;
+ /**
+ * Check that a string matches a regular expression.
+ */
+ toMatch(expected: string | RegExp): R;
+ /**
+ * Used to check that a JavaScript object matches a subset of the properties of an object
+ */
+ toMatchObject(
+ expected: Record<string, unknown> | Array<Record<string, unknown>>,
+ ): R;
+ /**
+ * Ensure that a mock function has returned (as opposed to thrown) at least once.
+ */
+ toReturn(): R;
+ /**
+ * Ensure that a mock function has returned (as opposed to thrown) a specified number of times.
+ */
+ toReturnTimes(expected: number): R;
+ /**
+ * Ensure that a mock function has returned a specified value at least once.
+ */
+ toReturnWith(expected: unknown): R;
+ /**
+ * Use to test that objects have the same types as well as structure.
+ */
+ toStrictEqual(expected: unknown): R;
+ /**
+ * Used to test that a function throws when it is called.
+ */
+ toThrow(expected?: unknown): R;
+ /**
+ * If you want to test that a specific error is thrown inside a function.
+ */
+ toThrowError(expected?: unknown): R;
+ /**
+ * This ensures that a value matches the most recent snapshot with property matchers.
+ * Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
+ */
+ toMatchSnapshot(hint?: string): R;
+ /**
+ * This ensures that a value matches the most recent snapshot.
+ * Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
+ */
+ toMatchSnapshot<U extends Record<keyof T, unknown>>(
+ propertyMatchers: Partial<U>,
+ hint?: string,
+ ): R;
+ /**
+ * This ensures that a value matches the most recent snapshot with property matchers.
+ * Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
+ * Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
+ */
+ toMatchInlineSnapshot(snapshot?: string): R;
+ /**
+ * This ensures that a value matches the most recent snapshot with property matchers.
+ * Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
+ * Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
+ */
+ toMatchInlineSnapshot<U extends Record<keyof T, unknown>>(
+ propertyMatchers: Partial<U>,
+ snapshot?: string,
+ ): R;
+ /**
+ * Used to test that a function throws a error matching the most recent snapshot when it is called.
+ */
+ toThrowErrorMatchingSnapshot(hint?: string): R;
+ /**
+ * Used to test that a function throws a error matching the most recent snapshot when it is called.
+ * Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
+ */
+ toThrowErrorMatchingInlineSnapshot(snapshot?: string): R;
+}
+
+declare type MatchersObject<T extends MatcherState = MatcherState> = {
+ [id: string]: RawMatcherFn<T>;
+};
+
+export declare type MatcherState = {
+ assertionCalls: number;
+ currentTestName?: string;
+ dontThrow?: () => void;
+ error?: Error;
+ equals: EqualsFunction;
+ expand?: boolean;
+ expectedAssertionsNumber?: number | null;
+ expectedAssertionsNumberError?: Error;
+ isExpectingAssertions?: boolean;
+ isExpectingAssertionsError?: Error;
+ isNot: boolean;
+ promise: string;
+ suppressedErrors: Array<Error>;
+ testPath?: Config.Path;
+ utils: typeof jestMatcherUtils & {
+ iterableEquality: Tester;
+ subsetEquality: Tester;
+ };
+};
+
+declare type RawMatcherFn<T extends MatcherState = MatcherState> = {
+ (this: T, received: any, expected: any, options?: any): ExpectationResult;
+ [INTERNAL_MATCHER_FLAG]?: boolean;
+};
+
+declare type SyncExpectationResult = {
+ pass: boolean;
+ message: () => string;
+};
+
+export {};
diff --git i/packages/expect/build/jestMatchersObject.d.ts w/packages/expect/build/jestMatchersObject.d.ts
deleted file mode 100644
index e219c4fe3e..0000000000
--- i/packages/expect/build/jestMatchersObject.d.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {Expect, MatcherState, MatchersObject} from './types';
-export declare const INTERNAL_MATCHER_FLAG: unique symbol;
-export declare const getState: <
- State extends MatcherState = MatcherState,
->() => State;
-export declare const setState: <State extends MatcherState = MatcherState>(
- state: Partial<State>,
-) => void;
-export declare const getMatchers: <
- State extends MatcherState = MatcherState,
->() => MatchersObject<State>;
-export declare const setMatchers: <State extends MatcherState = MatcherState>(
- matchers: MatchersObject<State>,
- isInternal: boolean,
- expect: Expect,
-) => void;
diff --git i/packages/expect/build/matchers.d.ts w/packages/expect/build/matchers.d.ts
deleted file mode 100644
index 7dcc4ff4a5..0000000000
--- i/packages/expect/build/matchers.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {MatchersObject} from './types';
-declare const matchers: MatchersObject;
-export default matchers;
diff --git i/packages/expect/build/print.d.ts w/packages/expect/build/print.d.ts
deleted file mode 100644
index 444475a076..0000000000
--- i/packages/expect/build/print.d.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-export declare const printReceivedStringContainExpectedSubstring: (
- received: string,
- start: number,
- length: number,
-) => string;
-export declare const printReceivedStringContainExpectedResult: (
- received: string,
- result: RegExpExecArray | null,
-) => string;
-export declare const printReceivedArrayContainExpectedItem: (
- received: Array<unknown>,
- index: number,
-) => string;
-export declare const printCloseTo: (
- receivedDiff: number,
- expectedDiff: number,
- precision: number,
- isNot: boolean,
-) => string;
-export declare const printExpectedConstructorName: (
- label: string,
- expected: Function,
-) => string;
-export declare const printExpectedConstructorNameNot: (
- label: string,
- expected: Function,
-) => string;
-export declare const printReceivedConstructorName: (
- label: string,
- received: Function,
-) => string;
-export declare const printReceivedConstructorNameNot: (
- label: string,
- received: Function,
- expected: Function,
-) => string;
diff --git i/packages/expect/build/spyMatchers.d.ts w/packages/expect/build/spyMatchers.d.ts
deleted file mode 100644
index 7d786cd84a..0000000000
--- i/packages/expect/build/spyMatchers.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {MatchersObject} from './types';
-declare const spyMatchers: MatchersObject;
-export default spyMatchers;
diff --git i/packages/expect/build/toThrowMatchers.d.ts w/packages/expect/build/toThrowMatchers.d.ts
deleted file mode 100644
index 9a6e9fbcc3..0000000000
--- i/packages/expect/build/toThrowMatchers.d.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {MatchersObject, RawMatcherFn} from './types';
-export declare const createMatcher: (
- matcherName: string,
- fromPromise?: boolean | undefined,
-) => RawMatcherFn;
-declare const matchers: MatchersObject;
-export default matchers;
diff --git i/packages/expect/build/types.d.ts w/packages/expect/build/types.d.ts
deleted file mode 100644
index 5bedcbd03e..0000000000
--- i/packages/expect/build/types.d.ts
+++ /dev/null
@@ -1,343 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {EqualsFunction, Tester} from '@jest/expect-utils';
-import type {Config} from '@jest/types';
-import type * as jestMatcherUtils from 'jest-matcher-utils';
-import {INTERNAL_MATCHER_FLAG} from './jestMatchersObject';
-export declare type SyncExpectationResult = {
- pass: boolean;
- message: () => string;
-};
-export declare type AsyncExpectationResult = Promise<SyncExpectationResult>;
-export declare type ExpectationResult =
- | SyncExpectationResult
- | AsyncExpectationResult;
-export declare type RawMatcherFn<T extends MatcherState = MatcherState> = {
- (this: T, received: any, expected: any, options?: any): ExpectationResult;
- [INTERNAL_MATCHER_FLAG]?: boolean;
-};
-export declare type ThrowingMatcherFn = (actual: any) => void;
-export declare type PromiseMatcherFn = (actual: any) => Promise<void>;
-export declare type MatcherState = {
- assertionCalls: number;
- currentTestName?: string;
- dontThrow?: () => void;
- error?: Error;
- equals: EqualsFunction;
- expand?: boolean;
- expectedAssertionsNumber?: number | null;
- expectedAssertionsNumberError?: Error;
- isExpectingAssertions?: boolean;
- isExpectingAssertionsError?: Error;
- isNot: boolean;
- promise: string;
- suppressedErrors: Array<Error>;
- testPath?: Config.Path;
- utils: typeof jestMatcherUtils & {
- iterableEquality: Tester;
- subsetEquality: Tester;
- };
-};
-export interface AsymmetricMatcher {
- asymmetricMatch(other: unknown): boolean;
- toString(): string;
- getExpectedType?(): string;
- toAsymmetricMatcher?(): string;
-}
-export declare type MatchersObject<T extends MatcherState = MatcherState> = {
- [id: string]: RawMatcherFn<T>;
-};
-export declare type ExpectedAssertionsErrors = Array<{
- actual: string | number;
- error: Error;
- expected: string;
-}>;
-interface AsymmetricMatchers {
- any(sample: unknown): AsymmetricMatcher;
- anything(): AsymmetricMatcher;
- arrayContaining(sample: Array<unknown>): AsymmetricMatcher;
- closeTo(sample: number, precision?: number): AsymmetricMatcher;
- objectContaining(sample: Record<string, unknown>): AsymmetricMatcher;
- stringContaining(sample: string): AsymmetricMatcher;
- stringMatching(sample: string | RegExp): AsymmetricMatcher;
-}
-export declare type Expect<State extends MatcherState = MatcherState> = {
- <T = unknown>(actual: T): Matchers<void, T>;
- addSnapshotSerializer(serializer: unknown): void;
- assertions(numberOfAssertions: number): void;
- extend<T extends MatcherState = State>(matchers: MatchersObject<T>): void;
- extractExpectedAssertionsErrors: () => ExpectedAssertionsErrors;
- getState(): State;
- hasAssertions(): void;
- setState(state: Partial<State>): void;
-} & AsymmetricMatchers & {
- not: Omit<AsymmetricMatchers, 'any' | 'anything'>;
- };
-export interface Matchers<R, T = unknown> {
- /**
- * Ensures the last call to a mock function was provided specific args.
- */
- lastCalledWith(...expected: [unknown, ...Array<unknown>]): R;
- /**
- * Ensure that the last call to a mock function has returned a specified value.
- */
- lastReturnedWith(expected: unknown): R;
- /**
- * If you know how to test something, `.not` lets you test its opposite.
- */
- not: Matchers<R, T>;
- /**
- * Ensure that a mock function is called with specific arguments on an Nth call.
- */
- nthCalledWith(nth: number, ...expected: [unknown, ...Array<unknown>]): R;
- /**
- * Ensure that the nth call to a mock function has returned a specified value.
- */
- nthReturnedWith(nth: number, expected: unknown): R;
- /**
- * Use resolves to unwrap the value of a fulfilled promise so any other
- * matcher can be chained. If the promise is rejected the assertion fails.
- */
- resolves: Matchers<Promise<R>, T>;
- /**
- * Unwraps the reason of a rejected promise so any other matcher can be chained.
- * If the promise is fulfilled the assertion fails.
- */
- rejects: Matchers<Promise<R>, T>;
- /**
- * Checks that a value is what you expect. It uses `===` to check strict equality.
- * Don't use `toBe` with floating-point numbers.
- */
- toBe(expected: unknown): R;
- /**
- * Ensures that a mock function is called.
- */
- toBeCalled(): R;
- /**
- * Ensures that a mock function is called an exact number of times.
- */
- toBeCalledTimes(expected: number): R;
- /**
- * Ensure that a mock function is called with specific arguments.
- */
- toBeCalledWith(...expected: [unknown, ...Array<unknown>]): R;
- /**
- * Using exact equality with floating point numbers is a bad idea.
- * Rounding means that intuitive things fail.
- * The default for `precision` is 2.
- */
- toBeCloseTo(expected: number, precision?: number): R;
- /**
- * Ensure that a variable is not undefined.
- */
- toBeDefined(): R;
- /**
- * When you don't care what a value is, you just want to
- * ensure a value is false in a boolean context.
- */
- toBeFalsy(): R;
- /**
- * For comparing floating point numbers.
- */
- toBeGreaterThan(expected: number | bigint): R;
- /**
- * For comparing floating point numbers.
- */
- toBeGreaterThanOrEqual(expected: number | bigint): R;
- /**
- * Ensure that an object is an instance of a class.
- * This matcher uses `instanceof` underneath.
- */
- toBeInstanceOf(expected: unknown): R;
- /**
- * For comparing floating point numbers.
- */
- toBeLessThan(expected: number | bigint): R;
- /**
- * For comparing floating point numbers.
- */
- toBeLessThanOrEqual(expected: number | bigint): R;
- /**
- * This is the same as `.toBe(null)` but the error messages are a bit nicer.
- * So use `.toBeNull()` when you want to check that something is null.
- */
- toBeNull(): R;
- /**
- * Use when you don't care what a value is, you just want to ensure a value
- * is true in a boolean context. In JavaScript, there are six falsy values:
- * `false`, `0`, `''`, `null`, `undefined`, and `NaN`. Everything else is truthy.
- */
- toBeTruthy(): R;
- /**
- * Used to check that a variable is undefined.
- */
- toBeUndefined(): R;
- /**
- * Used to check that a variable is NaN.
- */
- toBeNaN(): R;
- /**
- * Used when you want to check that an item is in a list.
- * For testing the items in the list, this uses `===`, a strict equality check.
- */
- toContain(expected: unknown): R;
- /**
- * Used when you want to check that an item is in a list.
- * For testing the items in the list, this matcher recursively checks the
- * equality of all fields, rather than checking for object identity.
- */
- toContainEqual(expected: unknown): R;
- /**
- * Used when you want to check that two objects have the same value.
- * This matcher recursively checks the equality of all fields, rather than checking for object identity.
- */
- toEqual(expected: unknown): R;
- /**
- * Ensures that a mock function is called.
- */
- toHaveBeenCalled(): R;
- /**
- * Ensures that a mock function is called an exact number of times.
- */
- toHaveBeenCalledTimes(expected: number): R;
- /**
- * Ensure that a mock function is called with specific arguments.
- */
- toHaveBeenCalledWith(...expected: [unknown, ...Array<unknown>]): R;
- /**
- * Ensure that a mock function is called with specific arguments on an Nth call.
- */
- toHaveBeenNthCalledWith(
- nth: number,
- ...expected: [unknown, ...Array<unknown>]
- ): R;
- /**
- * If you have a mock function, you can use `.toHaveBeenLastCalledWith`
- * to test what arguments it was last called with.
- */
- toHaveBeenLastCalledWith(...expected: [unknown, ...Array<unknown>]): R;
- /**
- * Use to test the specific value that a mock function last returned.
- * If the last call to the mock function threw an error, then this matcher will fail
- * no matter what value you provided as the expected return value.
- */
- toHaveLastReturnedWith(expected: unknown): R;
- /**
- * Used to check that an object has a `.length` property
- * and it is set to a certain numeric value.
- */
- toHaveLength(expected: number): R;
- /**
- * Use to test the specific value that a mock function returned for the nth call.
- * If the nth call to the mock function threw an error, then this matcher will fail
- * no matter what value you provided as the expected return value.
- */
- toHaveNthReturnedWith(nth: number, expected: unknown): R;
- /**
- * Use to check if property at provided reference keyPath exists for an object.
- * For checking deeply nested properties in an object you may use dot notation or an array containing
- * the keyPath for deep references.
- *
- * Optionally, you can provide a value to check if it's equal to the value present at keyPath
- * on the target object. This matcher uses 'deep equality' (like `toEqual()`) and recursively checks
- * the equality of all fields.
- *
- * @example
- *
- * expect(houseForSale).toHaveProperty('kitchen.area', 20);
- */
- toHaveProperty(
- expectedPath: string | Array<string>,
- expectedValue?: unknown,
- ): R;
- /**
- * Use to test that the mock function successfully returned (i.e., did not throw an error) at least one time
- */
- toHaveReturned(): R;
- /**
- * Use to ensure that a mock function returned successfully (i.e., did not throw an error) an exact number of times.
- * Any calls to the mock function that throw an error are not counted toward the number of times the function returned.
- */
- toHaveReturnedTimes(expected: number): R;
- /**
- * Use to ensure that a mock function returned a specific value.
- */
- toHaveReturnedWith(expected: unknown): R;
- /**
- * Check that a string matches a regular expression.
- */
- toMatch(expected: string | RegExp): R;
- /**
- * Used to check that a JavaScript object matches a subset of the properties of an object
- */
- toMatchObject(
- expected: Record<string, unknown> | Array<Record<string, unknown>>,
- ): R;
- /**
- * Ensure that a mock function has returned (as opposed to thrown) at least once.
- */
- toReturn(): R;
- /**
- * Ensure that a mock function has returned (as opposed to thrown) a specified number of times.
- */
- toReturnTimes(expected: number): R;
- /**
- * Ensure that a mock function has returned a specified value at least once.
- */
- toReturnWith(expected: unknown): R;
- /**
- * Use to test that objects have the same types as well as structure.
- */
- toStrictEqual(expected: unknown): R;
- /**
- * Used to test that a function throws when it is called.
- */
- toThrow(expected?: unknown): R;
- /**
- * If you want to test that a specific error is thrown inside a function.
- */
- toThrowError(expected?: unknown): R;
- /**
- * This ensures that a value matches the most recent snapshot with property matchers.
- * Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
- */
- toMatchSnapshot(hint?: string): R;
- /**
- * This ensures that a value matches the most recent snapshot.
- * Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
- */
- toMatchSnapshot<U extends Record<keyof T, unknown>>(
- propertyMatchers: Partial<U>,
- hint?: string,
- ): R;
- /**
- * This ensures that a value matches the most recent snapshot with property matchers.
- * Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
- * Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
- */
- toMatchInlineSnapshot(snapshot?: string): R;
- /**
- * This ensures that a value matches the most recent snapshot with property matchers.
- * Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
- * Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
- */
- toMatchInlineSnapshot<U extends Record<keyof T, unknown>>(
- propertyMatchers: Partial<U>,
- snapshot?: string,
- ): R;
- /**
- * Used to test that a function throws a error matching the most recent snapshot when it is called.
- */
- toThrowErrorMatchingSnapshot(hint?: string): R;
- /**
- * Used to test that a function throws a error matching the most recent snapshot when it is called.
- * Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
- */
- toThrowErrorMatchingInlineSnapshot(snapshot?: string): R;
-}
-export {};
diff --git i/packages/jest-changed-files/build/git.d.ts w/packages/jest-changed-files/build/git.d.ts
deleted file mode 100644
index 136b942d8c..0000000000
--- i/packages/jest-changed-files/build/git.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {SCMAdapter} from './types';
-declare const adapter: SCMAdapter;
-export default adapter;
diff --git i/packages/jest-changed-files/build/hg.d.ts w/packages/jest-changed-files/build/hg.d.ts
deleted file mode 100644
index 136b942d8c..0000000000
--- i/packages/jest-changed-files/build/hg.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {SCMAdapter} from './types';
-declare const adapter: SCMAdapter;
-export default adapter;
diff --git i/packages/jest-changed-files/build/index.d.ts w/packages/jest-changed-files/build/index.d.ts
index e033ddd719..d04249926f 100644
--- i/packages/jest-changed-files/build/index.d.ts
+++ w/packages/jest-changed-files/build/index.d.ts
@@ -3,13 +3,35 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- *
*/
import type {Config} from '@jest/types';
-import type {ChangedFilesPromise, Options, Repos} from './types';
-export type {ChangedFiles, ChangedFilesPromise} from './types';
+
+export declare type ChangedFiles = {
+ repos: Repos;
+ changedFiles: Paths;
+};
+
+export declare type ChangedFilesPromise = Promise<ChangedFiles>;
+
+export declare const findRepos: (roots: Array<Config.Path>) => Promise<Repos>;
+
export declare const getChangedFilesForRoots: (
roots: Array<Config.Path>,
options: Options,
) => ChangedFilesPromise;
-export declare const findRepos: (roots: Array<Config.Path>) => Promise<Repos>;
+
+declare type Options = {
+ lastCommit?: boolean;
+ withAncestor?: boolean;
+ changedSince?: string;
+ includePaths?: Array<Config.Path>;
+};
+
+declare type Paths = Set<Config.Path>;
+
+declare type Repos = {
+ git: Paths;
+ hg: Paths;
+};
+
+export {};
diff --git i/packages/jest-changed-files/build/types.d.ts w/packages/jest-changed-files/build/types.d.ts
deleted file mode 100644
index fc5b7be5d4..0000000000
--- i/packages/jest-changed-files/build/types.d.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export declare type Options = {
- lastCommit?: boolean;
- withAncestor?: boolean;
- changedSince?: string;
- includePaths?: Array<Config.Path>;
-};
-declare type Paths = Set<Config.Path>;
-export declare type Repos = {
- git: Paths;
- hg: Paths;
-};
-export declare type ChangedFiles = {
- repos: Repos;
- changedFiles: Paths;
-};
-export declare type ChangedFilesPromise = Promise<ChangedFiles>;
-export declare type SCMAdapter = {
- findChangedFiles: (
- cwd: Config.Path,
- options: Options,
- ) => Promise<Array<Config.Path>>;
- getRoot: (cwd: Config.Path) => Promise<Config.Path | null>;
-};
-export {};
diff --git i/packages/jest-circus/build/eventHandler.d.ts w/packages/jest-circus/build/eventHandler.d.ts
deleted file mode 100644
index 468e6e6e3e..0000000000
--- i/packages/jest-circus/build/eventHandler.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Circus} from '@jest/types';
-declare const eventHandler: Circus.EventHandler;
-export default eventHandler;
diff --git i/packages/jest-circus/build/formatNodeAssertErrors.d.ts w/packages/jest-circus/build/formatNodeAssertErrors.d.ts
deleted file mode 100644
index d5694565f4..0000000000
--- i/packages/jest-circus/build/formatNodeAssertErrors.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Circus} from '@jest/types';
-declare const formatNodeAssertErrors: (
- event: Circus.Event,
- state: Circus.State,
-) => void;
-export default formatNodeAssertErrors;
diff --git i/packages/jest-circus/build/globalErrorHandlers.d.ts w/packages/jest-circus/build/globalErrorHandlers.d.ts
deleted file mode 100644
index 313c1be8cf..0000000000
--- i/packages/jest-circus/build/globalErrorHandlers.d.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Circus} from '@jest/types';
-export declare const injectGlobalErrorHandlers: (
- parentProcess: NodeJS.Process,
-) => Circus.GlobalErrorHandlers;
-export declare const restoreGlobalErrorHandlers: (
- parentProcess: NodeJS.Process,
- originalErrorHandlers: Circus.GlobalErrorHandlers,
-) => void;
diff --git i/packages/jest-circus/build/index.d.ts w/packages/jest-circus/build/index.d.ts
index 627a8adaa7..1b8a8b9e3b 100644
--- i/packages/jest-circus/build/index.d.ts
+++ w/packages/jest-circus/build/index.d.ts
@@ -4,52 +4,21 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-import type {Circus, Global} from '@jest/types';
-export {setState, getState, resetState} from './state';
-export {default as run} from './run';
-declare type THook = (fn: Circus.HookFn, timeout?: number) => void;
-declare const describe: {
- (blockName: Circus.BlockName, blockFn: Circus.BlockFn): void;
- each: (
- table: Global.EachTable,
- ...taggedTemplateData: Global.TemplateData
- ) => (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- only: {
- (blockName: Circus.BlockName, blockFn: Circus.BlockFn): void;
- each: (
- table: Global.EachTable,
- ...taggedTemplateData: Global.TemplateData
- ) => (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- };
- skip: {
- (blockName: Circus.BlockName, blockFn: Circus.BlockFn): void;
- each: (
- table: Global.EachTable,
- ...taggedTemplateData: Global.TemplateData
- ) => (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- };
-};
-declare const beforeEach: THook;
-declare const beforeAll: THook;
-declare const afterEach: THook;
-declare const afterAll: THook;
-declare const test: Global.It;
-declare const it: Global.It;
-export declare type Event = Circus.Event;
-export declare type State = Circus.State;
-export {afterAll, afterEach, beforeAll, beforeEach, describe, it, test};
+import type {Circus} from '@jest/types';
+import type {Global} from '@jest/types';
+
+declare const afterAll_2: THook;
+export {afterAll_2 as afterAll};
+
+declare const afterEach_2: THook;
+export {afterEach_2 as afterEach};
+
+declare const beforeAll_2: THook;
+export {beforeAll_2 as beforeAll};
+
+declare const beforeEach_2: THook;
+export {beforeEach_2 as beforeEach};
+
declare const _default: {
afterAll: THook;
afterEach: THook;
@@ -92,3 +61,61 @@ declare const _default: {
test: Global.It;
};
export default _default;
+
+declare const describe_2: {
+ (blockName: Circus.BlockName, blockFn: Circus.BlockFn): void;
+ each: (
+ table: Global.EachTable,
+ ...taggedTemplateData: Global.TemplateData
+ ) => (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ only: {
+ (blockName: Circus.BlockName, blockFn: Circus.BlockFn): void;
+ each: (
+ table: Global.EachTable,
+ ...taggedTemplateData: Global.TemplateData
+ ) => (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ };
+ skip: {
+ (blockName: Circus.BlockName, blockFn: Circus.BlockFn): void;
+ each: (
+ table: Global.EachTable,
+ ...taggedTemplateData: Global.TemplateData
+ ) => (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ };
+};
+export {describe_2 as describe};
+
+declare type Event_2 = Circus.Event;
+export {Event_2 as Event};
+
+export declare const getState: () => Circus.State;
+
+declare const it_2: Global.It;
+export {it_2 as it};
+
+export declare const resetState: () => void;
+
+export declare const run: () => Promise<Circus.RunResult>;
+
+export declare const setState: (state: Circus.State) => Circus.State;
+
+export declare type State = Circus.State;
+
+declare const test_2: Global.It;
+export {test_2 as test};
+
+declare type THook = (fn: Circus.HookFn, timeout?: number) => void;
+
+export {};
diff --git i/packages/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.d.ts w/packages/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.d.ts
deleted file mode 100644
index 970f311c93..0000000000
--- i/packages/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.d.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {JestEnvironment} from '@jest/environment';
-import type {TestFileEvent, TestResult} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import type Runtime from 'jest-runtime';
-declare const jestAdapter: (
- globalConfig: Config.GlobalConfig,
- config: Config.ProjectConfig,
- environment: JestEnvironment,
- runtime: Runtime,
- testPath: string,
- sendMessageToJest?:
- | TestFileEvent<keyof import('@jest/test-result').TestEvents>
- | undefined,
-) => Promise<TestResult>;
-export default jestAdapter;
diff --git i/packages/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.d.ts w/packages/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.d.ts
deleted file mode 100644
index 2069777985..0000000000
--- i/packages/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.d.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {JestEnvironment} from '@jest/environment';
-import {TestFileEvent, TestResult} from '@jest/test-result';
-import type {Config, Global} from '@jest/types';
-import {Expect} from 'expect';
-import {SnapshotState} from 'jest-snapshot';
-import globals from '..';
-declare type Process = NodeJS.Process;
-interface JestGlobals extends Global.TestFrameworkGlobals {
- expect: Expect;
-}
-export declare const initialize: ({
- config,
- environment,
- globalConfig,
- localRequire,
- parentProcess,
- sendMessageToJest,
- setGlobalsForRuntime,
- testPath,
-}: {
- config: Config.ProjectConfig;
- environment: JestEnvironment;
- globalConfig: Config.GlobalConfig;
- localRequire: <T = unknown>(path: Config.Path) => T;
- testPath: Config.Path;
- parentProcess: Process;
- sendMessageToJest?:
- | TestFileEvent<keyof import('@jest/test-result').TestEvents>
- | undefined;
- setGlobalsForRuntime: (globals: JestGlobals) => void;
-}) => Promise<{
- globals: Global.TestFrameworkGlobals;
- snapshotState: SnapshotState;
-}>;
-export declare const runAndTransformResultsToJestFormat: ({
- config,
- globalConfig,
- testPath,
-}: {
- config: Config.ProjectConfig;
- globalConfig: Config.GlobalConfig;
- testPath: string;
-}) => Promise<TestResult>;
-export {};
diff --git i/packages/jest-circus/build/legacy-code-todo-rewrite/jestExpect.d.ts w/packages/jest-circus/build/legacy-code-todo-rewrite/jestExpect.d.ts
deleted file mode 100644
index ec6dc1c300..0000000000
--- i/packages/jest-circus/build/legacy-code-todo-rewrite/jestExpect.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import {Expect} from 'expect';
-export default function jestExpect(
- config: Pick<Config.GlobalConfig, 'expand'>,
-): Expect;
diff --git i/packages/jest-circus/build/run.d.ts w/packages/jest-circus/build/run.d.ts
deleted file mode 100644
index faf5f2361e..0000000000
--- i/packages/jest-circus/build/run.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Circus} from '@jest/types';
-declare const run: () => Promise<Circus.RunResult>;
-export default run;
diff --git i/packages/jest-circus/build/state.d.ts w/packages/jest-circus/build/state.d.ts
deleted file mode 100644
index 1eb83616f5..0000000000
--- i/packages/jest-circus/build/state.d.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Circus} from '@jest/types';
-export declare const ROOT_DESCRIBE_BLOCK_NAME = 'ROOT_DESCRIBE_BLOCK';
-export declare const resetState: () => void;
-export declare const getState: () => Circus.State;
-export declare const setState: (state: Circus.State) => Circus.State;
-export declare const dispatch: (event: Circus.AsyncEvent) => Promise<void>;
-export declare const dispatchSync: (event: Circus.SyncEvent) => void;
-export declare const addEventHandler: (handler: Circus.EventHandler) => void;
diff --git i/packages/jest-circus/build/testCaseReportHandler.d.ts w/packages/jest-circus/build/testCaseReportHandler.d.ts
deleted file mode 100644
index 61f919beed..0000000000
--- i/packages/jest-circus/build/testCaseReportHandler.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {TestFileEvent} from '@jest/test-result';
-import type {Circus} from '@jest/types';
-declare const testCaseReportHandler: (
- testPath: string,
- sendMessageToJest: TestFileEvent,
-) => (event: Circus.Event) => void;
-export default testCaseReportHandler;
diff --git i/packages/jest-circus/build/types.d.ts w/packages/jest-circus/build/types.d.ts
deleted file mode 100644
index 4ac6af8a39..0000000000
--- i/packages/jest-circus/build/types.d.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Circus} from '@jest/types';
-import type {Expect} from 'expect';
-export declare const STATE_SYM: 'STATE_SYM_SYMBOL';
-export declare const RETRY_TIMES: 'RETRY_TIMES_SYMBOL';
-export declare const TEST_TIMEOUT_SYMBOL: 'TEST_TIMEOUT_SYMBOL';
-declare global {
- namespace NodeJS {
- interface Global {
- STATE_SYM_SYMBOL: Circus.State;
- RETRY_TIMES_SYMBOL: string;
- TEST_TIMEOUT_SYMBOL: number;
- expect: Expect;
- }
- }
-}
diff --git i/packages/jest-circus/build/utils.d.ts w/packages/jest-circus/build/utils.d.ts
deleted file mode 100644
index bc4330bc1a..0000000000
--- i/packages/jest-circus/build/utils.d.ts
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {AssertionResult} from '@jest/test-result';
-import type {Circus} from '@jest/types';
-export declare const makeDescribe: (
- name: Circus.BlockName,
- parent?: Circus.DescribeBlock | undefined,
- mode?: Circus.BlockMode | undefined,
-) => Circus.DescribeBlock;
-export declare const makeTest: (
- fn: Circus.TestFn,
- mode: Circus.TestMode,
- name: Circus.TestName,
- parent: Circus.DescribeBlock,
- timeout: number | undefined,
- asyncError: Circus.Exception,
-) => Circus.TestEntry;
-declare type DescribeHooks = {
- beforeAll: Array<Circus.Hook>;
- afterAll: Array<Circus.Hook>;
-};
-export declare const getAllHooksForDescribe: (
- describe: Circus.DescribeBlock,
-) => DescribeHooks;
-declare type TestHooks = {
- beforeEach: Array<Circus.Hook>;
- afterEach: Array<Circus.Hook>;
-};
-export declare const getEachHooksForTest: (test: Circus.TestEntry) => TestHooks;
-export declare const describeBlockHasTests: (
- describe: Circus.DescribeBlock,
-) => boolean;
-export declare const callAsyncCircusFn: (
- testOrHook: Circus.TestEntry | Circus.Hook,
- testContext: Circus.TestContext | undefined,
- {
- isHook,
- timeout,
- }: {
- isHook: boolean;
- timeout: number;
- },
-) => Promise<unknown>;
-export declare const getTestDuration: (test: Circus.TestEntry) => number | null;
-export declare const makeRunResult: (
- describeBlock: Circus.DescribeBlock,
- unhandledErrors: Array<Error>,
-) => Circus.RunResult;
-export declare const makeSingleTestResult: (
- test: Circus.TestEntry,
-) => Circus.TestResult;
-export declare const getTestID: (test: Circus.TestEntry) => string;
-export declare const addErrorToEachTestUnderDescribe: (
- describeBlock: Circus.DescribeBlock,
- error: Circus.Exception,
- asyncError: Circus.Exception,
-) => void;
-export declare function invariant(
- condition: unknown,
- message?: string,
-): asserts condition;
-export declare const parseSingleTestResult: (
- testResult: Circus.TestResult,
-) => AssertionResult;
-export {};
diff --git i/packages/jest-cli/build/cli/args.d.ts w/packages/jest-cli/build/cli/args.d.ts
deleted file mode 100644
index ebc8d70e57..0000000000
--- i/packages/jest-cli/build/cli/args.d.ts
+++ /dev/null
@@ -1,449 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export declare function check(argv: Config.Argv): true;
-export declare const usage =
- 'Usage: $0 [--config=<pathToConfigFile>] [TestPathPattern]';
-export declare const docs = 'Documentation: https://jestjs.io/';
-export declare const options: {
- readonly all: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly automock: {
- readonly description: 'Automock all files by default.';
- readonly type: 'boolean';
- };
- readonly bail: {
- readonly alias: 'b';
- readonly description: 'Exit the test suite immediately after `n` number of failing tests.';
- readonly type: 'boolean';
- };
- readonly cache: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly cacheDirectory: {
- readonly description: string;
- readonly type: 'string';
- };
- readonly changedFilesWithAncestor: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly changedSince: {
- readonly description: string;
- readonly nargs: 1;
- readonly type: 'string';
- };
- readonly ci: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly clearCache: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly clearMocks: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly collectCoverage: {
- readonly description: 'Alias for --coverage.';
- readonly type: 'boolean';
- };
- readonly collectCoverageFrom: {
- readonly description: string;
- readonly type: 'string';
- };
- readonly collectCoverageOnlyFrom: {
- readonly description: 'Explicit list of paths coverage will be restricted to.';
- readonly string: true;
- readonly type: 'array';
- };
- readonly color: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly colors: {
- readonly description: 'Alias for `--color`.';
- readonly type: 'boolean';
- };
- readonly config: {
- readonly alias: 'c';
- readonly description: string;
- readonly type: 'string';
- };
- readonly coverage: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly coverageDirectory: {
- readonly description: 'The directory where Jest should output its coverage files.';
- readonly type: 'string';
- };
- readonly coveragePathIgnorePatterns: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly coverageProvider: {
- readonly choices: readonly ['babel', 'v8'];
- readonly description: 'Select between Babel and V8 to collect coverage';
- };
- readonly coverageReporters: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly coverageThreshold: {
- readonly description: string;
- readonly type: 'string';
- };
- readonly debug: {
- readonly description: 'Print debugging info about your jest config.';
- readonly type: 'boolean';
- };
- readonly detectLeaks: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly detectOpenHandles: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly env: {
- readonly description: string;
- readonly type: 'string';
- };
- readonly errorOnDeprecated: {
- readonly description: 'Make calling deprecated APIs throw helpful error messages.';
- readonly type: 'boolean';
- };
- readonly expand: {
- readonly alias: 'e';
- readonly description: 'Use this flag to show full diffs instead of a patch.';
- readonly type: 'boolean';
- };
- readonly filter: {
- readonly description: string;
- readonly type: 'string';
- };
- readonly findRelatedTests: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly forceExit: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly globalSetup: {
- readonly description: 'The path to a module that runs before All Tests.';
- readonly type: 'string';
- };
- readonly globalTeardown: {
- readonly description: 'The path to a module that runs after All Tests.';
- readonly type: 'string';
- };
- readonly globals: {
- readonly description: string;
- readonly type: 'string';
- };
- readonly haste: {
- readonly description: 'A JSON string with map of variables for the haste module system';
- readonly type: 'string';
- };
- readonly init: {
- readonly description: 'Generate a basic configuration file';
- readonly type: 'boolean';
- };
- readonly injectGlobals: {
- readonly description: 'Should Jest inject global variables or not';
- readonly type: 'boolean';
- };
- readonly json: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly lastCommit: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly listTests: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly logHeapUsage: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly maxConcurrency: {
- readonly description: string;
- readonly type: 'number';
- };
- readonly maxWorkers: {
- readonly alias: 'w';
- readonly description: string;
- readonly type: 'string';
- };
- readonly moduleDirectories: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly moduleFileExtensions: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly moduleNameMapper: {
- readonly description: string;
- readonly type: 'string';
- };
- readonly modulePathIgnorePatterns: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly modulePaths: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly noStackTrace: {
- readonly description: 'Disables stack trace in test results output';
- readonly type: 'boolean';
- };
- readonly notify: {
- readonly description: 'Activates notifications for test results.';
- readonly type: 'boolean';
- };
- readonly notifyMode: {
- readonly description: 'Specifies when notifications will appear for test results.';
- readonly type: 'string';
- };
- readonly onlyChanged: {
- readonly alias: 'o';
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly onlyFailures: {
- readonly alias: 'f';
- readonly description: 'Run tests that failed in the previous execution.';
- readonly type: 'boolean';
- };
- readonly outputFile: {
- readonly description: string;
- readonly type: 'string';
- };
- readonly passWithNoTests: {
- readonly description: 'Will not fail if no tests are found (for example while using `--testPathPattern`.)';
- readonly type: 'boolean';
- };
- readonly preset: {
- readonly description: "A preset that is used as a base for Jest's configuration.";
- readonly type: 'string';
- };
- readonly prettierPath: {
- readonly description: 'The path to the "prettier" module used for inline snapshots.';
- readonly type: 'string';
- };
- readonly projects: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly reporters: {
- readonly description: 'A list of custom reporters for the test suite.';
- readonly string: true;
- readonly type: 'array';
- };
- readonly resetMocks: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly resetModules: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly resolver: {
- readonly description: 'A JSON string which allows the use of a custom resolver.';
- readonly type: 'string';
- };
- readonly restoreMocks: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly rootDir: {
- readonly description: string;
- readonly type: 'string';
- };
- readonly roots: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly runInBand: {
- readonly alias: 'i';
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly runTestsByPath: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly runner: {
- readonly description: "Allows to use a custom runner instead of Jest's default test runner.";
- readonly type: 'string';
- };
- readonly selectProjects: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly setupFiles: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly setupFilesAfterEnv: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly showConfig: {
- readonly description: 'Print your jest config and then exits.';
- readonly type: 'boolean';
- };
- readonly silent: {
- readonly description: 'Prevent tests from printing messages through the console.';
- readonly type: 'boolean';
- };
- readonly skipFilter: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly snapshotSerializers: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly testEnvironment: {
- readonly description: 'Alias for --env';
- readonly type: 'string';
- };
- readonly testEnvironmentOptions: {
- readonly description: string;
- readonly type: 'string';
- };
- readonly testFailureExitCode: {
- readonly description: 'Exit code of `jest` command if the test run failed';
- readonly type: 'string';
- };
- readonly testLocationInResults: {
- readonly description: 'Add `location` information to the test results';
- readonly type: 'boolean';
- };
- readonly testMatch: {
- readonly description: 'The glob patterns Jest uses to detect test files.';
- readonly string: true;
- readonly type: 'array';
- };
- readonly testNamePattern: {
- readonly alias: 't';
- readonly description: 'Run only tests with a name that matches the regex pattern.';
- readonly type: 'string';
- };
- readonly testPathIgnorePatterns: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly testPathPattern: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly testRegex: {
- readonly description: 'A string or array of string regexp patterns that Jest uses to detect test files.';
- readonly string: true;
- readonly type: 'array';
- };
- readonly testResultsProcessor: {
- readonly description: string;
- readonly type: 'string';
- };
- readonly testRunner: {
- readonly description: string;
- readonly type: 'string';
- };
- readonly testSequencer: {
- readonly description: string;
- readonly type: 'string';
- };
- readonly testTimeout: {
- readonly description: 'This option sets the default timeouts of test cases.';
- readonly type: 'number';
- };
- readonly testURL: {
- readonly description: 'This option sets the URL for the jsdom environment.';
- readonly type: 'string';
- };
- readonly timers: {
- readonly description: string;
- readonly type: 'string';
- };
- readonly transform: {
- readonly description: string;
- readonly type: 'string';
- };
- readonly transformIgnorePatterns: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly unmockedModulePathPatterns: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly updateSnapshot: {
- readonly alias: 'u';
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly useStderr: {
- readonly description: 'Divert all output to stderr.';
- readonly type: 'boolean';
- };
- readonly verbose: {
- readonly description: 'Display individual test results with the test suite hierarchy.';
- readonly type: 'boolean';
- };
- readonly version: {
- readonly alias: 'v';
- readonly description: 'Print the version and exit';
- readonly type: 'boolean';
- };
- readonly watch: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly watchAll: {
- readonly description: string;
- readonly type: 'boolean';
- };
- readonly watchPathIgnorePatterns: {
- readonly description: string;
- readonly string: true;
- readonly type: 'array';
- };
- readonly watchman: {
- readonly description: string;
- readonly type: 'boolean';
- };
-};
diff --git i/packages/jest-cli/build/cli/index.d.ts w/packages/jest-cli/build/cli/index.d.ts
deleted file mode 100644
index cd9e759a9f..0000000000
--- i/packages/jest-cli/build/cli/index.d.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export declare function run(
- maybeArgv?: Array<string>,
- project?: Config.Path,
-): Promise<void>;
-export declare const buildArgv: (
- maybeArgv?: string[] | undefined,
-) => Config.Argv;
diff --git i/packages/jest-cli/build/index.d.ts w/packages/jest-cli/build/index.d.ts
index 6049077383..79e9442994 100644
--- i/packages/jest-cli/build/index.d.ts
+++ w/packages/jest-cli/build/index.d.ts
@@ -4,4 +4,11 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-export {run} from './cli';
+import type {Config} from '@jest/types';
+
+export declare function run(
+ maybeArgv?: Array<string>,
+ project?: Config.Path,
+): Promise<void>;
+
+export {};
diff --git i/packages/jest-cli/build/init/errors.d.ts w/packages/jest-cli/build/init/errors.d.ts
deleted file mode 100644
index bdd9702d34..0000000000
--- i/packages/jest-cli/build/init/errors.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare class NotFoundPackageJsonError extends Error {
- constructor(rootDir: string);
-}
-export declare class MalformedPackageJsonError extends Error {
- constructor(packageJsonPath: string);
-}
diff --git i/packages/jest-cli/build/init/generateConfigFile.d.ts w/packages/jest-cli/build/init/generateConfigFile.d.ts
deleted file mode 100644
index ac1b7d9f3c..0000000000
--- i/packages/jest-cli/build/init/generateConfigFile.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-declare const generateConfigFile: (
- results: Record<string, unknown>,
- generateEsm?: boolean,
-) => string;
-export default generateConfigFile;
diff --git i/packages/jest-cli/build/init/index.d.ts w/packages/jest-cli/build/init/index.d.ts
deleted file mode 100644
index a412b5aad7..0000000000
--- i/packages/jest-cli/build/init/index.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function init(rootDir?: string): Promise<void>;
diff --git i/packages/jest-cli/build/init/modifyPackageJson.d.ts w/packages/jest-cli/build/init/modifyPackageJson.d.ts
deleted file mode 100644
index 6f512f726f..0000000000
--- i/packages/jest-cli/build/init/modifyPackageJson.d.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {ProjectPackageJson} from './types';
-declare const modifyPackageJson: ({
- projectPackageJson,
- shouldModifyScripts,
-}: {
- projectPackageJson: ProjectPackageJson;
- shouldModifyScripts: boolean;
-}) => string;
-export default modifyPackageJson;
diff --git i/packages/jest-cli/build/init/questions.d.ts w/packages/jest-cli/build/init/questions.d.ts
deleted file mode 100644
index a1b27989f4..0000000000
--- i/packages/jest-cli/build/init/questions.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {PromptObject} from 'prompts';
-declare const defaultQuestions: Array<PromptObject>;
-export default defaultQuestions;
-export declare const testScriptQuestion: PromptObject;
diff --git i/packages/jest-cli/build/init/types.d.ts w/packages/jest-cli/build/init/types.d.ts
deleted file mode 100644
index 4f40513e8e..0000000000
--- i/packages/jest-cli/build/init/types.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export declare type ProjectPackageJson = {
- jest?: Partial<Config.InitialOptions>;
- scripts?: Record<string, string>;
- type?: 'commonjs' | 'module';
-};
diff --git i/packages/jest-config/build/Defaults.d.ts w/packages/jest-config/build/Defaults.d.ts
deleted file mode 100644
index 156bc69585..0000000000
--- i/packages/jest-config/build/Defaults.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-declare const defaultOptions: Config.DefaultOptions;
-export default defaultOptions;
diff --git i/packages/jest-config/build/Deprecated.d.ts w/packages/jest-config/build/Deprecated.d.ts
deleted file mode 100644
index 7eb3f25d7f..0000000000
--- i/packages/jest-config/build/Deprecated.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {DeprecatedOptions} from 'jest-validate';
-declare const deprecatedOptions: DeprecatedOptions;
-export default deprecatedOptions;
diff --git i/packages/jest-config/build/Descriptions.d.ts w/packages/jest-config/build/Descriptions.d.ts
deleted file mode 100644
index f96ea68db4..0000000000
--- i/packages/jest-config/build/Descriptions.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-declare const descriptions: {
- [key in keyof Config.InitialOptions]: string;
-};
-export default descriptions;
diff --git i/packages/jest-config/build/ReporterValidationErrors.d.ts w/packages/jest-config/build/ReporterValidationErrors.d.ts
deleted file mode 100644
index aef5505efe..0000000000
--- i/packages/jest-config/build/ReporterValidationErrors.d.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import {ValidationError} from 'jest-validate';
-/**
- * Reporter Validation Error is thrown if the given arguments
- * within the reporter are not valid.
- *
- * This is a highly specific reporter error and in the future will be
- * merged with jest-validate. Till then, we can make use of it. It works
- * and that's what counts most at this time.
- */
-export declare function createReporterError(
- reporterIndex: number,
- reporterValue: Array<Config.ReporterConfig> | string,
-): ValidationError;
-export declare function createArrayReporterError(
- arrayReporter: Config.ReporterConfig,
- reporterIndex: number,
- valueIndex: number,
- value: string | Record<string, unknown>,
- expectedType: string,
- valueName: string,
-): ValidationError;
-export declare function validateReporters(
- reporterConfig: Array<Config.ReporterConfig | string>,
-): boolean;
diff --git i/packages/jest-config/build/ValidConfig.d.ts w/packages/jest-config/build/ValidConfig.d.ts
deleted file mode 100644
index 3dc6a05838..0000000000
--- i/packages/jest-config/build/ValidConfig.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-declare const initialOptions: Config.InitialOptions;
-export default initialOptions;
diff --git i/packages/jest-config/build/color.d.ts w/packages/jest-config/build/color.d.ts
deleted file mode 100644
index d70831e146..0000000000
--- i/packages/jest-config/build/color.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {ForegroundColor} from 'chalk';
-declare type Color = typeof ForegroundColor;
-export declare const getDisplayNameColor: (seed?: string | undefined) => Color;
-export {};
diff --git i/packages/jest-config/build/constants.d.ts w/packages/jest-config/build/constants.d.ts
deleted file mode 100644
index b1a9e102aa..0000000000
--- i/packages/jest-config/build/constants.d.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare const NODE_MODULES: string;
-export declare const DEFAULT_JS_PATTERN = '\\.[jt]sx?$';
-export declare const DEFAULT_REPORTER_LABEL = 'default';
-export declare const PACKAGE_JSON = 'package.json';
-export declare const JEST_CONFIG_BASE_NAME = 'jest.config';
-export declare const JEST_CONFIG_EXT_CJS = '.cjs';
-export declare const JEST_CONFIG_EXT_MJS = '.mjs';
-export declare const JEST_CONFIG_EXT_JS = '.js';
-export declare const JEST_CONFIG_EXT_TS = '.ts';
-export declare const JEST_CONFIG_EXT_JSON = '.json';
-export declare const JEST_CONFIG_EXT_ORDER: readonly string[];
diff --git i/packages/jest-config/build/getCacheDirectory.d.ts w/packages/jest-config/build/getCacheDirectory.d.ts
deleted file mode 100644
index 5b7da7a60e..0000000000
--- i/packages/jest-config/build/getCacheDirectory.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-declare const getCacheDirectory: () => Config.Path;
-export default getCacheDirectory;
diff --git i/packages/jest-config/build/getMaxWorkers.d.ts w/packages/jest-config/build/getMaxWorkers.d.ts
deleted file mode 100644
index 437f3f46c7..0000000000
--- i/packages/jest-config/build/getMaxWorkers.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function getMaxWorkers(
- argv: Partial<
- Pick<Config.Argv, 'maxWorkers' | 'runInBand' | 'watch' | 'watchAll'>
- >,
- defaultOptions?: Partial<Pick<Config.Argv, 'maxWorkers'>>,
-): number;
diff --git i/packages/jest-config/build/index.d.ts w/packages/jest-config/build/index.d.ts
index db1752049a..19892caaea 100644
--- i/packages/jest-config/build/index.d.ts
+++ w/packages/jest-config/build/index.d.ts
@@ -5,21 +5,85 @@
* LICENSE file in the root directory of this source tree.
*/
import type {Config} from '@jest/types';
-import * as constants from './constants';
-export {resolveTestEnvironment as getTestEnvironment} from 'jest-resolve';
-export {isJSONString} from './utils';
-export {default as normalize} from './normalize';
-export {default as deprecationEntries} from './Deprecated';
-export {replaceRootDirInPath} from './utils';
-export {default as defaults} from './Defaults';
-export {default as descriptions} from './Descriptions';
+import type {DeprecatedOptions} from 'jest-validate';
+import {resolveTestEnvironment as getTestEnvironment} from 'jest-resolve';
+
+declare type AllOptions = Config.ProjectConfig & Config.GlobalConfig;
+
+declare namespace constants {
+ export {
+ NODE_MODULES,
+ DEFAULT_JS_PATTERN,
+ DEFAULT_REPORTER_LABEL,
+ PACKAGE_JSON,
+ JEST_CONFIG_BASE_NAME,
+ JEST_CONFIG_EXT_CJS,
+ JEST_CONFIG_EXT_MJS,
+ JEST_CONFIG_EXT_JS,
+ JEST_CONFIG_EXT_TS,
+ JEST_CONFIG_EXT_JSON,
+ JEST_CONFIG_EXT_ORDER,
+ };
+}
export {constants};
+
+declare const DEFAULT_JS_PATTERN = '\\.[jt]sx?$';
+
+declare const DEFAULT_REPORTER_LABEL = 'default';
+
+export declare const defaults: Config.DefaultOptions;
+
+export declare const deprecationEntries: DeprecatedOptions;
+
+export declare const descriptions: {
+ [key in keyof Config.InitialOptions]: string;
+};
+
+export {getTestEnvironment};
+
+export declare const isJSONString: (
+ text?: string | JSONString | undefined,
+) => text is JSONString;
+
+declare const JEST_CONFIG_BASE_NAME = 'jest.config';
+
+declare const JEST_CONFIG_EXT_CJS = '.cjs';
+
+declare const JEST_CONFIG_EXT_JS = '.js';
+
+declare const JEST_CONFIG_EXT_JSON = '.json';
+
+declare const JEST_CONFIG_EXT_MJS = '.mjs';
+
+declare const JEST_CONFIG_EXT_ORDER: readonly string[];
+
+declare const JEST_CONFIG_EXT_TS = '.ts';
+
+declare type JSONString = string & {
+ readonly $$type: never;
+};
+
+declare const NODE_MODULES: string;
+
+export declare function normalize(
+ initialOptions: Config.InitialOptions,
+ argv: Config.Argv,
+ configPath?: Config.Path | null,
+ projectIndex?: number,
+): Promise<{
+ hasDeprecationWarnings: boolean;
+ options: AllOptions;
+}>;
+
+declare const PACKAGE_JSON = 'package.json';
+
declare type ReadConfig = {
configPath: Config.Path | null | undefined;
globalConfig: Config.GlobalConfig;
hasDeprecationWarnings: boolean;
projectConfig: Config.ProjectConfig;
};
+
export declare function readConfig(
argv: Config.Argv,
packageRootOrConfig: Config.Path | Config.InitialOptions,
@@ -28,6 +92,7 @@ export declare function readConfig(
projectIndex?: number,
skipMultipleConfigWarning?: boolean,
): Promise<ReadConfig>;
+
export declare function readConfigs(
argv: Config.Argv,
projectPaths: Array<Config.Path>,
@@ -36,3 +101,10 @@ export declare function readConfigs(
configs: Array<Config.ProjectConfig>;
hasDeprecationWarnings: boolean;
}>;
+
+export declare const replaceRootDirInPath: (
+ rootDir: Config.Path,
+ filePath: Config.Path,
+) => string;
+
+export {};
diff --git i/packages/jest-config/build/normalize.d.ts w/packages/jest-config/build/normalize.d.ts
deleted file mode 100644
index 81f32eec31..0000000000
--- i/packages/jest-config/build/normalize.d.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-declare type AllOptions = Config.ProjectConfig & Config.GlobalConfig;
-export default function normalize(
- initialOptions: Config.InitialOptions,
- argv: Config.Argv,
- configPath?: Config.Path | null,
- projectIndex?: number,
-): Promise<{
- hasDeprecationWarnings: boolean;
- options: AllOptions;
-}>;
-export {};
diff --git i/packages/jest-config/build/readConfigFileAndSetRootDir.d.ts w/packages/jest-config/build/readConfigFileAndSetRootDir.d.ts
deleted file mode 100644
index e27cc5cc3f..0000000000
--- i/packages/jest-config/build/readConfigFileAndSetRootDir.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function readConfigFileAndSetRootDir(
- configPath: Config.Path,
-): Promise<Config.InitialOptions>;
diff --git i/packages/jest-config/build/resolveConfigPath.d.ts w/packages/jest-config/build/resolveConfigPath.d.ts
deleted file mode 100644
index 65566cc286..0000000000
--- i/packages/jest-config/build/resolveConfigPath.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function resolveConfigPath(
- pathToResolve: Config.Path,
- cwd: Config.Path,
- skipMultipleConfigWarning?: boolean,
-): Config.Path;
diff --git i/packages/jest-config/build/setFromArgv.d.ts w/packages/jest-config/build/setFromArgv.d.ts
deleted file mode 100644
index 40fe99d15b..0000000000
--- i/packages/jest-config/build/setFromArgv.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function setFromArgv(
- options: Config.InitialOptions,
- argv: Config.Argv,
-): Config.InitialOptions;
diff --git i/packages/jest-config/build/utils.d.ts w/packages/jest-config/build/utils.d.ts
deleted file mode 100644
index 42d43f9481..0000000000
--- i/packages/jest-config/build/utils.d.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-declare type ResolveOptions = {
- rootDir: Config.Path;
- key: string;
- filePath: Config.Path;
- optional?: boolean;
-};
-export declare const BULLET: string;
-export declare const DOCUMENTATION_NOTE: string;
-export declare const resolve: (
- resolver: string | null | undefined,
- {key, filePath, rootDir, optional}: ResolveOptions,
-) => string;
-export declare const escapeGlobCharacters: (path: Config.Path) => Config.Glob;
-export declare const replaceRootDirInPath: (
- rootDir: Config.Path,
- filePath: Config.Path,
-) => string;
-declare type OrArray<T> = T | Array<T>;
-declare type ReplaceRootDirConfigObj = Record<string, Config.Path>;
-declare type ReplaceRootDirConfigValues =
- | OrArray<ReplaceRootDirConfigObj>
- | OrArray<RegExp>
- | OrArray<Config.Path>;
-export declare const _replaceRootDirTags: <
- T extends ReplaceRootDirConfigValues,
->(
- rootDir: Config.Path,
- config: T,
-) => T;
-declare type JSONString = string & {
- readonly $$type: never;
-};
-export declare const isJSONString: (
- text?: string | JSONString | undefined,
-) => text is JSONString;
-export {};
diff --git i/packages/jest-config/build/validatePattern.d.ts w/packages/jest-config/build/validatePattern.d.ts
deleted file mode 100644
index 8f15207c50..0000000000
--- i/packages/jest-config/build/validatePattern.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function validatePattern(pattern?: string): boolean;
diff --git i/packages/jest-console/build/BufferedConsole.d.ts w/packages/jest-console/build/BufferedConsole.d.ts
deleted file mode 100644
index 73922ca922..0000000000
--- i/packages/jest-console/build/BufferedConsole.d.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import {Console} from 'console';
-import {InspectOptions} from 'util';
-import type {ConsoleBuffer, LogMessage, LogType} from './types';
-export default class BufferedConsole extends Console {
- private _buffer;
- private _counters;
- private _timers;
- private _groupDepth;
- Console: typeof Console;
- constructor();
- static write(
- buffer: ConsoleBuffer,
- type: LogType,
- message: LogMessage,
- level?: number | null,
- ): ConsoleBuffer;
- private _log;
- assert(value: unknown, message?: string | Error): void;
- count(label?: string): void;
- countReset(label?: string): void;
- debug(firstArg: unknown, ...rest: Array<unknown>): void;
- dir(firstArg: unknown, options?: InspectOptions): void;
- dirxml(firstArg: unknown, ...rest: Array<unknown>): void;
- error(firstArg: unknown, ...rest: Array<unknown>): void;
- group(title?: string, ...rest: Array<unknown>): void;
- groupCollapsed(title?: string, ...rest: Array<unknown>): void;
- groupEnd(): void;
- info(firstArg: unknown, ...rest: Array<unknown>): void;
- log(firstArg: unknown, ...rest: Array<unknown>): void;
- time(label?: string): void;
- timeEnd(label?: string): void;
- timeLog(label?: string, ...data: Array<unknown>): void;
- warn(firstArg: unknown, ...rest: Array<unknown>): void;
- getBuffer(): ConsoleBuffer | undefined;
-}
diff --git i/packages/jest-console/build/CustomConsole.d.ts w/packages/jest-console/build/CustomConsole.d.ts
deleted file mode 100644
index de9728bb32..0000000000
--- i/packages/jest-console/build/CustomConsole.d.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import {Console} from 'console';
-import {InspectOptions} from 'util';
-import type {LogMessage, LogType} from './types';
-declare type Formatter = (type: LogType, message: LogMessage) => string;
-export default class CustomConsole extends Console {
- private _stdout;
- private _stderr;
- private _formatBuffer;
- private _counters;
- private _timers;
- private _groupDepth;
- Console: typeof Console;
- constructor(
- stdout: NodeJS.WriteStream,
- stderr: NodeJS.WriteStream,
- formatBuffer?: Formatter,
- );
- private _log;
- private _logError;
- assert(value: unknown, message?: string | Error): asserts value;
- count(label?: string): void;
- countReset(label?: string): void;
- debug(firstArg: unknown, ...args: Array<unknown>): void;
- dir(firstArg: unknown, options?: InspectOptions): void;
- dirxml(firstArg: unknown, ...args: Array<unknown>): void;
- error(firstArg: unknown, ...args: Array<unknown>): void;
- group(title?: string, ...args: Array<unknown>): void;
- groupCollapsed(title?: string, ...args: Array<unknown>): void;
- groupEnd(): void;
- info(firstArg: unknown, ...args: Array<unknown>): void;
- log(firstArg: unknown, ...args: Array<unknown>): void;
- time(label?: string): void;
- timeEnd(label?: string): void;
- timeLog(label?: string, ...data: Array<unknown>): void;
- warn(firstArg: unknown, ...args: Array<unknown>): void;
- getBuffer(): undefined;
-}
-export {};
diff --git i/packages/jest-console/build/NullConsole.d.ts w/packages/jest-console/build/NullConsole.d.ts
deleted file mode 100644
index 3af9d20014..0000000000
--- i/packages/jest-console/build/NullConsole.d.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import CustomConsole from './CustomConsole';
-export default class NullConsole extends CustomConsole {
- assert(): void;
- debug(): void;
- dir(): void;
- error(): void;
- info(): void;
- log(): void;
- time(): void;
- timeEnd(): void;
- timeLog(): void;
- trace(): void;
- warn(): void;
- group(): void;
- groupCollapsed(): void;
- groupEnd(): void;
-}
diff --git i/packages/jest-console/build/getConsoleOutput.d.ts w/packages/jest-console/build/getConsoleOutput.d.ts
deleted file mode 100644
index c72307f458..0000000000
--- i/packages/jest-console/build/getConsoleOutput.d.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import {StackTraceConfig} from 'jest-message-util';
-import type {ConsoleBuffer} from './types';
-export default function getConsoleOutput(
- buffer: ConsoleBuffer,
- config: StackTraceConfig,
- globalConfig: Config.GlobalConfig,
-): string;
diff --git i/packages/jest-console/build/index.d.ts w/packages/jest-console/build/index.d.ts
index 46ecb4a5c7..4a49457abb 100644
--- i/packages/jest-console/build/index.d.ts
+++ w/packages/jest-console/build/index.d.ts
@@ -4,8 +4,127 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-export {default as BufferedConsole} from './BufferedConsole';
-export {default as CustomConsole} from './CustomConsole';
-export {default as NullConsole} from './NullConsole';
-export {default as getConsoleOutput} from './getConsoleOutput';
-export type {ConsoleBuffer, LogMessage, LogType, LogEntry} from './types';
+/// <reference types="node" />
+
+import type {Config} from '@jest/types';
+import {Console as Console_2} from 'console';
+import {InspectOptions} from 'util';
+import {StackTraceConfig} from 'jest-message-util';
+
+export declare class BufferedConsole extends Console_2 {
+ private _buffer;
+ private _counters;
+ private _timers;
+ private _groupDepth;
+ Console: typeof Console_2;
+ constructor();
+ static write(
+ buffer: ConsoleBuffer,
+ type: LogType,
+ message: LogMessage,
+ level?: number | null,
+ ): ConsoleBuffer;
+ private _log;
+ assert(value: unknown, message?: string | Error): void;
+ count(label?: string): void;
+ countReset(label?: string): void;
+ debug(firstArg: unknown, ...rest: Array<unknown>): void;
+ dir(firstArg: unknown, options?: InspectOptions): void;
+ dirxml(firstArg: unknown, ...rest: Array<unknown>): void;
+ error(firstArg: unknown, ...rest: Array<unknown>): void;
+ group(title?: string, ...rest: Array<unknown>): void;
+ groupCollapsed(title?: string, ...rest: Array<unknown>): void;
+ groupEnd(): void;
+ info(firstArg: unknown, ...rest: Array<unknown>): void;
+ log(firstArg: unknown, ...rest: Array<unknown>): void;
+ time(label?: string): void;
+ timeEnd(label?: string): void;
+ timeLog(label?: string, ...data: Array<unknown>): void;
+ warn(firstArg: unknown, ...rest: Array<unknown>): void;
+ getBuffer(): ConsoleBuffer | undefined;
+}
+
+export declare type ConsoleBuffer = Array<LogEntry>;
+
+export declare class CustomConsole extends Console_2 {
+ private _stdout;
+ private _stderr;
+ private _formatBuffer;
+ private _counters;
+ private _timers;
+ private _groupDepth;
+ Console: typeof Console_2;
+ constructor(
+ stdout: NodeJS.WriteStream,
+ stderr: NodeJS.WriteStream,
+ formatBuffer?: Formatter,
+ );
+ private _log;
+ private _logError;
+ assert(value: unknown, message?: string | Error): asserts value;
+ count(label?: string): void;
+ countReset(label?: string): void;
+ debug(firstArg: unknown, ...args: Array<unknown>): void;
+ dir(firstArg: unknown, options?: InspectOptions): void;
+ dirxml(firstArg: unknown, ...args: Array<unknown>): void;
+ error(firstArg: unknown, ...args: Array<unknown>): void;
+ group(title?: string, ...args: Array<unknown>): void;
+ groupCollapsed(title?: string, ...args: Array<unknown>): void;
+ groupEnd(): void;
+ info(firstArg: unknown, ...args: Array<unknown>): void;
+ log(firstArg: unknown, ...args: Array<unknown>): void;
+ time(label?: string): void;
+ timeEnd(label?: string): void;
+ timeLog(label?: string, ...data: Array<unknown>): void;
+ warn(firstArg: unknown, ...args: Array<unknown>): void;
+ getBuffer(): undefined;
+}
+
+declare type Formatter = (type: LogType, message: LogMessage) => string;
+
+export declare function getConsoleOutput(
+ buffer: ConsoleBuffer,
+ config: StackTraceConfig,
+ globalConfig: Config.GlobalConfig,
+): string;
+
+export declare type LogEntry = {
+ message: LogMessage;
+ origin: string;
+ type: LogType;
+};
+
+export declare type LogMessage = string;
+
+export declare type LogType =
+ | 'assert'
+ | 'count'
+ | 'debug'
+ | 'dir'
+ | 'dirxml'
+ | 'error'
+ | 'group'
+ | 'groupCollapsed'
+ | 'info'
+ | 'log'
+ | 'time'
+ | 'warn';
+
+export declare class NullConsole extends CustomConsole {
+ assert(): void;
+ debug(): void;
+ dir(): void;
+ error(): void;
+ info(): void;
+ log(): void;
+ time(): void;
+ timeEnd(): void;
+ timeLog(): void;
+ trace(): void;
+ warn(): void;
+ group(): void;
+ groupCollapsed(): void;
+ groupEnd(): void;
+}
+
+export {};
diff --git i/packages/jest-console/build/types.d.ts w/packages/jest-console/build/types.d.ts
deleted file mode 100644
index f5da506d72..0000000000
--- i/packages/jest-console/build/types.d.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare type LogMessage = string;
-export declare type LogEntry = {
- message: LogMessage;
- origin: string;
- type: LogType;
-};
-export declare type LogCounters = {
- [label: string]: number;
-};
-export declare type LogTimers = {
- [label: string]: Date;
-};
-export declare type LogType =
- | 'assert'
- | 'count'
- | 'debug'
- | 'dir'
- | 'dirxml'
- | 'error'
- | 'group'
- | 'groupCollapsed'
- | 'info'
- | 'log'
- | 'time'
- | 'warn';
-export declare type ConsoleBuffer = Array<LogEntry>;
diff --git i/packages/jest-core/build/FailedTestsCache.d.ts w/packages/jest-core/build/FailedTestsCache.d.ts
deleted file mode 100644
index f577adb77b..0000000000
--- i/packages/jest-core/build/FailedTestsCache.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Test, TestResult} from '@jest/test-result';
-export default class FailedTestsCache {
- private _enabledTestsMap?;
- filterTests(tests: Array<Test>): Array<Test>;
- setTestResults(testResults: Array<TestResult>): void;
-}
diff --git i/packages/jest-core/build/FailedTestsInteractiveMode.d.ts w/packages/jest-core/build/FailedTestsInteractiveMode.d.ts
deleted file mode 100644
index 1bf646f5b6..0000000000
--- i/packages/jest-core/build/FailedTestsInteractiveMode.d.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {AggregatedResult, AssertionLocation} from '@jest/test-result';
-declare type RunnerUpdateFunction = (failure?: AssertionLocation) => void;
-export default class FailedTestsInteractiveMode {
- private _pipe;
- private _isActive;
- private _countPaths;
- private _skippedNum;
- private _testAssertions;
- private _updateTestRunnerConfig?;
- constructor(_pipe: NodeJS.WritableStream);
- isActive(): boolean;
- put(key: string): void;
- run(
- failedTestAssertions: Array<AssertionLocation>,
- updateConfig: RunnerUpdateFunction,
- ): void;
- updateWithResults(results: AggregatedResult): void;
- private _clearTestSummary;
- private _drawUIDone;
- private _drawUIDoneWithSkipped;
- private _drawUIProgress;
- private _drawUIOverlay;
- private _run;
- private abort;
- private restart;
-}
-export {};
diff --git i/packages/jest-core/build/ReporterDispatcher.d.ts w/packages/jest-core/build/ReporterDispatcher.d.ts
deleted file mode 100644
index c7eb0bf8f1..0000000000
--- i/packages/jest-core/build/ReporterDispatcher.d.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Reporter, ReporterOnStartOptions} from '@jest/reporters';
-import type {
- AggregatedResult,
- Test,
- TestCaseResult,
- TestResult,
-} from '@jest/test-result';
-import type {Context} from 'jest-runtime';
-export default class ReporterDispatcher {
- private _reporters;
- constructor();
- register(reporter: Reporter): void;
- unregister(ReporterClass: Function): void;
- onTestFileResult(
- test: Test,
- testResult: TestResult,
- results: AggregatedResult,
- ): Promise<void>;
- onTestFileStart(test: Test): Promise<void>;
- onRunStart(
- results: AggregatedResult,
- options: ReporterOnStartOptions,
- ): Promise<void>;
- onTestCaseResult(test: Test, testCaseResult: TestCaseResult): Promise<void>;
- onRunComplete(
- contexts: Set<Context>,
- results: AggregatedResult,
- ): Promise<void>;
- getErrors(): Array<Error>;
- hasErrors(): boolean;
-}
diff --git i/packages/jest-core/build/SearchSource.d.ts w/packages/jest-core/build/SearchSource.d.ts
deleted file mode 100644
index aa34744ab0..0000000000
--- i/packages/jest-core/build/SearchSource.d.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Test} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import type {ChangedFiles} from 'jest-changed-files';
-import type {Context} from 'jest-runtime';
-import type {Filter, Stats} from './types';
-export declare type SearchResult = {
- noSCM?: boolean;
- stats?: Stats;
- collectCoverageFrom?: Set<string>;
- tests: Array<Test>;
- total?: number;
-};
-export declare type TestSelectionConfig = {
- input?: string;
- findRelatedTests?: boolean;
- onlyChanged?: boolean;
- paths?: Array<Config.Path>;
- shouldTreatInputAsPattern?: boolean;
- testPathPattern?: string;
- watch?: boolean;
-};
-export default class SearchSource {
- private _context;
- private _dependencyResolver;
- private _testPathCases;
- constructor(context: Context);
- private _getOrBuildDependencyResolver;
- private _filterTestPathsWithStats;
- private _getAllTestPaths;
- isTestFilePath(path: Config.Path): boolean;
- findMatchingTests(testPathPattern?: string): SearchResult;
- findRelatedTests(
- allPaths: Set<Config.Path>,
- collectCoverage: boolean,
- ): Promise<SearchResult>;
- findTestsByPaths(paths: Array<Config.Path>): SearchResult;
- findRelatedTestsFromPattern(
- paths: Array<Config.Path>,
- collectCoverage: boolean,
- ): Promise<SearchResult>;
- findTestRelatedToChangedFiles(
- changedFilesInfo: ChangedFiles,
- collectCoverage: boolean,
- ): Promise<SearchResult>;
- private _getTestPaths;
- filterPathsWin32(paths: Array<string>): Array<string>;
- getTestPaths(
- globalConfig: Config.GlobalConfig,
- changedFiles: ChangedFiles | undefined,
- filter?: Filter,
- ): Promise<SearchResult>;
- findRelatedSourcesFromTestsInChangedFiles(
- changedFilesInfo: ChangedFiles,
- ): Promise<Array<string>>;
-}
diff --git i/packages/jest-core/build/SnapshotInteractiveMode.d.ts w/packages/jest-core/build/SnapshotInteractiveMode.d.ts
deleted file mode 100644
index 60021823c4..0000000000
--- i/packages/jest-core/build/SnapshotInteractiveMode.d.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {AggregatedResult, AssertionLocation} from '@jest/test-result';
-export default class SnapshotInteractiveMode {
- private _pipe;
- private _isActive;
- private _updateTestRunnerConfig;
- private _testAssertions;
- private _countPaths;
- private _skippedNum;
- constructor(pipe: NodeJS.WritableStream);
- isActive(): boolean;
- getSkippedNum(): number;
- private _clearTestSummary;
- private _drawUIProgress;
- private _drawUIDoneWithSkipped;
- private _drawUIDone;
- private _drawUIOverlay;
- put(key: string): void;
- abort(): void;
- restart(): void;
- updateWithResults(results: AggregatedResult): void;
- private _run;
- run(
- failedSnapshotTestAssertions: Array<AssertionLocation>,
- onConfigChange: (
- assertion: AssertionLocation | null,
- shouldUpdateSnapshot: boolean,
- ) => unknown,
- ): void;
-}
diff --git i/packages/jest-core/build/TestNamePatternPrompt.d.ts w/packages/jest-core/build/TestNamePatternPrompt.d.ts
deleted file mode 100644
index 5dd0aeb3fa..0000000000
--- i/packages/jest-core/build/TestNamePatternPrompt.d.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {TestResult} from '@jest/test-result';
-import {PatternPrompt, Prompt, ScrollOptions} from 'jest-watcher';
-export default class TestNamePatternPrompt extends PatternPrompt {
- _cachedTestResults: Array<TestResult>;
- constructor(pipe: NodeJS.WritableStream, prompt: Prompt);
- _onChange(pattern: string, options: ScrollOptions): void;
- _printPrompt(pattern: string): void;
- _getMatchedTests(pattern: string): Array<string>;
- updateCachedTestResults(testResults?: Array<TestResult>): void;
-}
diff --git i/packages/jest-core/build/TestPathPatternPrompt.d.ts w/packages/jest-core/build/TestPathPatternPrompt.d.ts
deleted file mode 100644
index f7ccf04879..0000000000
--- i/packages/jest-core/build/TestPathPatternPrompt.d.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {Test} from '@jest/test-result';
-import type {Context} from 'jest-runtime';
-import {PatternPrompt, Prompt, ScrollOptions} from 'jest-watcher';
-import type SearchSource from './SearchSource';
-declare type SearchSources = Array<{
- context: Context;
- searchSource: SearchSource;
-}>;
-export default class TestPathPatternPrompt extends PatternPrompt {
- _searchSources?: SearchSources;
- constructor(pipe: NodeJS.WritableStream, prompt: Prompt);
- _onChange(pattern: string, options: ScrollOptions): void;
- _printPrompt(pattern: string): void;
- _getMatchedTests(pattern: string): Array<Test>;
- updateSearchSources(searchSources: SearchSources): void;
-}
-export {};
diff --git i/packages/jest-core/build/TestScheduler.d.ts w/packages/jest-core/build/TestScheduler.d.ts
deleted file mode 100644
index c8f4f183fa..0000000000
--- i/packages/jest-core/build/TestScheduler.d.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import {Reporter} from '@jest/reporters';
-import {AggregatedResult, Test} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import type TestWatcher from './TestWatcher';
-export declare type TestSchedulerOptions = {
- startRun: (globalConfig: Config.GlobalConfig) => void;
-};
-export declare type TestSchedulerContext = {
- firstRun: boolean;
- previousSuccess: boolean;
- changedFiles?: Set<Config.Path>;
- sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>;
-};
-export declare function createTestScheduler(
- globalConfig: Config.GlobalConfig,
- options: TestSchedulerOptions,
- context: TestSchedulerContext,
-): Promise<TestScheduler>;
-declare class TestScheduler {
- private readonly _dispatcher;
- private readonly _globalConfig;
- private readonly _options;
- private readonly _context;
- constructor(
- globalConfig: Config.GlobalConfig,
- options: TestSchedulerOptions,
- context: TestSchedulerContext,
- );
- addReporter(reporter: Reporter): void;
- removeReporter(ReporterClass: Function): void;
- scheduleTests(
- tests: Array<Test>,
- watcher: TestWatcher,
- ): Promise<AggregatedResult>;
- private _partitionTests;
- private _shouldAddDefaultReporters;
- _setupReporters(): Promise<void>;
- private _setupDefaultReporters;
- private _addCustomReporters;
- /**
- * Get properties of a reporter in an object
- * to make dealing with them less painful.
- */
- private _getReporterProps;
- private _bailIfNeeded;
-}
-export {};
diff --git i/packages/jest-core/build/TestWatcher.d.ts w/packages/jest-core/build/TestWatcher.d.ts
deleted file mode 100644
index 0d99e77944..0000000000
--- i/packages/jest-core/build/TestWatcher.d.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import emittery = require('emittery');
-declare type State = {
- interrupted: boolean;
-};
-export default class TestWatcher extends emittery<{
- change: State;
-}> {
- state: State;
- private _isWatchMode;
- constructor({isWatchMode}: {isWatchMode: boolean});
- setState(state: State): Promise<void>;
- isInterrupted(): boolean;
- isWatchMode(): boolean;
-}
-export {};
diff --git i/packages/jest-core/build/cli/index.d.ts w/packages/jest-core/build/cli/index.d.ts
deleted file mode 100644
index 06547f2673..0000000000
--- i/packages/jest-core/build/cli/index.d.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {AggregatedResult} from '@jest/test-result';
-import type {Config} from '@jest/types';
-export declare function runCLI(
- argv: Config.Argv,
- projects: Array<Config.Path>,
-): Promise<{
- results: AggregatedResult;
- globalConfig: Config.GlobalConfig;
-}>;
diff --git i/packages/jest-core/build/collectHandles.d.ts w/packages/jest-core/build/collectHandles.d.ts
deleted file mode 100644
index 83a8b24e61..0000000000
--- i/packages/jest-core/build/collectHandles.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export declare type HandleCollectionResult = () => Promise<Array<Error>>;
-export default function collectHandles(): HandleCollectionResult;
-export declare function formatHandleErrors(
- errors: Array<Error>,
- config: Config.ProjectConfig,
-): Array<string>;
diff --git i/packages/jest-core/build/getChangedFilesPromise.d.ts w/packages/jest-core/build/getChangedFilesPromise.d.ts
deleted file mode 100644
index 554b3ba58d..0000000000
--- i/packages/jest-core/build/getChangedFilesPromise.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import {ChangedFilesPromise} from 'jest-changed-files';
-export default function getChangedFilesPromise(
- globalConfig: Config.GlobalConfig,
- configs: Array<Config.ProjectConfig>,
-): ChangedFilesPromise | undefined;
diff --git i/packages/jest-core/build/getConfigsOfProjectsToRun.d.ts w/packages/jest-core/build/getConfigsOfProjectsToRun.d.ts
deleted file mode 100644
index 0feec5221f..0000000000
--- i/packages/jest-core/build/getConfigsOfProjectsToRun.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function getConfigsOfProjectsToRun(
- namesOfProjectsToRun: Array<string>,
- projectConfigs: Array<Config.ProjectConfig>,
-): Array<Config.ProjectConfig>;
diff --git i/packages/jest-core/build/getNoTestFound.d.ts w/packages/jest-core/build/getNoTestFound.d.ts
deleted file mode 100644
index f881d481af..0000000000
--- i/packages/jest-core/build/getNoTestFound.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import type {TestRunData} from './types';
-export default function getNoTestFound(
- testRunData: TestRunData,
- globalConfig: Config.GlobalConfig,
-): string;
diff --git i/packages/jest-core/build/getNoTestFoundFailed.d.ts w/packages/jest-core/build/getNoTestFoundFailed.d.ts
deleted file mode 100644
index fcc9adc53e..0000000000
--- i/packages/jest-core/build/getNoTestFoundFailed.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function getNoTestFoundFailed(
- globalConfig: Config.GlobalConfig,
-): string;
diff --git i/packages/jest-core/build/getNoTestFoundPassWithNoTests.d.ts w/packages/jest-core/build/getNoTestFoundPassWithNoTests.d.ts
deleted file mode 100644
index a594ba41cd..0000000000
--- i/packages/jest-core/build/getNoTestFoundPassWithNoTests.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function getNoTestFoundPassWithNoTests(): string;
diff --git i/packages/jest-core/build/getNoTestFoundRelatedToChangedFiles.d.ts w/packages/jest-core/build/getNoTestFoundRelatedToChangedFiles.d.ts
deleted file mode 100644
index f2636332a6..0000000000
--- i/packages/jest-core/build/getNoTestFoundRelatedToChangedFiles.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function getNoTestFoundRelatedToChangedFiles(
- globalConfig: Config.GlobalConfig,
-): string;
diff --git i/packages/jest-core/build/getNoTestFoundVerbose.d.ts w/packages/jest-core/build/getNoTestFoundVerbose.d.ts
deleted file mode 100644
index 49c6d594f1..0000000000
--- i/packages/jest-core/build/getNoTestFoundVerbose.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import type {TestRunData} from './types';
-export default function getNoTestFoundVerbose(
- testRunData: TestRunData,
- globalConfig: Config.GlobalConfig,
-): string;
diff --git i/packages/jest-core/build/getNoTestsFoundMessage.d.ts w/packages/jest-core/build/getNoTestsFoundMessage.d.ts
deleted file mode 100644
index 47d78a4acd..0000000000
--- i/packages/jest-core/build/getNoTestsFoundMessage.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import type {TestRunData} from './types';
-export default function getNoTestsFoundMessage(
- testRunData: TestRunData,
- globalConfig: Config.GlobalConfig,
-): string;
diff --git i/packages/jest-core/build/getProjectDisplayName.d.ts w/packages/jest-core/build/getProjectDisplayName.d.ts
deleted file mode 100644
index d93095bb80..0000000000
--- i/packages/jest-core/build/getProjectDisplayName.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function getProjectDisplayName(
- projectConfig: Config.ProjectConfig,
-): string | undefined;
diff --git i/packages/jest-core/build/getProjectNamesMissingWarning.d.ts w/packages/jest-core/build/getProjectNamesMissingWarning.d.ts
deleted file mode 100644
index f08d812067..0000000000
--- i/packages/jest-core/build/getProjectNamesMissingWarning.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function getProjectNamesMissingWarning(
- projectConfigs: Array<Config.ProjectConfig>,
-): string | undefined;
diff --git i/packages/jest-core/build/getSelectProjectsMessage.d.ts w/packages/jest-core/build/getSelectProjectsMessage.d.ts
deleted file mode 100644
index 23ba98a21f..0000000000
--- i/packages/jest-core/build/getSelectProjectsMessage.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function getSelectProjectsMessage(
- projectConfigs: Array<Config.ProjectConfig>,
-): string;
diff --git i/packages/jest-core/build/index.d.ts w/packages/jest-core/build/index.d.ts
index 29fe0adf78..0a82b6beea 100644
--- i/packages/jest-core/build/index.d.ts
+++ w/packages/jest-core/build/index.d.ts
@@ -4,8 +4,143 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-export {default as SearchSource} from './SearchSource';
-export {createTestScheduler} from './TestScheduler';
-export {default as TestWatcher} from './TestWatcher';
-export {runCLI} from './cli';
-export {default as getVersion} from './version';
+import {AggregatedResult} from '@jest/test-result';
+import type {ChangedFiles} from 'jest-changed-files';
+import type {Config} from '@jest/types';
+import type {Context} from 'jest-runtime';
+import emittery = require('emittery');
+import {Reporter} from '@jest/reporters';
+import {Test} from '@jest/test-result';
+
+export declare function createTestScheduler(
+ globalConfig: Config.GlobalConfig,
+ options: TestSchedulerOptions,
+ context: TestSchedulerContext,
+): Promise<TestScheduler>;
+
+declare type Filter = (testPaths: Array<string>) => Promise<{
+ filtered: Array<FilterResult>;
+}>;
+
+declare type FilterResult = {
+ test: string;
+ message: string;
+};
+
+export declare function getVersion(): string;
+
+export declare function runCLI(
+ argv: Config.Argv,
+ projects: Array<Config.Path>,
+): Promise<{
+ results: AggregatedResult;
+ globalConfig: Config.GlobalConfig;
+}>;
+
+declare type SearchResult = {
+ noSCM?: boolean;
+ stats?: Stats;
+ collectCoverageFrom?: Set<string>;
+ tests: Array<Test>;
+ total?: number;
+};
+
+export declare class SearchSource {
+ private _context;
+ private _dependencyResolver;
+ private _testPathCases;
+ constructor(context: Context);
+ private _getOrBuildDependencyResolver;
+ private _filterTestPathsWithStats;
+ private _getAllTestPaths;
+ isTestFilePath(path: Config.Path): boolean;
+ findMatchingTests(testPathPattern?: string): SearchResult;
+ findRelatedTests(
+ allPaths: Set<Config.Path>,
+ collectCoverage: boolean,
+ ): Promise<SearchResult>;
+ findTestsByPaths(paths: Array<Config.Path>): SearchResult;
+ findRelatedTestsFromPattern(
+ paths: Array<Config.Path>,
+ collectCoverage: boolean,
+ ): Promise<SearchResult>;
+ findTestRelatedToChangedFiles(
+ changedFilesInfo: ChangedFiles,
+ collectCoverage: boolean,
+ ): Promise<SearchResult>;
+ private _getTestPaths;
+ filterPathsWin32(paths: Array<string>): Array<string>;
+ getTestPaths(
+ globalConfig: Config.GlobalConfig,
+ changedFiles: ChangedFiles | undefined,
+ filter?: Filter,
+ ): Promise<SearchResult>;
+ findRelatedSourcesFromTestsInChangedFiles(
+ changedFilesInfo: ChangedFiles,
+ ): Promise<Array<string>>;
+}
+
+declare type State = {
+ interrupted: boolean;
+};
+
+declare type Stats = {
+ roots: number;
+ testMatch: number;
+ testPathIgnorePatterns: number;
+ testRegex: number;
+ testPathPattern?: number;
+};
+
+declare class TestScheduler {
+ private readonly _dispatcher;
+ private readonly _globalConfig;
+ private readonly _options;
+ private readonly _context;
+ constructor(
+ globalConfig: Config.GlobalConfig,
+ options: TestSchedulerOptions,
+ context: TestSchedulerContext,
+ );
+ addReporter(reporter: Reporter): void;
+ removeReporter(ReporterClass: Function): void;
+ scheduleTests(
+ tests: Array<Test>,
+ watcher: TestWatcher,
+ ): Promise<AggregatedResult>;
+ private _partitionTests;
+ private _shouldAddDefaultReporters;
+ _setupReporters(): Promise<void>;
+ private _setupDefaultReporters;
+ private _addCustomReporters;
+ /**
+ * Get properties of a reporter in an object
+ * to make dealing with them less painful.
+ */
+ private _getReporterProps;
+ private _bailIfNeeded;
+}
+
+declare type TestSchedulerContext = {
+ firstRun: boolean;
+ previousSuccess: boolean;
+ changedFiles?: Set<Config.Path>;
+ sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>;
+};
+
+declare type TestSchedulerOptions = {
+ startRun: (globalConfig: Config.GlobalConfig) => void;
+};
+
+export declare class TestWatcher extends emittery<{
+ change: State;
+}> {
+ state: State;
+ private _isWatchMode;
+ constructor({isWatchMode}: {isWatchMode: boolean});
+ setState(state: State): Promise<void>;
+ isInterrupted(): boolean;
+ isWatchMode(): boolean;
+}
+
+export {};
diff --git i/packages/jest-core/build/lib/activeFiltersMessage.d.ts w/packages/jest-core/build/lib/activeFiltersMessage.d.ts
deleted file mode 100644
index 66b5e58604..0000000000
--- i/packages/jest-core/build/lib/activeFiltersMessage.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-declare const activeFilters: (
- globalConfig: Config.GlobalConfig,
- delimiter?: string,
-) => string;
-export default activeFilters;
diff --git i/packages/jest-core/build/lib/createContext.d.ts w/packages/jest-core/build/lib/createContext.d.ts
deleted file mode 100644
index e50d487dca..0000000000
--- i/packages/jest-core/build/lib/createContext.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import type {HasteMapObject} from 'jest-haste-map';
-import {Context} from 'jest-runtime';
-export default function createContext(
- config: Config.ProjectConfig,
- {hasteFS, moduleMap}: HasteMapObject,
-): Context;
diff --git i/packages/jest-core/build/lib/handleDeprecationWarnings.d.ts w/packages/jest-core/build/lib/handleDeprecationWarnings.d.ts
deleted file mode 100644
index 9d414f7fcc..0000000000
--- i/packages/jest-core/build/lib/handleDeprecationWarnings.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-export default function handleDeprecationWarnings(
- pipe: NodeJS.WriteStream,
- stdin?: NodeJS.ReadStream,
-): Promise<void>;
diff --git i/packages/jest-core/build/lib/isValidPath.d.ts w/packages/jest-core/build/lib/isValidPath.d.ts
deleted file mode 100644
index dd0568ecc8..0000000000
--- i/packages/jest-core/build/lib/isValidPath.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function isValidPath(
- globalConfig: Config.GlobalConfig,
- filePath: Config.Path,
-): boolean;
diff --git i/packages/jest-core/build/lib/logDebugMessages.d.ts w/packages/jest-core/build/lib/logDebugMessages.d.ts
deleted file mode 100644
index 09a19f7b7c..0000000000
--- i/packages/jest-core/build/lib/logDebugMessages.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {Config} from '@jest/types';
-export default function logDebugMessages(
- globalConfig: Config.GlobalConfig,
- configs: Array<Config.ProjectConfig> | Config.ProjectConfig,
- outputStream: NodeJS.WriteStream,
-): void;
diff --git i/packages/jest-core/build/lib/updateGlobalConfig.d.ts w/packages/jest-core/build/lib/updateGlobalConfig.d.ts
deleted file mode 100644
index f73628ac99..0000000000
--- i/packages/jest-core/build/lib/updateGlobalConfig.d.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import type {AllowedConfigOptions} from 'jest-watcher';
-declare type ExtraConfigOptions = Partial<
- Pick<Config.GlobalConfig, 'noSCM' | 'passWithNoTests'>
->;
-export default function updateGlobalConfig(
- globalConfig: Config.GlobalConfig,
- options?: AllowedConfigOptions & ExtraConfigOptions,
-): Config.GlobalConfig;
-export {};
diff --git i/packages/jest-core/build/lib/watchPluginsHelpers.d.ts w/packages/jest-core/build/lib/watchPluginsHelpers.d.ts
deleted file mode 100644
index e994e7b175..0000000000
--- i/packages/jest-core/build/lib/watchPluginsHelpers.d.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import type {UsageData, WatchPlugin} from 'jest-watcher';
-export declare const filterInteractivePlugins: (
- watchPlugins: Array<WatchPlugin>,
- globalConfig: Config.GlobalConfig,
-) => Array<WatchPlugin>;
-export declare const getSortedUsageRows: (
- watchPlugins: Array<WatchPlugin>,
- globalConfig: Config.GlobalConfig,
-) => Array<UsageData>;
diff --git i/packages/jest-core/build/plugins/FailedTestsInteractive.d.ts w/packages/jest-core/build/plugins/FailedTestsInteractive.d.ts
deleted file mode 100644
index 6e643b12fa..0000000000
--- i/packages/jest-core/build/plugins/FailedTestsInteractive.d.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import {
- BaseWatchPlugin,
- JestHookSubscriber,
- UpdateConfigCallback,
- UsageData,
-} from 'jest-watcher';
-export default class FailedTestsInteractivePlugin extends BaseWatchPlugin {
- private _failedTestAssertions?;
- private readonly _manager;
- apply(hooks: JestHookSubscriber): void;
- getUsageInfo(): UsageData | null;
- onKey(key: string): void;
- run(
- _: Config.GlobalConfig,
- updateConfigAndRun: UpdateConfigCallback,
- ): Promise<void>;
- private getFailedTestAssertions;
-}
diff --git i/packages/jest-core/build/plugins/Quit.d.ts w/packages/jest-core/build/plugins/Quit.d.ts
deleted file mode 100644
index 8b4ce4eb19..0000000000
--- i/packages/jest-core/build/plugins/Quit.d.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import {BaseWatchPlugin, UsageData} from 'jest-watcher';
-declare class QuitPlugin extends BaseWatchPlugin {
- isInternal: true;
- constructor(options: {stdin: NodeJS.ReadStream; stdout: NodeJS.WriteStream});
- run(): Promise<void>;
- getUsageInfo(): UsageData;
-}
-export default QuitPlugin;
diff --git i/packages/jest-core/build/plugins/TestNamePattern.d.ts w/packages/jest-core/build/plugins/TestNamePattern.d.ts
deleted file mode 100644
index 891ec76fb0..0000000000
--- i/packages/jest-core/build/plugins/TestNamePattern.d.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {Config} from '@jest/types';
-import {
- BaseWatchPlugin,
- Prompt,
- UpdateConfigCallback,
- UsageData,
-} from 'jest-watcher';
-declare class TestNamePatternPlugin extends BaseWatchPlugin {
- _prompt: Prompt;
- isInternal: true;
- constructor(options: {stdin: NodeJS.ReadStream; stdout: NodeJS.WriteStream});
- getUsageInfo(): UsageData;
- onKey(key: string): void;
- run(
- globalConfig: Config.GlobalConfig,
- updateConfigAndRun: UpdateConfigCallback,
- ): Promise<void>;
-}
-export default TestNamePatternPlugin;
diff --git i/packages/jest-core/build/plugins/TestPathPattern.d.ts w/packages/jest-core/build/plugins/TestPathPattern.d.ts
deleted file mode 100644
index 58d02875f6..0000000000
--- i/packages/jest-core/build/plugins/TestPathPattern.d.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {Config} from '@jest/types';
-import {BaseWatchPlugin, UpdateConfigCallback, UsageData} from 'jest-watcher';
-declare class TestPathPatternPlugin extends BaseWatchPlugin {
- private _prompt;
- isInternal: true;
- constructor(options: {stdin: NodeJS.ReadStream; stdout: NodeJS.WriteStream});
- getUsageInfo(): UsageData;
- onKey(key: string): void;
- run(
- globalConfig: Config.GlobalConfig,
- updateConfigAndRun: UpdateConfigCallback,
- ): Promise<void>;
-}
-export default TestPathPatternPlugin;
diff --git i/packages/jest-core/build/plugins/UpdateSnapshots.d.ts w/packages/jest-core/build/plugins/UpdateSnapshots.d.ts
deleted file mode 100644
index 6736d5a8dd..0000000000
--- i/packages/jest-core/build/plugins/UpdateSnapshots.d.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {Config} from '@jest/types';
-import {
- BaseWatchPlugin,
- JestHookSubscriber,
- UpdateConfigCallback,
- UsageData,
-} from 'jest-watcher';
-declare class UpdateSnapshotsPlugin extends BaseWatchPlugin {
- private _hasSnapshotFailure;
- isInternal: true;
- constructor(options: {stdin: NodeJS.ReadStream; stdout: NodeJS.WriteStream});
- run(
- _globalConfig: Config.GlobalConfig,
- updateConfigAndRun: UpdateConfigCallback,
- ): Promise<boolean>;
- apply(hooks: JestHookSubscriber): void;
- getUsageInfo(): UsageData | null;
-}
-export default UpdateSnapshotsPlugin;
diff --git i/packages/jest-core/build/plugins/UpdateSnapshotsInteractive.d.ts w/packages/jest-core/build/plugins/UpdateSnapshotsInteractive.d.ts
deleted file mode 100644
index 8c0cd3e37a..0000000000
--- i/packages/jest-core/build/plugins/UpdateSnapshotsInteractive.d.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {AggregatedResult, AssertionLocation} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import {BaseWatchPlugin, JestHookSubscriber, UsageData} from 'jest-watcher';
-declare class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin {
- private _snapshotInteractiveMode;
- private _failedSnapshotTestAssertions;
- isInternal: true;
- getFailedSnapshotTestAssertions(
- testResults: AggregatedResult,
- ): Array<AssertionLocation>;
- apply(hooks: JestHookSubscriber): void;
- onKey(key: string): void;
- run(
- _globalConfig: Config.GlobalConfig,
- updateConfigAndRun: Function,
- ): Promise<void>;
- getUsageInfo(): UsageData | null;
-}
-export default UpdateSnapshotInteractivePlugin;
diff --git i/packages/jest-core/build/pluralize.d.ts w/packages/jest-core/build/pluralize.d.ts
deleted file mode 100644
index f32423d8c8..0000000000
--- i/packages/jest-core/build/pluralize.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function pluralize(
- word: string,
- count: number,
- ending: string,
-): string;
diff --git i/packages/jest-core/build/runGlobalHook.d.ts w/packages/jest-core/build/runGlobalHook.d.ts
deleted file mode 100644
index cd6c29f944..0000000000
--- i/packages/jest-core/build/runGlobalHook.d.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Test} from '@jest/test-result';
-import type {Config} from '@jest/types';
-export default function runGlobalHook({
- allTests,
- globalConfig,
- moduleName,
-}: {
- allTests: Array<Test>;
- globalConfig: Config.GlobalConfig;
- moduleName: 'globalSetup' | 'globalTeardown';
-}): Promise<void>;
diff --git i/packages/jest-core/build/runJest.d.ts w/packages/jest-core/build/runJest.d.ts
deleted file mode 100644
index d79838cadd..0000000000
--- i/packages/jest-core/build/runJest.d.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import {AggregatedResult} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import type {ChangedFilesPromise} from 'jest-changed-files';
-import type {Context} from 'jest-runtime';
-import {JestHookEmitter} from 'jest-watcher';
-import type FailedTestsCache from './FailedTestsCache';
-import type TestWatcher from './TestWatcher';
-import type {Filter} from './types';
-export default function runJest({
- contexts,
- globalConfig,
- outputStream,
- testWatcher,
- jestHooks,
- startRun,
- changedFilesPromise,
- onComplete,
- failedTestsCache,
- filter,
-}: {
- globalConfig: Config.GlobalConfig;
- contexts: Array<Context>;
- outputStream: NodeJS.WriteStream;
- testWatcher: TestWatcher;
- jestHooks?: JestHookEmitter;
- startRun: (globalConfig: Config.GlobalConfig) => void;
- changedFilesPromise?: ChangedFilesPromise;
- onComplete: (testResults: AggregatedResult) => void;
- failedTestsCache?: FailedTestsCache;
- filter?: Filter;
-}): Promise<void>;
diff --git i/packages/jest-core/build/testSchedulerHelper.d.ts w/packages/jest-core/build/testSchedulerHelper.d.ts
deleted file mode 100644
index 71e14af33f..0000000000
--- i/packages/jest-core/build/testSchedulerHelper.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Test} from '@jest/test-result';
-import type {Config} from '@jest/types';
-export declare function shouldRunInBand(
- tests: Array<Test>,
- timings: Array<number>,
- {detectOpenHandles, maxWorkers, watch, watchAll}: Config.GlobalConfig,
-): boolean;
diff --git i/packages/jest-core/build/types.d.ts w/packages/jest-core/build/types.d.ts
deleted file mode 100644
index 928b803059..0000000000
--- i/packages/jest-core/build/types.d.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Test} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import type {Context} from 'jest-runtime';
-export declare type Stats = {
- roots: number;
- testMatch: number;
- testPathIgnorePatterns: number;
- testRegex: number;
- testPathPattern?: number;
-};
-export declare type TestRunData = Array<{
- context: Context;
- matches: {
- allTests: number;
- tests: Array<Test>;
- total?: number;
- stats?: Stats;
- };
-}>;
-export declare type TestPathCases = Array<{
- stat: keyof Stats;
- isMatch: (path: Config.Path) => boolean;
-}>;
-export declare type TestPathCasesWithPathPattern = TestPathCases & {
- testPathPattern: (path: Config.Path) => boolean;
-};
-export declare type FilterResult = {
- test: string;
- message: string;
-};
-export declare type Filter = (testPaths: Array<string>) => Promise<{
- filtered: Array<FilterResult>;
-}>;
diff --git i/packages/jest-core/build/version.d.ts w/packages/jest-core/build/version.d.ts
deleted file mode 100644
index 86467315e1..0000000000
--- i/packages/jest-core/build/version.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function getVersion(): string;
diff --git i/packages/jest-core/build/watch.d.ts w/packages/jest-core/build/watch.d.ts
deleted file mode 100644
index d793fb2c7d..0000000000
--- i/packages/jest-core/build/watch.d.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {Config} from '@jest/types';
-import type {default as HasteMap} from 'jest-haste-map';
-import type {Context} from 'jest-runtime';
-import {JestHook} from 'jest-watcher';
-import type {Filter} from './types';
-export default function watch(
- initialGlobalConfig: Config.GlobalConfig,
- contexts: Array<Context>,
- outputStream: NodeJS.WriteStream,
- hasteMapInstances: Array<HasteMap>,
- stdin?: NodeJS.ReadStream,
- hooks?: JestHook,
- filter?: Filter,
-): Promise<void>;
diff --git i/packages/jest-create-cache-key-function/build/index.d.ts w/packages/jest-create-cache-key-function/build/index.d.ts
index c0db36451f..99ff6adb62 100644
--- i/packages/jest-create-cache-key-function/build/index.d.ts
+++ w/packages/jest-create-cache-key-function/build/index.d.ts
@@ -3,34 +3,41 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- *
*/
import type {Config} from '@jest/types';
-declare type OldCacheKeyOptions = {
+
+declare function createCacheKey(
+ files?: Array<string>,
+ values?: Array<string>,
+): GetCacheKeyFunction;
+export default createCacheKey;
+
+declare type GetCacheKeyFunction =
+ | OldGetCacheKeyFunction
+ | NewGetCacheKeyFunction;
+
+declare type NewCacheKeyOptions = {
config: Config.ProjectConfig;
+ configString: string;
instrument: boolean;
};
-declare type NewCacheKeyOptions = {
+
+declare type NewGetCacheKeyFunction = (
+ sourceText: string,
+ sourcePath: Config.Path,
+ options: NewCacheKeyOptions,
+) => string;
+
+declare type OldCacheKeyOptions = {
config: Config.ProjectConfig;
- configString: string;
instrument: boolean;
};
+
declare type OldGetCacheKeyFunction = (
fileData: string,
filePath: Config.Path,
configStr: string,
options: OldCacheKeyOptions,
) => string;
-declare type NewGetCacheKeyFunction = (
- sourceText: string,
- sourcePath: Config.Path,
- options: NewCacheKeyOptions,
-) => string;
-declare type GetCacheKeyFunction =
- | OldGetCacheKeyFunction
- | NewGetCacheKeyFunction;
-export default function createCacheKey(
- files?: Array<string>,
- values?: Array<string>,
-): GetCacheKeyFunction;
+
export {};
diff --git i/packages/jest-diff/build/cleanupSemantic.d.ts w/packages/jest-diff/build/cleanupSemantic.d.ts
deleted file mode 100644
index 9ae740796a..0000000000
--- i/packages/jest-diff/build/cleanupSemantic.d.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Diff Match and Patch
- * Copyright 2018 The diff-match-patch Authors.
- * https://github.com/google/diff-match-patch
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @fileoverview Computes the difference between two texts to create a patch.
- * Applies the patch onto another text, allowing for errors.
- * @author fraser@google.com (Neil Fraser)
- */
-/**
- * CHANGES by pedrottimark to diff_match_patch_uncompressed.ts file:
- *
- * 1. Delete anything not needed to use diff_cleanupSemantic method
- * 2. Convert from prototype properties to var declarations
- * 3. Convert Diff to class from constructor and prototype
- * 4. Add type annotations for arguments and return values
- * 5. Add exports
- */
-/**
- * The data structure representing a diff is an array of tuples:
- * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
- * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
- */
-declare var DIFF_DELETE: number;
-declare var DIFF_INSERT: number;
-declare var DIFF_EQUAL: number;
-/**
- * Class representing one diff tuple.
- * Attempts to look like a two-element array (which is what this used to be).
- * @param {number} op Operation, one of: DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL.
- * @param {string} text Text to be deleted, inserted, or retained.
- * @constructor
- */
-declare class Diff {
- 0: number;
- 1: string;
- constructor(op: number, text: string);
-}
-/**
- * Reduce the number of edits by eliminating semantically trivial equalities.
- * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
- */
-declare var diff_cleanupSemantic: (diffs: Array<Diff>) => void;
-export {
- Diff,
- DIFF_EQUAL,
- DIFF_DELETE,
- DIFF_INSERT,
- diff_cleanupSemantic as cleanupSemantic,
-};
diff --git i/packages/jest-diff/build/constants.d.ts w/packages/jest-diff/build/constants.d.ts
deleted file mode 100644
index 3156048156..0000000000
--- i/packages/jest-diff/build/constants.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare const NO_DIFF_MESSAGE =
- 'Compared values have no visual difference.';
-export declare const SIMILAR_MESSAGE: string;
diff --git i/packages/jest-diff/build/diffLines.d.ts w/packages/jest-diff/build/diffLines.d.ts
deleted file mode 100644
index 0650eb3329..0000000000
--- i/packages/jest-diff/build/diffLines.d.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import {Diff} from './cleanupSemantic';
-import type {DiffOptions, DiffOptionsNormalized} from './types';
-export declare const printDiffLines: (
- diffs: Array<Diff>,
- options: DiffOptionsNormalized,
-) => string;
-export declare const diffLinesUnified: (
- aLines: Array<string>,
- bLines: Array<string>,
- options?: DiffOptions | undefined,
-) => string;
-export declare const diffLinesUnified2: (
- aLinesDisplay: Array<string>,
- bLinesDisplay: Array<string>,
- aLinesCompare: Array<string>,
- bLinesCompare: Array<string>,
- options?: DiffOptions | undefined,
-) => string;
-export declare const diffLinesRaw: (
- aLines: Array<string>,
- bLines: Array<string>,
-) => Array<Diff>;
diff --git i/packages/jest-diff/build/diffStrings.d.ts w/packages/jest-diff/build/diffStrings.d.ts
deleted file mode 100644
index 7939a91b7d..0000000000
--- i/packages/jest-diff/build/diffStrings.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import {Diff} from './cleanupSemantic';
-declare const diffStrings: (a: string, b: string) => Array<Diff>;
-export default diffStrings;
diff --git i/packages/jest-diff/build/getAlignedDiffs.d.ts w/packages/jest-diff/build/getAlignedDiffs.d.ts
deleted file mode 100644
index 13766f98b3..0000000000
--- i/packages/jest-diff/build/getAlignedDiffs.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import {Diff} from './cleanupSemantic';
-import type {DiffOptionsColor} from './types';
-declare const getAlignedDiffs: (
- diffs: Array<Diff>,
- changeColor: DiffOptionsColor,
-) => Array<Diff>;
-export default getAlignedDiffs;
diff --git i/packages/jest-diff/build/index.d.ts w/packages/jest-diff/build/index.d.ts
index c8022ec10e..2b2625c664 100644
--- i/packages/jest-diff/build/index.d.ts
+++ w/packages/jest-diff/build/index.d.ts
@@ -4,16 +4,90 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-import {DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff} from './cleanupSemantic';
-import {diffLinesRaw, diffLinesUnified, diffLinesUnified2} from './diffLines';
-import {diffStringsRaw, diffStringsUnified} from './printDiffs';
-import type {DiffOptions} from './types';
-export type {DiffOptions, DiffOptionsColor} from './types';
-export {diffLinesRaw, diffLinesUnified, diffLinesUnified2};
-export {diffStringsRaw, diffStringsUnified};
-export {DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff};
+import type {CompareKeys} from 'pretty-format';
+
+/**
+ * Class representing one diff tuple.
+ * Attempts to look like a two-element array (which is what this used to be).
+ * @param {number} op Operation, one of: DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL.
+ * @param {string} text Text to be deleted, inserted, or retained.
+ * @constructor
+ */
+export declare class Diff {
+ 0: number;
+ 1: string;
+ constructor(op: number, text: string);
+}
+
export declare function diff(
a: any,
b: any,
options?: DiffOptions,
): string | null;
+
+/**
+ * The data structure representing a diff is an array of tuples:
+ * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
+ * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
+ */
+export declare var DIFF_DELETE: number;
+
+export declare var DIFF_EQUAL: number;
+
+export declare var DIFF_INSERT: number;
+
+export declare const diffLinesRaw: (
+ aLines: Array<string>,
+ bLines: Array<string>,
+) => Array<Diff>;
+
+export declare const diffLinesUnified: (
+ aLines: Array<string>,
+ bLines: Array<string>,
+ options?: DiffOptions | undefined,
+) => string;
+
+export declare const diffLinesUnified2: (
+ aLinesDisplay: Array<string>,
+ bLinesDisplay: Array<string>,
+ aLinesCompare: Array<string>,
+ bLinesCompare: Array<string>,
+ options?: DiffOptions | undefined,
+) => string;
+
+export declare type DiffOptions = {
+ aAnnotation?: string;
+ aColor?: DiffOptionsColor;
+ aIndicator?: string;
+ bAnnotation?: string;
+ bColor?: DiffOptionsColor;
+ bIndicator?: string;
+ changeColor?: DiffOptionsColor;
+ changeLineTrailingSpaceColor?: DiffOptionsColor;
+ commonColor?: DiffOptionsColor;
+ commonIndicator?: string;
+ commonLineTrailingSpaceColor?: DiffOptionsColor;
+ contextLines?: number;
+ emptyFirstOrLastLinePlaceholder?: string;
+ expand?: boolean;
+ includeChangeCounts?: boolean;
+ omitAnnotationLines?: boolean;
+ patchColor?: DiffOptionsColor;
+ compareKeys?: CompareKeys;
+};
+
+export declare type DiffOptionsColor = (arg: string) => string;
+
+export declare const diffStringsRaw: (
+ a: string,
+ b: string,
+ cleanup: boolean,
+) => Array<Diff>;
+
+export declare const diffStringsUnified: (
+ a: string,
+ b: string,
+ options?: DiffOptions | undefined,
+) => string;
+
+export {};
diff --git i/packages/jest-diff/build/joinAlignedDiffs.d.ts w/packages/jest-diff/build/joinAlignedDiffs.d.ts
deleted file mode 100644
index 2f46a926c4..0000000000
--- i/packages/jest-diff/build/joinAlignedDiffs.d.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import {Diff} from './cleanupSemantic';
-import type {DiffOptionsNormalized} from './types';
-export declare const joinAlignedDiffsNoExpand: (
- diffs: Array<Diff>,
- options: DiffOptionsNormalized,
-) => string;
-export declare const joinAlignedDiffsExpand: (
- diffs: Array<Diff>,
- options: DiffOptionsNormalized,
-) => string;
diff --git i/packages/jest-diff/build/normalizeDiffOptions.d.ts w/packages/jest-diff/build/normalizeDiffOptions.d.ts
deleted file mode 100644
index f1b41272f9..0000000000
--- i/packages/jest-diff/build/normalizeDiffOptions.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {DiffOptions, DiffOptionsNormalized} from './types';
-export declare const noColor: (string: string) => string;
-export declare const normalizeDiffOptions: (
- options?: DiffOptions,
-) => DiffOptionsNormalized;
diff --git i/packages/jest-diff/build/printDiffs.d.ts w/packages/jest-diff/build/printDiffs.d.ts
deleted file mode 100644
index 7bf120c1e3..0000000000
--- i/packages/jest-diff/build/printDiffs.d.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import {Diff} from './cleanupSemantic';
-import type {DiffOptions} from './types';
-export declare const diffStringsUnified: (
- a: string,
- b: string,
- options?: DiffOptions | undefined,
-) => string;
-export declare const diffStringsRaw: (
- a: string,
- b: string,
- cleanup: boolean,
-) => Array<Diff>;
diff --git i/packages/jest-diff/build/types.d.ts w/packages/jest-diff/build/types.d.ts
deleted file mode 100644
index b81ce536c9..0000000000
--- i/packages/jest-diff/build/types.d.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {CompareKeys} from 'pretty-format';
-export declare type DiffOptionsColor = (arg: string) => string;
-export declare type DiffOptions = {
- aAnnotation?: string;
- aColor?: DiffOptionsColor;
- aIndicator?: string;
- bAnnotation?: string;
- bColor?: DiffOptionsColor;
- bIndicator?: string;
- changeColor?: DiffOptionsColor;
- changeLineTrailingSpaceColor?: DiffOptionsColor;
- commonColor?: DiffOptionsColor;
- commonIndicator?: string;
- commonLineTrailingSpaceColor?: DiffOptionsColor;
- contextLines?: number;
- emptyFirstOrLastLinePlaceholder?: string;
- expand?: boolean;
- includeChangeCounts?: boolean;
- omitAnnotationLines?: boolean;
- patchColor?: DiffOptionsColor;
- compareKeys?: CompareKeys;
-};
-export declare type DiffOptionsNormalized = {
- aAnnotation: string;
- aColor: DiffOptionsColor;
- aIndicator: string;
- bAnnotation: string;
- bColor: DiffOptionsColor;
- bIndicator: string;
- changeColor: DiffOptionsColor;
- changeLineTrailingSpaceColor: DiffOptionsColor;
- commonColor: DiffOptionsColor;
- commonIndicator: string;
- commonLineTrailingSpaceColor: DiffOptionsColor;
- compareKeys: CompareKeys;
- contextLines: number;
- emptyFirstOrLastLinePlaceholder: string;
- expand: boolean;
- includeChangeCounts: boolean;
- omitAnnotationLines: boolean;
- patchColor: DiffOptionsColor;
-};
diff --git i/packages/jest-docblock/build/index.d.ts w/packages/jest-docblock/build/index.d.ts
index 349cdfe528..3c25df59d7 100644
--- i/packages/jest-docblock/build/index.d.ts
+++ w/packages/jest-docblock/build/index.d.ts
@@ -4,19 +4,26 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-declare type Pragmas = Record<string, string | Array<string>>;
export declare function extract(contents: string): string;
-export declare function strip(contents: string): string;
+
export declare function parse(docblock: string): Pragmas;
+
export declare function parseWithComments(docblock: string): {
comments: string;
pragmas: Pragmas;
};
-export declare function print({
+
+declare type Pragmas = Record<string, string | Array<string>>;
+
+declare function print_2({
comments,
pragmas,
}: {
comments?: string;
pragmas?: Pragmas;
}): string;
+export {print_2 as print};
+
+export declare function strip(contents: string): string;
+
export {};
diff --git i/packages/jest-each/build/bind.d.ts w/packages/jest-each/build/bind.d.ts
deleted file mode 100644
index a535550e40..0000000000
--- i/packages/jest-each/build/bind.d.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {Global} from '@jest/types';
-export declare type EachTests = ReadonlyArray<{
- title: string;
- arguments: ReadonlyArray<unknown>;
-}>;
-declare type GlobalCallback = (
- testName: string,
- fn: Global.ConcurrentTestFn,
- timeout?: number,
-) => void;
-export default function bind<EachCallback extends Global.TestCallback>(
- cb: GlobalCallback,
- supportsDone?: boolean,
-): (
- table: Global.EachTable,
- ...taggedTemplateData: Global.TemplateData
-) => (
- title: string,
- test: Global.EachTestFn<EachCallback>,
- timeout?: number | undefined,
-) => void;
-export {};
diff --git i/packages/jest-each/build/index.d.ts w/packages/jest-each/build/index.d.ts
index e1630968aa..74c8fa0f11 100644
--- i/packages/jest-each/build/index.d.ts
+++ w/packages/jest-each/build/index.d.ts
@@ -3,127 +3,21 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- *
*/
import type {Global} from '@jest/types';
-import bind from './bind';
-declare type Global = Global.Global;
-declare const install: (
- g: Global,
+
+export declare function bind<EachCallback extends Global.TestCallback>(
+ cb: GlobalCallback,
+ supportsDone?: boolean,
+): (
table: Global.EachTable,
- ...data: Global.TemplateData
-) => {
- describe: {
- (
- title: string,
- suite: Global.EachTestFn<Global.BlockFn>,
- timeout?: number | undefined,
- ): void;
- skip: (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- only: (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- };
- fdescribe: (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- fit: (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- it: {
- (
- title: string,
- test: Global.EachTestFn<Global.TestFn>,
- timeout?: number | undefined,
- ): void;
- skip: (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- only: (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- concurrent: {
- (
- title: string,
- test: Global.EachTestFn<Global.TestFn>,
- timeout?: number | undefined,
- ): void;
- only: (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- skip: (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- };
- };
- test: {
- (
- title: string,
- test: Global.EachTestFn<Global.TestFn>,
- timeout?: number | undefined,
- ): void;
- skip: (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- only: (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- concurrent: {
- (
- title: string,
- test: Global.EachTestFn<Global.TestFn>,
- timeout?: number | undefined,
- ): void;
- only: (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- skip: (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- };
- };
- xdescribe: (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- xit: (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
- xtest: (
- title: string,
- test: Global.EachTestFn<Global.TestCallback>,
- timeout?: number | undefined,
- ) => void;
-};
+ ...taggedTemplateData: Global.TemplateData
+) => (
+ title: string,
+ test: Global.EachTestFn<EachCallback>,
+ timeout?: number | undefined,
+) => void;
+
declare const each: {
(table: Global.EachTable, ...data: Global.TemplateData): ReturnType<
typeof install
@@ -244,5 +138,129 @@ declare const each: {
) => void;
};
};
-export {bind};
export default each;
+
+declare type GlobalCallback = (
+ testName: string,
+ fn: Global.ConcurrentTestFn,
+ timeout?: number,
+) => void;
+
+declare const install: (
+ g: Global,
+ table: Global.EachTable,
+ ...data: Global.TemplateData
+) => {
+ describe: {
+ (
+ title: string,
+ suite: Global.EachTestFn<Global.BlockFn>,
+ timeout?: number | undefined,
+ ): void;
+ skip: (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ only: (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ };
+ fdescribe: (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ fit: (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ it: {
+ (
+ title: string,
+ test: Global.EachTestFn<Global.TestFn>,
+ timeout?: number | undefined,
+ ): void;
+ skip: (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ only: (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ concurrent: {
+ (
+ title: string,
+ test: Global.EachTestFn<Global.TestFn>,
+ timeout?: number | undefined,
+ ): void;
+ only: (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ skip: (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ };
+ };
+ test: {
+ (
+ title: string,
+ test: Global.EachTestFn<Global.TestFn>,
+ timeout?: number | undefined,
+ ): void;
+ skip: (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ only: (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ concurrent: {
+ (
+ title: string,
+ test: Global.EachTestFn<Global.TestFn>,
+ timeout?: number | undefined,
+ ): void;
+ only: (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ skip: (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ };
+ };
+ xdescribe: (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ xit: (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+ xtest: (
+ title: string,
+ test: Global.EachTestFn<Global.TestCallback>,
+ timeout?: number | undefined,
+ ) => void;
+};
+
+export {};
diff --git i/packages/jest-each/build/table/array.d.ts w/packages/jest-each/build/table/array.d.ts
deleted file mode 100644
index 18a3958aaa..0000000000
--- i/packages/jest-each/build/table/array.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {Global} from '@jest/types';
-import type {EachTests} from '../bind';
-export default function array(
- title: string,
- arrayTable: Global.ArrayTable,
-): EachTests;
diff --git i/packages/jest-each/build/table/interpolation.d.ts w/packages/jest-each/build/table/interpolation.d.ts
deleted file mode 100644
index e427739ce8..0000000000
--- i/packages/jest-each/build/table/interpolation.d.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-export declare type Template = Record<string, unknown>;
-export declare type Templates = Array<Template>;
-export declare type Headings = Array<string>;
-export declare const interpolateVariables: (
- title: string,
- template: Template,
- index: number,
-) => string;
-export declare function getPath<
- Obj extends Template,
- A extends keyof Obj,
- B extends keyof Obj[A],
- C extends keyof Obj[A][B],
- D extends keyof Obj[A][B][C],
- E extends keyof Obj[A][B][C][D],
->(obj: Obj, path: [A, B, C, D, E]): Obj[A][B][C][D][E];
-export declare function getPath<
- Obj extends Template,
- A extends keyof Obj,
- B extends keyof Obj[A],
- C extends keyof Obj[A][B],
- D extends keyof Obj[A][B][C],
->(obj: Obj, path: [A, B, C, D]): Obj[A][B][C][D];
-export declare function getPath<
- Obj extends Template,
- A extends keyof Obj,
- B extends keyof Obj[A],
- C extends keyof Obj[A][B],
->(obj: Obj, path: [A, B, C]): Obj[A][B][C];
-export declare function getPath<
- Obj extends Template,
- A extends keyof Obj,
- B extends keyof Obj[A],
->(obj: Obj, path: [A, B]): Obj[A][B];
-export declare function getPath<Obj extends Template, A extends keyof Obj>(
- obj: Obj,
- path: [A],
-): Obj[A];
-export declare function getPath<Obj extends Template>(
- obj: Obj,
- path: Array<string>,
-): unknown;
diff --git i/packages/jest-each/build/table/template.d.ts w/packages/jest-each/build/table/template.d.ts
deleted file mode 100644
index 791859c4f9..0000000000
--- i/packages/jest-each/build/table/template.d.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {Global} from '@jest/types';
-import type {EachTests} from '../bind';
-import type {Headings} from './interpolation';
-export default function template(
- title: string,
- headings: Headings,
- row: Global.Row,
-): EachTests;
diff --git i/packages/jest-each/build/validation.d.ts w/packages/jest-each/build/validation.d.ts
deleted file mode 100644
index 2ee5f645f7..0000000000
--- i/packages/jest-each/build/validation.d.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {Global} from '@jest/types';
-export declare const validateArrayTable: (table: unknown) => void;
-export declare const validateTemplateTableArguments: (
- headings: Array<string>,
- data: Global.TemplateData,
-) => void;
-export declare const extractValidTemplateHeadings: (headings: string) => string;
diff --git i/packages/jest-environment-jsdom/build/index.d.ts w/packages/jest-environment-jsdom/build/index.d.ts
index 4dd28be898..ea312e716f 100644
--- i/packages/jest-environment-jsdom/build/index.d.ts
+++ w/packages/jest-environment-jsdom/build/index.d.ts
@@ -5,18 +5,17 @@
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="node" />
+
+import type {Config} from '@jest/types';
import type {Context} from 'vm';
-import type {EnvironmentContext, JestEnvironment} from '@jest/environment';
-import {LegacyFakeTimers, ModernFakeTimers} from '@jest/fake-timers';
-import type {Config, Global} from '@jest/types';
+import type {EnvironmentContext} from '@jest/environment';
+import type {Global} from '@jest/types';
+import type {JestEnvironment} from '@jest/environment';
+import {LegacyFakeTimers} from '@jest/fake-timers';
+import {ModernFakeTimers} from '@jest/fake-timers';
import {ModuleMocker} from 'jest-mock';
-declare type Win = Window &
- Global.Global & {
- Error: {
- stackTraceLimit: number;
- };
- };
-export default class JSDOMEnvironment implements JestEnvironment<number> {
+
+declare class JSDOMEnvironment implements JestEnvironment<number> {
private dom;
fakeTimers: LegacyFakeTimers<number> | null;
fakeTimersModern: ModernFakeTimers | null;
@@ -29,5 +28,15 @@ export default class JSDOMEnvironment implements JestEnvironment<number> {
exportConditions(): Array<string>;
getVmContext(): Context | null;
}
+export default JSDOMEnvironment;
+
export declare const TestEnvironment: typeof JSDOMEnvironment;
+
+declare type Win = Window &
+ Global.Global & {
+ Error: {
+ stackTraceLimit: number;
+ };
+ };
+
export {};
diff --git i/packages/jest-environment-node/build/index.d.ts w/packages/jest-environment-node/build/index.d.ts
index 9687a21b3e..1822a61989 100644
--- i/packages/jest-environment-node/build/index.d.ts
+++ w/packages/jest-environment-node/build/index.d.ts
@@ -5,17 +5,16 @@
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="node" />
+
+import type {Config} from '@jest/types';
import {Context} from 'vm';
+import type {Global} from '@jest/types';
import type {JestEnvironment} from '@jest/environment';
-import {LegacyFakeTimers, ModernFakeTimers} from '@jest/fake-timers';
-import type {Config, Global} from '@jest/types';
+import {LegacyFakeTimers} from '@jest/fake-timers';
+import {ModernFakeTimers} from '@jest/fake-timers';
import {ModuleMocker} from 'jest-mock';
-declare type Timer = {
- id: number;
- ref: () => Timer;
- unref: () => Timer;
-};
-export default class NodeEnvironment implements JestEnvironment<Timer> {
+
+declare class NodeEnvironment implements JestEnvironment<Timer> {
context: Context | null;
fakeTimers: LegacyFakeTimers<Timer> | null;
fakeTimersModern: ModernFakeTimers | null;
@@ -27,5 +26,14 @@ export default class NodeEnvironment implements JestEnvironment<Timer> {
exportConditions(): Array<string>;
getVmContext(): Context | null;
}
+export default NodeEnvironment;
+
export declare const TestEnvironment: typeof NodeEnvironment;
+
+declare type Timer = {
+ id: number;
+ ref: () => Timer;
+ unref: () => Timer;
+};
+
export {};
diff --git i/packages/jest-environment/build/index.d.ts w/packages/jest-environment/build/index.d.ts
index 76ca82ae5a..6aef84fcd6 100644
--- i/packages/jest-environment/build/index.d.ts
+++ w/packages/jest-environment/build/index.d.ts
@@ -5,44 +5,25 @@
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="node" />
+
+import type {Circus} from '@jest/types';
+import type {Config} from '@jest/types';
import type {Context} from 'vm';
-import type {LegacyFakeTimers, ModernFakeTimers} from '@jest/fake-timers';
-import type {Circus, Config, Global} from '@jest/types';
-import type {
- fn as JestMockFn,
- mocked as JestMockMocked,
- spyOn as JestMockSpyOn,
- ModuleMocker,
-} from 'jest-mock';
+import type {fn} from 'jest-mock';
+import type {Global} from '@jest/types';
+import type {LegacyFakeTimers} from '@jest/fake-timers';
+import type {mocked} from 'jest-mock';
+import type {ModernFakeTimers} from '@jest/fake-timers';
+import type {ModuleMocker} from 'jest-mock';
+import type {spyOn as spyOn_2} from 'jest-mock';
+
export declare type EnvironmentContext = {
console: Console;
docblockPragmas: Record<string, string | Array<string>>;
testPath: Config.Path;
};
-export declare type ModuleWrapper = (
- this: Module['exports'],
- module: Module,
- exports: Module['exports'],
- require: Module['require'],
- __dirname: string,
- __filename: Module['filename'],
- jest?: Jest,
- ...extraGlobals: Array<Global.Global[keyof Global.Global]>
-) => unknown;
-export declare class JestEnvironment<Timer = unknown> {
- constructor(config: Config.ProjectConfig, context?: EnvironmentContext);
- global: Global.Global;
- fakeTimers: LegacyFakeTimers<Timer> | null;
- fakeTimersModern: ModernFakeTimers | null;
- moduleMocker: ModuleMocker | null;
- getVmContext(): Context | null;
- setup(): Promise<void>;
- teardown(): Promise<void>;
- handleTestEvent?: Circus.EventHandler;
- exportConditions?: () => Array<string>;
-}
-export declare type Module = NodeModule;
-export interface Jest {
+
+export declare interface Jest {
/**
* Advances all timers by the needed milliseconds so that only the next timeouts/intervals will run.
* Optionally, you can provide steps, so it will run steps amount of next timeouts/intervals.
@@ -105,7 +86,7 @@ export interface Jest {
/**
* Creates a mock function. Optionally takes a mock implementation.
*/
- fn: typeof JestMockFn;
+ fn: typeof fn;
/**
* Given the name of a module, use the automatic mocking system to generate a
* mocked version of the module for you.
@@ -129,7 +110,7 @@ export interface Jest {
*/
isMockFunction(
fn: (...args: Array<any>) => unknown,
- ): fn is ReturnType<typeof JestMockFn>;
+ ): fn is ReturnType<typeof fn>;
/**
* Mocks a module with an auto-mocked version when it is being required.
*/
@@ -156,20 +137,20 @@ export interface Jest {
*
* @example
```
- jest.mock('../myModule', () => {
- // Require the original module to not be mocked...
- const originalModule = jest.requireActual(moduleName);
- return {
- __esModule: true, // Use it when dealing with esModules
- ...originalModule,
- getRandom: jest.fn().mockReturnValue(10),
- };
- });
-
- const getRandom = require('../myModule').getRandom;
-
- getRandom(); // Always returns 10
- ```
+ jest.mock('../myModule', () => {
+ // Require the original module to not be mocked...
+ const originalModule = jest.requireActual(moduleName);
+ return {
+ __esModule: true, // Use it when dealing with esModules
+ ...originalModule,
+ getRandom: jest.fn().mockReturnValue(10),
+ };
+ });
+
+ const getRandom = require('../myModule').getRandom;
+
+ getRandom(); // Always returns 10
+ ```
*/
requireActual: (moduleName: string) => unknown;
/**
@@ -195,7 +176,7 @@ export interface Jest {
* jest.spyOn; other mocks will require you to manually restore them.
*/
restoreAllMocks(): Jest;
- mocked: typeof JestMockMocked;
+ mocked: typeof mocked;
/**
* Runs failed tests n-times until they pass or until the max number of
* retries is exhausted. This only works with `jest-circus`!
@@ -258,7 +239,7 @@ export interface Jest {
* Note: By default, jest.spyOn also calls the spied method. This is
* different behavior from most other test libraries.
*/
- spyOn: typeof JestMockSpyOn;
+ spyOn: typeof spyOn_2;
/**
* Indicates that the module system should never return a mocked version of
* the specified module from require() (e.g. that it should always return the
@@ -293,3 +274,31 @@ export interface Jest {
*/
setSystemTime(now?: number | Date): void;
}
+
+export declare class JestEnvironment<Timer = unknown> {
+ constructor(config: Config.ProjectConfig, context?: EnvironmentContext);
+ global: Global.Global;
+ fakeTimers: LegacyFakeTimers<Timer> | null;
+ fakeTimersModern: ModernFakeTimers | null;
+ moduleMocker: ModuleMocker | null;
+ getVmContext(): Context | null;
+ setup(): Promise<void>;
+ teardown(): Promise<void>;
+ handleTestEvent?: Circus.EventHandler;
+ exportConditions?: () => Array<string>;
+}
+
+export declare type Module = NodeModule;
+
+export declare type ModuleWrapper = (
+ this: Module['exports'],
+ module: Module,
+ exports: Module['exports'],
+ require: Module['require'],
+ __dirname: string,
+ __filename: Module['filename'],
+ jest?: Jest,
+ ...extraGlobals: Array<Global.Global[keyof Global.Global]>
+) => unknown;
+
+export {};
diff --git i/packages/jest-fake-timers/build/index.d.ts w/packages/jest-fake-timers/build/index.d.ts
index 043d701548..d2a6eb74fa 100644
--- i/packages/jest-fake-timers/build/index.d.ts
+++ w/packages/jest-fake-timers/build/index.d.ts
@@ -4,5 +4,108 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-export {default as LegacyFakeTimers} from './legacyFakeTimers';
-export {default as ModernFakeTimers} from './modernFakeTimers';
+import type {ModuleMocker} from 'jest-mock';
+import {StackTraceConfig} from 'jest-message-util';
+
+declare type Callback = (...args: Array<unknown>) => void;
+
+declare interface FakeTimersGlobal extends GlobalThis {
+ cancelAnimationFrame: (handle: number) => void;
+ requestAnimationFrame: (callback: (time: number) => void) => number;
+}
+
+declare type GlobalThis = typeof globalThis;
+
+export declare class LegacyFakeTimers<TimerRef> {
+ private _cancelledTicks;
+ private _config;
+ private _disposed?;
+ private _fakeTimerAPIs;
+ private _global;
+ private _immediates;
+ private _maxLoops;
+ private _moduleMocker;
+ private _now;
+ private _ticks;
+ private _timerAPIs;
+ private _timers;
+ private _uuidCounter;
+ private _timerConfig;
+ constructor({
+ global,
+ moduleMocker,
+ timerConfig,
+ config,
+ maxLoops,
+ }: {
+ global: FakeTimersGlobal;
+ moduleMocker: ModuleMocker;
+ timerConfig: TimerConfig<TimerRef>;
+ config: StackTraceConfig;
+ maxLoops?: number;
+ });
+ clearAllTimers(): void;
+ dispose(): void;
+ reset(): void;
+ runAllTicks(): void;
+ runAllImmediates(): void;
+ private _runImmediate;
+ runAllTimers(): void;
+ runOnlyPendingTimers(): void;
+ advanceTimersToNextTimer(steps?: number): void;
+ advanceTimersByTime(msToRun: number): void;
+ runWithRealTimers(cb: Callback): void;
+ useRealTimers(): void;
+ useFakeTimers(): void;
+ getTimerCount(): number;
+ private _checkFakeTimers;
+ private _createMocks;
+ private _fakeClearTimer;
+ private _fakeClearImmediate;
+ private _fakeNextTick;
+ private _fakeRequestAnimationFrame;
+ private _fakeSetImmediate;
+ private _fakeSetInterval;
+ private _fakeSetTimeout;
+ private _getNextTimerHandle;
+ private _runTimerHandle;
+}
+
+export declare class ModernFakeTimers {
+ private _clock;
+ private _config;
+ private _fakingTime;
+ private _global;
+ private _fakeTimers;
+ private _maxLoops;
+ constructor({
+ global,
+ config,
+ maxLoops,
+ }: {
+ global: typeof globalThis;
+ config: StackTraceConfig;
+ maxLoops?: number;
+ });
+ clearAllTimers(): void;
+ dispose(): void;
+ runAllTimers(): void;
+ runOnlyPendingTimers(): void;
+ advanceTimersToNextTimer(steps?: number): void;
+ advanceTimersByTime(msToRun: number): void;
+ runAllTicks(): void;
+ useRealTimers(): void;
+ useFakeTimers(): void;
+ reset(): void;
+ setSystemTime(now?: number | Date): void;
+ getRealSystemTime(): number;
+ getTimerCount(): number;
+ private _checkFakeTimers;
+}
+
+declare type TimerConfig<Ref> = {
+ idToRef: (id: number) => Ref;
+ refToId: (ref: Ref) => number | void;
+};
+
+export {};
diff --git i/packages/jest-fake-timers/build/legacyFakeTimers.d.ts w/packages/jest-fake-timers/build/legacyFakeTimers.d.ts
deleted file mode 100644
index 4779248067..0000000000
--- i/packages/jest-fake-timers/build/legacyFakeTimers.d.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import {StackTraceConfig} from 'jest-message-util';
-import type {ModuleMocker} from 'jest-mock';
-declare type Callback = (...args: Array<unknown>) => void;
-declare type TimerConfig<Ref> = {
- idToRef: (id: number) => Ref;
- refToId: (ref: Ref) => number | void;
-};
-declare type GlobalThis = typeof globalThis;
-interface FakeTimersGlobal extends GlobalThis {
- cancelAnimationFrame: (handle: number) => void;
- requestAnimationFrame: (callback: (time: number) => void) => number;
-}
-export default class FakeTimers<TimerRef> {
- private _cancelledTicks;
- private _config;
- private _disposed?;
- private _fakeTimerAPIs;
- private _global;
- private _immediates;
- private _maxLoops;
- private _moduleMocker;
- private _now;
- private _ticks;
- private _timerAPIs;
- private _timers;
- private _uuidCounter;
- private _timerConfig;
- constructor({
- global,
- moduleMocker,
- timerConfig,
- config,
- maxLoops,
- }: {
- global: FakeTimersGlobal;
- moduleMocker: ModuleMocker;
- timerConfig: TimerConfig<TimerRef>;
- config: StackTraceConfig;
- maxLoops?: number;
- });
- clearAllTimers(): void;
- dispose(): void;
- reset(): void;
- runAllTicks(): void;
- runAllImmediates(): void;
- private _runImmediate;
- runAllTimers(): void;
- runOnlyPendingTimers(): void;
- advanceTimersToNextTimer(steps?: number): void;
- advanceTimersByTime(msToRun: number): void;
- runWithRealTimers(cb: Callback): void;
- useRealTimers(): void;
- useFakeTimers(): void;
- getTimerCount(): number;
- private _checkFakeTimers;
- private _createMocks;
- private _fakeClearTimer;
- private _fakeClearImmediate;
- private _fakeNextTick;
- private _fakeRequestAnimationFrame;
- private _fakeSetImmediate;
- private _fakeSetInterval;
- private _fakeSetTimeout;
- private _getNextTimerHandle;
- private _runTimerHandle;
-}
-export {};
diff --git i/packages/jest-fake-timers/build/modernFakeTimers.d.ts w/packages/jest-fake-timers/build/modernFakeTimers.d.ts
deleted file mode 100644
index fdc6d84ce5..0000000000
--- i/packages/jest-fake-timers/build/modernFakeTimers.d.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import {StackTraceConfig} from 'jest-message-util';
-export default class FakeTimers {
- private _clock;
- private _config;
- private _fakingTime;
- private _global;
- private _fakeTimers;
- private _maxLoops;
- constructor({
- global,
- config,
- maxLoops,
- }: {
- global: typeof globalThis;
- config: StackTraceConfig;
- maxLoops?: number;
- });
- clearAllTimers(): void;
- dispose(): void;
- runAllTimers(): void;
- runOnlyPendingTimers(): void;
- advanceTimersToNextTimer(steps?: number): void;
- advanceTimersByTime(msToRun: number): void;
- runAllTicks(): void;
- useRealTimers(): void;
- useFakeTimers(): void;
- reset(): void;
- setSystemTime(now?: number | Date): void;
- getRealSystemTime(): number;
- getTimerCount(): number;
- private _checkFakeTimers;
-}
diff --git i/packages/jest-get-type/build/index.d.ts w/packages/jest-get-type/build/index.d.ts
index 6cb370329d..096d2d1ea7 100644
--- i/packages/jest-get-type/build/index.d.ts
+++ w/packages/jest-get-type/build/index.d.ts
@@ -4,6 +4,10 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
+export declare function getType(value: unknown): ValueType;
+
+export declare const isPrimitive: (value: unknown) => boolean;
+
declare type ValueType =
| 'array'
| 'bigint'
@@ -19,6 +23,5 @@ declare type ValueType =
| 'string'
| 'symbol'
| 'undefined';
-export declare function getType(value: unknown): ValueType;
-export declare const isPrimitive: (value: unknown) => boolean;
+
export {};
diff --git i/packages/jest-globals/build/index.d.ts w/packages/jest-globals/build/index.d.ts
index d8b031a5b1..29c36731bf 100644
--- i/packages/jest-globals/build/index.d.ts
+++ w/packages/jest-globals/build/index.d.ts
@@ -4,20 +4,50 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-import type {Jest} from '@jest/environment';
-import type {Global} from '@jest/types';
import type {Expect} from 'expect';
-export declare const jest: Jest;
-export declare const expect: Expect;
-export declare const it: Global.GlobalAdditions['it'];
-export declare const test: Global.GlobalAdditions['test'];
-export declare const fit: Global.GlobalAdditions['fit'];
-export declare const xit: Global.GlobalAdditions['xit'];
-export declare const xtest: Global.GlobalAdditions['xtest'];
-export declare const describe: Global.GlobalAdditions['describe'];
-export declare const xdescribe: Global.GlobalAdditions['xdescribe'];
-export declare const fdescribe: Global.GlobalAdditions['fdescribe'];
-export declare const beforeAll: Global.GlobalAdditions['beforeAll'];
-export declare const beforeEach: Global.GlobalAdditions['beforeEach'];
-export declare const afterEach: Global.GlobalAdditions['afterEach'];
-export declare const afterAll: Global.GlobalAdditions['afterAll'];
+import type {Global} from '@jest/types';
+import type {Jest} from '@jest/environment';
+
+declare const afterAll_2: Global.GlobalAdditions['afterAll'];
+export {afterAll_2 as afterAll};
+
+declare const afterEach_2: Global.GlobalAdditions['afterEach'];
+export {afterEach_2 as afterEach};
+
+declare const beforeAll_2: Global.GlobalAdditions['beforeAll'];
+export {beforeAll_2 as beforeAll};
+
+declare const beforeEach_2: Global.GlobalAdditions['beforeEach'];
+export {beforeEach_2 as beforeEach};
+
+declare const describe_2: Global.GlobalAdditions['describe'];
+export {describe_2 as describe};
+
+declare const expect_2: Expect;
+export {expect_2 as expect};
+
+declare const fdescribe_2: Global.GlobalAdditions['fdescribe'];
+export {fdescribe_2 as fdescribe};
+
+declare const fit_2: Global.GlobalAdditions['fit'];
+export {fit_2 as fit};
+
+declare const it_2: Global.GlobalAdditions['it'];
+export {it_2 as it};
+
+declare const jest_2: Jest;
+export {jest_2 as jest};
+
+declare const test_2: Global.GlobalAdditions['test'];
+export {test_2 as test};
+
+declare const xdescribe_2: Global.GlobalAdditions['xdescribe'];
+export {xdescribe_2 as xdescribe};
+
+declare const xit_2: Global.GlobalAdditions['xit'];
+export {xit_2 as xit};
+
+declare const xtest_2: Global.GlobalAdditions['xtest'];
+export {xtest_2 as xtest};
+
+export {};
diff --git i/packages/jest-haste-map/build/HasteFS.d.ts w/packages/jest-haste-map/build/HasteFS.d.ts
deleted file mode 100644
index 0ff22daea5..0000000000
--- i/packages/jest-haste-map/build/HasteFS.d.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import type {FileData} from './types';
-export default class HasteFS {
- private readonly _rootDir;
- private readonly _files;
- constructor({rootDir, files}: {rootDir: Config.Path; files: FileData});
- getModuleName(file: Config.Path): string | null;
- getSize(file: Config.Path): number | null;
- getDependencies(file: Config.Path): Array<string> | null;
- getSha1(file: Config.Path): string | null;
- exists(file: Config.Path): boolean;
- getAllFiles(): Array<Config.Path>;
- getFileIterator(): Iterable<Config.Path>;
- getAbsoluteFileIterator(): Iterable<Config.Path>;
- matchFiles(pattern: RegExp | string): Array<Config.Path>;
- matchFilesWithGlob(
- globs: Array<Config.Glob>,
- root: Config.Path | null,
- ): Set<Config.Path>;
- private _getFileData;
-}
diff --git i/packages/jest-haste-map/build/ModuleMap.d.ts w/packages/jest-haste-map/build/ModuleMap.d.ts
deleted file mode 100644
index fe91707810..0000000000
--- i/packages/jest-haste-map/build/ModuleMap.d.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import type {
- DuplicatesSet,
- HTypeValue,
- IModuleMap,
- RawModuleMap,
- SerializableModuleMap,
-} from './types';
-export default class ModuleMap implements IModuleMap<SerializableModuleMap> {
- static DuplicateHasteCandidatesError: typeof DuplicateHasteCandidatesError;
- private readonly _raw;
- private json;
- private static mapToArrayRecursive;
- private static mapFromArrayRecursive;
- constructor(raw: RawModuleMap);
- getModule(
- name: string,
- platform?: string | null,
- supportsNativePlatform?: boolean | null,
- type?: HTypeValue | null,
- ): Config.Path | null;
- getPackage(
- name: string,
- platform: string | null | undefined,
- _supportsNativePlatform: boolean | null,
- ): Config.Path | null;
- getMockModule(name: string): Config.Path | undefined;
- getRawModuleMap(): RawModuleMap;
- toJSON(): SerializableModuleMap;
- static fromJSON(serializableModuleMap: SerializableModuleMap): ModuleMap;
- /**
- * When looking up a module's data, we walk through each eligible platform for
- * the query. For each platform, we want to check if there are known
- * duplicates for that name+platform pair. The duplication logic normally
- * removes elements from the `map` object, but we want to check upfront to be
- * extra sure. If metadata exists both in the `duplicates` object and the
- * `map`, this would be a bug.
- */
- private _getModuleMetadata;
- private _assertNoDuplicates;
- static create(rootDir: Config.Path): ModuleMap;
-}
-declare class DuplicateHasteCandidatesError extends Error {
- hasteName: string;
- platform: string | null;
- supportsNativePlatform: boolean;
- duplicatesSet: DuplicatesSet;
- constructor(
- name: string,
- platform: string,
- supportsNativePlatform: boolean,
- duplicatesSet: DuplicatesSet,
- );
-}
-export {};
diff --git i/packages/jest-haste-map/build/blacklist.d.ts w/packages/jest-haste-map/build/blacklist.d.ts
deleted file mode 100644
index c29223113e..0000000000
--- i/packages/jest-haste-map/build/blacklist.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-declare const extensions: Set<string>;
-export default extensions;
diff --git i/packages/jest-haste-map/build/constants.d.ts w/packages/jest-haste-map/build/constants.d.ts
deleted file mode 100644
index f5a1f2868d..0000000000
--- i/packages/jest-haste-map/build/constants.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {HType} from './types';
-declare const constants: HType;
-export default constants;
diff --git i/packages/jest-haste-map/build/crawlers/node.d.ts w/packages/jest-haste-map/build/crawlers/node.d.ts
deleted file mode 100644
index 07af258676..0000000000
--- i/packages/jest-haste-map/build/crawlers/node.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {CrawlerOptions, FileData, InternalHasteMap} from '../types';
-export declare function nodeCrawl(options: CrawlerOptions): Promise<{
- removedFiles: FileData;
- hasteMap: InternalHasteMap;
-}>;
diff --git i/packages/jest-haste-map/build/crawlers/watchman.d.ts w/packages/jest-haste-map/build/crawlers/watchman.d.ts
deleted file mode 100644
index e05564709b..0000000000
--- i/packages/jest-haste-map/build/crawlers/watchman.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {CrawlerOptions, FileData, InternalHasteMap} from '../types';
-export declare function watchmanCrawl(options: CrawlerOptions): Promise<{
- changedFiles?: FileData;
- removedFiles: FileData;
- hasteMap: InternalHasteMap;
-}>;
diff --git i/packages/jest-haste-map/build/getMockName.d.ts w/packages/jest-haste-map/build/getMockName.d.ts
deleted file mode 100644
index dbd08cd16c..0000000000
--- i/packages/jest-haste-map/build/getMockName.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-declare const getMockName: (filePath: string) => string;
-export default getMockName;
diff --git i/packages/jest-haste-map/build/index.d.ts w/packages/jest-haste-map/build/index.d.ts
index cfdce9b5fd..69379fe82c 100644
--- i/packages/jest-haste-map/build/index.d.ts
+++ w/packages/jest-haste-map/build/index.d.ts
@@ -5,46 +5,77 @@
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="node" />
-import {EventEmitter} from 'events';
+
import type {Config} from '@jest/types';
-import HasteModuleMap from './ModuleMap';
-import type {
- HasteMapStatic,
- HasteRegExp,
- InternalHasteMap,
- HasteMap as InternalHasteMapObject,
- SerializableModuleMap,
-} from './types';
-declare type Options = {
- cacheDirectory?: string;
- computeDependencies?: boolean;
- computeSha1?: boolean;
- console?: Console;
- dependencyExtractor?: string | null;
- enableSymlinks?: boolean;
- extensions: Array<string>;
- forceNodeFilesystemAPI?: boolean;
- hasteImplModulePath?: string;
- hasteMapModulePath?: string;
- ignorePattern?: HasteRegExp;
- maxWorkers: number;
- mocksPattern?: string;
- name: string;
- platforms: Array<string>;
- resetCache?: boolean;
- retainAllFiles: boolean;
- rootDir: string;
- roots: Array<string>;
- skipPackageJson?: boolean;
- throwOnModuleCollision?: boolean;
- useWatchman?: boolean;
- watch?: boolean;
+import {EventEmitter} from 'events';
+import type {Stats} from 'graceful-fs';
+
+export declare type ChangeEvent = {
+ eventsQueue: EventsQueue;
+ hasteFS: FS;
+ moduleMap: ModuleMap;
};
-export {default as ModuleMap} from './ModuleMap';
-export type {SerializableModuleMap} from './types';
-export type {IModuleMap} from './types';
-export type {default as FS} from './HasteFS';
-export type {ChangeEvent, HasteMap as HasteMapObject} from './types';
+
+export declare class DuplicateError extends Error {
+ mockPath1: string;
+ mockPath2: string;
+ constructor(mockPath1: string, mockPath2: string);
+}
+
+declare class DuplicateHasteCandidatesError extends Error {
+ hasteName: string;
+ platform: string | null;
+ supportsNativePlatform: boolean;
+ duplicatesSet: DuplicatesSet;
+ constructor(
+ name: string,
+ platform: string,
+ supportsNativePlatform: boolean,
+ duplicatesSet: DuplicatesSet,
+ );
+}
+
+declare type DuplicatesIndex = Map<string, Map<string, DuplicatesSet>>;
+
+declare type DuplicatesSet = Map<string, /* type */ number>;
+
+declare type EventsQueue = Array<{
+ filePath: Config.Path;
+ stat: Stats | undefined;
+ type: string;
+}>;
+
+declare type FileData = Map<Config.Path, FileMetaData>;
+
+declare type FileMetaData = [
+ id: string,
+ mtime: number,
+ size: number,
+ visited: 0 | 1,
+ dependencies: string,
+ sha1: string | null | undefined,
+];
+
+export declare class FS {
+ private readonly _rootDir;
+ private readonly _files;
+ constructor({rootDir, files}: {rootDir: Config.Path; files: FileData});
+ getModuleName(file: Config.Path): string | null;
+ getSize(file: Config.Path): number | null;
+ getDependencies(file: Config.Path): Array<string> | null;
+ getSha1(file: Config.Path): string | null;
+ exists(file: Config.Path): boolean;
+ getAllFiles(): Array<Config.Path>;
+ getFileIterator(): Iterable<Config.Path>;
+ getAbsoluteFileIterator(): Iterable<Config.Path>;
+ matchFiles(pattern: RegExp | string): Array<Config.Path>;
+ matchFilesWithGlob(
+ globs: Array<Config.Glob>,
+ root: Config.Path | null,
+ ): Set<Config.Path>;
+ private _getFileData;
+}
+
/**
* HasteMap is a JavaScript implementation of Facebook's haste module system.
*
@@ -123,7 +154,7 @@ export type {ChangeEvent, HasteMap as HasteMapObject} from './types';
* Worker processes can directly access the cache through `HasteMap.read()`.
*
*/
-export default class HasteMap extends EventEmitter {
+declare class HasteMap extends EventEmitter {
private _buildPromise;
private _cachePath;
private _changeInterval?;
@@ -139,14 +170,14 @@ export default class HasteMap extends EventEmitter {
name: string,
...extra: Array<string>
): string;
- static getModuleMapFromJSON(json: SerializableModuleMap): HasteModuleMap;
+ static getModuleMapFromJSON(json: SerializableModuleMap): ModuleMap;
getCacheFilePath(): string;
- build(): Promise<InternalHasteMapObject>;
+ build(): Promise<HasteMapObject>;
/**
* 1. read data from the cache or create an empty structure.
*/
read(): InternalHasteMap;
- readModuleMap(): HasteModuleMap;
+ readModuleMap(): ModuleMap;
/**
* 2. crawl the file system.
*/
@@ -185,10 +216,165 @@ export default class HasteMap extends EventEmitter {
*/
private _ignore;
private _createEmptyMap;
- static H: import('./types').HType;
+ static H: HType;
}
-export declare class DuplicateError extends Error {
- mockPath1: string;
- mockPath2: string;
- constructor(mockPath1: string, mockPath2: string);
+export default HasteMap;
+
+export declare type HasteMapObject = {
+ hasteFS: FS;
+ moduleMap: ModuleMap;
+ __hasteMapForTest?: InternalHasteMap | null;
+};
+
+declare type HasteMapStatic<S = SerializableModuleMap> = {
+ getCacheFilePath(
+ tmpdir: Config.Path,
+ name: string,
+ ...extra: Array<string>
+ ): string;
+ getModuleMapFromJSON(json: S): IModuleMap<S>;
+};
+
+declare type HasteRegExp = RegExp | ((str: string) => boolean);
+
+declare type HType = {
+ ID: 0;
+ MTIME: 1;
+ SIZE: 2;
+ VISITED: 3;
+ DEPENDENCIES: 4;
+ SHA1: 5;
+ PATH: 0;
+ TYPE: 1;
+ MODULE: 0;
+ PACKAGE: 1;
+ GENERIC_PLATFORM: 'g';
+ NATIVE_PLATFORM: 'native';
+ DEPENDENCY_DELIM: '\0';
+};
+
+declare type HTypeValue = HType[keyof HType];
+
+export declare interface IModuleMap<S = SerializableModuleMap> {
+ getModule(
+ name: string,
+ platform?: string | null,
+ supportsNativePlatform?: boolean | null,
+ type?: HTypeValue | null,
+ ): Config.Path | null;
+ getPackage(
+ name: string,
+ platform: string | null | undefined,
+ _supportsNativePlatform: boolean | null,
+ ): Config.Path | null;
+ getMockModule(name: string): Config.Path | undefined;
+ getRawModuleMap(): RawModuleMap;
+ toJSON(): S;
+}
+
+declare type InternalHasteMap = {
+ clocks: WatchmanClocks;
+ duplicates: DuplicatesIndex;
+ files: FileData;
+ map: ModuleMapData;
+ mocks: MockData;
+};
+
+declare type MockData = Map<string, Config.Path>;
+
+export declare class ModuleMap implements IModuleMap<SerializableModuleMap> {
+ static DuplicateHasteCandidatesError: typeof DuplicateHasteCandidatesError;
+ private readonly _raw;
+ private json;
+ private static mapToArrayRecursive;
+ private static mapFromArrayRecursive;
+ constructor(raw: RawModuleMap);
+ getModule(
+ name: string,
+ platform?: string | null,
+ supportsNativePlatform?: boolean | null,
+ type?: HTypeValue | null,
+ ): Config.Path | null;
+ getPackage(
+ name: string,
+ platform: string | null | undefined,
+ _supportsNativePlatform: boolean | null,
+ ): Config.Path | null;
+ getMockModule(name: string): Config.Path | undefined;
+ getRawModuleMap(): RawModuleMap;
+ toJSON(): SerializableModuleMap;
+ static fromJSON(serializableModuleMap: SerializableModuleMap): ModuleMap;
+ /**
+ * When looking up a module's data, we walk through each eligible platform for
+ * the query. For each platform, we want to check if there are known
+ * duplicates for that name+platform pair. The duplication logic normally
+ * removes elements from the `map` object, but we want to check upfront to be
+ * extra sure. If metadata exists both in the `duplicates` object and the
+ * `map`, this would be a bug.
+ */
+ private _getModuleMetadata;
+ private _assertNoDuplicates;
+ static create(rootDir: Config.Path): ModuleMap;
}
+
+declare type ModuleMapData = Map<string, ModuleMapItem>;
+
+declare type ModuleMapItem = {
+ [platform: string]: ModuleMetaData;
+};
+
+declare type ModuleMetaData = [path: Config.Path, type: number];
+
+declare type Options = {
+ cacheDirectory?: string;
+ computeDependencies?: boolean;
+ computeSha1?: boolean;
+ console?: Console;
+ dependencyExtractor?: string | null;
+ enableSymlinks?: boolean;
+ extensions: Array<string>;
+ forceNodeFilesystemAPI?: boolean;
+ hasteImplModulePath?: string;
+ hasteMapModulePath?: string;
+ ignorePattern?: HasteRegExp;
+ maxWorkers: number;
+ mocksPattern?: string;
+ name: string;
+ platforms: Array<string>;
+ resetCache?: boolean;
+ retainAllFiles: boolean;
+ rootDir: string;
+ roots: Array<string>;
+ skipPackageJson?: boolean;
+ throwOnModuleCollision?: boolean;
+ useWatchman?: boolean;
+ watch?: boolean;
+};
+
+declare type RawModuleMap = {
+ rootDir: Config.Path;
+ duplicates: DuplicatesIndex;
+ map: ModuleMapData;
+ mocks: MockData;
+};
+
+export declare type SerializableModuleMap = {
+ duplicates: ReadonlyArray<[string, [string, [string, [string, number]]]]>;
+ map: ReadonlyArray<[string, ValueType<ModuleMapData>]>;
+ mocks: ReadonlyArray<[string, ValueType<MockData>]>;
+ rootDir: Config.Path;
+};
+
+declare type ValueType<T> = T extends Map<string, infer V> ? V : never;
+
+declare type WatchmanClocks = Map<Config.Path, WatchmanClockSpec>;
+
+declare type WatchmanClockSpec =
+ | string
+ | {
+ scm: {
+ 'mergebase-with': string;
+ };
+ };
+
+export {};
diff --git i/packages/jest-haste-map/build/lib/dependencyExtractor.d.ts w/packages/jest-haste-map/build/lib/dependencyExtractor.d.ts
deleted file mode 100644
index cb927b5bac..0000000000
--- i/packages/jest-haste-map/build/lib/dependencyExtractor.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare function extract(code: string): Set<string>;
diff --git i/packages/jest-haste-map/build/lib/fast_path.d.ts w/packages/jest-haste-map/build/lib/fast_path.d.ts
deleted file mode 100644
index 1550f82870..0000000000
--- i/packages/jest-haste-map/build/lib/fast_path.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare function relative(rootDir: string, filename: string): string;
-export declare function resolve(
- rootDir: string,
- relativeFilename: string,
-): string;
diff --git i/packages/jest-haste-map/build/lib/getPlatformExtension.d.ts w/packages/jest-haste-map/build/lib/getPlatformExtension.d.ts
deleted file mode 100644
index 5e4ff42be6..0000000000
--- i/packages/jest-haste-map/build/lib/getPlatformExtension.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function getPlatformExtension(
- file: string,
- platforms?: Array<string>,
-): string | null;
diff --git i/packages/jest-haste-map/build/lib/isRegExpSupported.d.ts w/packages/jest-haste-map/build/lib/isRegExpSupported.d.ts
deleted file mode 100644
index ba40ca3982..0000000000
--- i/packages/jest-haste-map/build/lib/isRegExpSupported.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function isRegExpSupported(value: string): boolean;
diff --git i/packages/jest-haste-map/build/lib/normalizePathSep.d.ts w/packages/jest-haste-map/build/lib/normalizePathSep.d.ts
deleted file mode 100644
index 1490ab7f4d..0000000000
--- i/packages/jest-haste-map/build/lib/normalizePathSep.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-declare let normalizePathSep: (string: string) => string;
-export default normalizePathSep;
diff --git i/packages/jest-haste-map/build/types.d.ts w/packages/jest-haste-map/build/types.d.ts
deleted file mode 100644
index e3e9dce65c..0000000000
--- i/packages/jest-haste-map/build/types.d.ts
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {Stats} from 'graceful-fs';
-import type {Config} from '@jest/types';
-import type HasteFS from './HasteFS';
-import type ModuleMap from './ModuleMap';
-declare type ValueType<T> = T extends Map<string, infer V> ? V : never;
-export declare type SerializableModuleMap = {
- duplicates: ReadonlyArray<[string, [string, [string, [string, number]]]]>;
- map: ReadonlyArray<[string, ValueType<ModuleMapData>]>;
- mocks: ReadonlyArray<[string, ValueType<MockData>]>;
- rootDir: Config.Path;
-};
-export interface IModuleMap<S = SerializableModuleMap> {
- getModule(
- name: string,
- platform?: string | null,
- supportsNativePlatform?: boolean | null,
- type?: HTypeValue | null,
- ): Config.Path | null;
- getPackage(
- name: string,
- platform: string | null | undefined,
- _supportsNativePlatform: boolean | null,
- ): Config.Path | null;
- getMockModule(name: string): Config.Path | undefined;
- getRawModuleMap(): RawModuleMap;
- toJSON(): S;
-}
-export declare type HasteMapStatic<S = SerializableModuleMap> = {
- getCacheFilePath(
- tmpdir: Config.Path,
- name: string,
- ...extra: Array<string>
- ): string;
- getModuleMapFromJSON(json: S): IModuleMap<S>;
-};
-export declare type IgnoreMatcher = (item: string) => boolean;
-export declare type WorkerMessage = {
- computeDependencies: boolean;
- computeSha1: boolean;
- dependencyExtractor?: string | null;
- rootDir: string;
- filePath: string;
- hasteImplModulePath?: string;
-};
-export declare type WorkerMetadata = {
- dependencies: Array<string> | undefined | null;
- id: string | undefined | null;
- module: ModuleMetaData | undefined | null;
- sha1: string | undefined | null;
-};
-export declare type CrawlerOptions = {
- computeSha1: boolean;
- enableSymlinks: boolean;
- data: InternalHasteMap;
- extensions: Array<string>;
- forceNodeFilesystemAPI: boolean;
- ignore: IgnoreMatcher;
- rootDir: string;
- roots: Array<string>;
-};
-export declare type HasteImpl = {
- getHasteName(filePath: Config.Path): string | undefined;
-};
-export declare type FileData = Map<Config.Path, FileMetaData>;
-export declare type FileMetaData = [
- id: string,
- mtime: number,
- size: number,
- visited: 0 | 1,
- dependencies: string,
- sha1: string | null | undefined,
-];
-export declare type MockData = Map<string, Config.Path>;
-export declare type ModuleMapData = Map<string, ModuleMapItem>;
-export declare type WatchmanClockSpec =
- | string
- | {
- scm: {
- 'mergebase-with': string;
- };
- };
-export declare type WatchmanClocks = Map<Config.Path, WatchmanClockSpec>;
-export declare type HasteRegExp = RegExp | ((str: string) => boolean);
-export declare type DuplicatesSet = Map<string, /* type */ number>;
-export declare type DuplicatesIndex = Map<string, Map<string, DuplicatesSet>>;
-export declare type InternalHasteMap = {
- clocks: WatchmanClocks;
- duplicates: DuplicatesIndex;
- files: FileData;
- map: ModuleMapData;
- mocks: MockData;
-};
-export declare type HasteMap = {
- hasteFS: HasteFS;
- moduleMap: ModuleMap;
- __hasteMapForTest?: InternalHasteMap | null;
-};
-export declare type RawModuleMap = {
- rootDir: Config.Path;
- duplicates: DuplicatesIndex;
- map: ModuleMapData;
- mocks: MockData;
-};
-declare type ModuleMapItem = {
- [platform: string]: ModuleMetaData;
-};
-export declare type ModuleMetaData = [path: Config.Path, type: number];
-export declare type HType = {
- ID: 0;
- MTIME: 1;
- SIZE: 2;
- VISITED: 3;
- DEPENDENCIES: 4;
- SHA1: 5;
- PATH: 0;
- TYPE: 1;
- MODULE: 0;
- PACKAGE: 1;
- GENERIC_PLATFORM: 'g';
- NATIVE_PLATFORM: 'native';
- DEPENDENCY_DELIM: '\0';
-};
-export declare type HTypeValue = HType[keyof HType];
-export declare type EventsQueue = Array<{
- filePath: Config.Path;
- stat: Stats | undefined;
- type: string;
-}>;
-export declare type ChangeEvent = {
- eventsQueue: EventsQueue;
- hasteFS: HasteFS;
- moduleMap: ModuleMap;
-};
-export {};
diff --git i/packages/jest-haste-map/build/watchers/FSEventsWatcher.d.ts w/packages/jest-haste-map/build/watchers/FSEventsWatcher.d.ts
deleted file mode 100644
index e6662be97c..0000000000
--- i/packages/jest-haste-map/build/watchers/FSEventsWatcher.d.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-/// <reference types="node" />
-import {EventEmitter} from 'events';
-import {Matcher} from 'anymatch';
-/**
- * Export `FSEventsWatcher` class.
- * Watches `dir`.
- */
-export declare class FSEventsWatcher extends EventEmitter {
- readonly root: string;
- readonly ignored?: Matcher;
- readonly glob: Array<string>;
- readonly dot: boolean;
- readonly hasIgnore: boolean;
- readonly doIgnore: (path: string) => boolean;
- readonly fsEventsWatchStopper: () => Promise<void>;
- private _tracked;
- static isSupported(): boolean;
- private static normalizeProxy;
- private static recReaddir;
- constructor(
- dir: string,
- opts: {
- root: string;
- ignored?: Matcher;
- glob: string | Array<string>;
- dot: boolean;
- },
- );
- /**
- * End watching.
- */
- close(callback?: () => void): Promise<void>;
- private isFileIncluded;
- private handleEvent;
- /**
- * Emit events.
- */
- private _emit;
-}
diff --git i/packages/jest-haste-map/build/worker.d.ts w/packages/jest-haste-map/build/worker.d.ts
deleted file mode 100644
index 44f08f7ad6..0000000000
--- i/packages/jest-haste-map/build/worker.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {WorkerMessage, WorkerMetadata} from './types';
-export declare function worker(data: WorkerMessage): Promise<WorkerMetadata>;
-export declare function getSha1(data: WorkerMessage): Promise<WorkerMetadata>;
diff --git i/packages/jest-jasmine2/build/ExpectationFailed.d.ts w/packages/jest-jasmine2/build/ExpectationFailed.d.ts
deleted file mode 100644
index eacd8f341b..0000000000
--- i/packages/jest-jasmine2/build/ExpectationFailed.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default class ExpectationFailed extends Error {}
diff --git i/packages/jest-jasmine2/build/PCancelable.d.ts w/packages/jest-jasmine2/build/PCancelable.d.ts
deleted file mode 100644
index 5941642a15..0000000000
--- i/packages/jest-jasmine2/build/PCancelable.d.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default class PCancelable<T> implements PromiseLike<T> {
- private _pending;
- private _canceled;
- private _promise;
- private _cancel?;
- private _reject;
- constructor(
- executor: (
- onCancel: (cancelHandler: () => void) => void,
- resolve: (value: T | PromiseLike<T>) => void,
- reject: (reason?: unknown) => void,
- ) => void,
- );
- then<TResult1 = T, TResult2 = never>(
- onFulfilled?:
- | ((value: T) => TResult1 | PromiseLike<TResult1>)
- | undefined
- | null,
- onRejected?:
- | ((reason: unknown) => TResult2 | PromiseLike<TResult2>)
- | undefined
- | null,
- ): Promise<TResult1 | TResult2>;
- catch<TResult>(
- onRejected?:
- | ((reason: unknown) => TResult | PromiseLike<TResult>)
- | undefined
- | null,
- ): Promise<T | TResult>;
- cancel(): void;
-}
diff --git i/packages/jest-jasmine2/build/assertionErrorMessage.d.ts w/packages/jest-jasmine2/build/assertionErrorMessage.d.ts
deleted file mode 100644
index 86926d6f12..0000000000
--- i/packages/jest-jasmine2/build/assertionErrorMessage.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import {DiffOptions} from 'jest-matcher-utils';
-import type {AssertionErrorWithStack} from './types';
-declare function assertionErrorMessage(
- error: AssertionErrorWithStack,
- options: DiffOptions,
-): string;
-export default assertionErrorMessage;
diff --git i/packages/jest-jasmine2/build/each.d.ts w/packages/jest-jasmine2/build/each.d.ts
deleted file mode 100644
index c264247b88..0000000000
--- i/packages/jest-jasmine2/build/each.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {JestEnvironment} from '@jest/environment';
-export default function each(environment: JestEnvironment): void;
diff --git i/packages/jest-jasmine2/build/errorOnPrivate.d.ts w/packages/jest-jasmine2/build/errorOnPrivate.d.ts
deleted file mode 100644
index 82c3ab6f2f..0000000000
--- i/packages/jest-jasmine2/build/errorOnPrivate.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Global} from '@jest/types';
-export declare function installErrorOnPrivate(global: Global.Global): void;
diff --git i/packages/jest-jasmine2/build/expectationResultFactory.d.ts w/packages/jest-jasmine2/build/expectationResultFactory.d.ts
deleted file mode 100644
index 1bde3a5312..0000000000
--- i/packages/jest-jasmine2/build/expectationResultFactory.d.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {FailedAssertion} from '@jest/test-result';
-export declare type Options = {
- matcherName: string;
- passed: boolean;
- actual?: any;
- error?: any;
- expected?: any;
- message?: string | null;
-};
-export default function expectationResultFactory(
- options: Options,
- initError?: Error,
-): FailedAssertion;
diff --git i/packages/jest-jasmine2/build/index.d.ts w/packages/jest-jasmine2/build/index.d.ts
index 684edb2dc8..cd6b304e05 100644
--- i/packages/jest-jasmine2/build/index.d.ts
+++ w/packages/jest-jasmine2/build/index.d.ts
@@ -4,15 +4,458 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-import type {JestEnvironment} from '@jest/environment';
-import type {TestResult} from '@jest/test-result';
+/// <reference types="node" />
+
+import type {AssertionError} from 'assert';
import type {Config} from '@jest/types';
+import type {Expect} from 'expect';
+import type {FailedAssertion} from '@jest/test-result';
+import type {JestEnvironment} from '@jest/environment';
+import type {Milliseconds} from '@jest/test-result';
import type Runtime from 'jest-runtime';
-export type {Jasmine} from './types';
-export default function jasmine2(
+import type {Status} from '@jest/test-result';
+import type {TestResult} from '@jest/test-result';
+
+declare interface AssertionErrorWithStack extends AssertionError {
+ stack: string;
+}
+
+declare type AsyncExpectationResult = Promise<SyncExpectationResult>;
+
+declare type Attributes = {
+ id: string;
+ resultCallback: (result: Spec['result']) => void;
+ description: string;
+ throwOnExpectationFailure: unknown;
+ getTestPath: () => Config.Path;
+ queueableFn: QueueableFn;
+ beforeAndAfterFns: () => {
+ befores: Array<QueueableFn>;
+ afters: Array<QueueableFn>;
+ };
+ userContext: () => unknown;
+ onStart: (context: Spec) => void;
+ getSpecName: (spec: Spec) => string;
+ queueRunnerFactory: typeof queueRunner;
+};
+
+declare type Attributes_2 = {
+ id: string;
+ parentSuite?: Suite;
+ description: string;
+ throwOnExpectationFailure?: boolean;
+ getTestPath: () => Config.Path;
+};
+
+declare class CallTracker {
+ track: (context: Context) => void;
+ any: () => boolean;
+ count: () => number;
+ argsFor: (index: number) => Array<unknown>;
+ all: () => Array<Context>;
+ allArgs: () => Array<unknown>;
+ first: () => Context;
+ mostRecent: () => Context;
+ reset: () => void;
+ constructor();
+}
+
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ */
+declare type Context = {
+ object: unknown;
+ args: Array<unknown>;
+ returnValue?: unknown;
+};
+
+declare function createSpy(name: string, originalFn: Fn): Spy;
+
+declare interface DoneFn {
+ (error?: any): void;
+ fail: (error: Error) => void;
+}
+
+declare class ExpectationFailed extends Error {}
+
+declare type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;
+
+declare function expectationResultFactory(
+ options: Options,
+ initError?: Error,
+): FailedAssertion;
+
+declare interface Fn extends Record<string, unknown> {
+ (): unknown;
+}
+
+export declare type Jasmine = {
+ _DEFAULT_TIMEOUT_INTERVAL: number;
+ DEFAULT_TIMEOUT_INTERVAL: number;
+ currentEnv_: ReturnType<typeof jasmineEnv>['prototype'];
+ getEnv: () => ReturnType<typeof jasmineEnv>['prototype'];
+ createSpy: typeof createSpy;
+ Env: ReturnType<typeof jasmineEnv>;
+ JsApiReporter: typeof JsApiReporter;
+ ReportDispatcher: typeof ReportDispatcher;
+ Spec: typeof Spec;
+ SpyRegistry: typeof SpyRegistry;
+ Suite: typeof Suite;
+ Timer: typeof Timer;
+ version: string;
+ testPath: Config.Path;
+ addMatchers: (matchers: JasmineMatchersObject) => void;
+} & Expect &
+ typeof globalThis;
+
+declare function jasmine2(
globalConfig: Config.GlobalConfig,
config: Config.ProjectConfig,
environment: JestEnvironment,
runtime: Runtime,
testPath: string,
): Promise<TestResult>;
+export default jasmine2;
+
+declare function jasmineEnv(j$: Jasmine): {
+ new (): {
+ specFilter: (spec: Spec) => boolean;
+ catchExceptions: (value: unknown) => boolean;
+ throwOnExpectationFailure: (value: unknown) => void;
+ catchingExceptions: () => boolean;
+ topSuite: () => Suite;
+ fail: (error: Error | AssertionErrorWithStack) => void;
+ pending: (message: string) => void;
+ afterAll: (
+ afterAllFunction: QueueableFn['fn'],
+ timeout?: number | undefined,
+ ) => void;
+ fit: (
+ description: string,
+ fn: QueueableFn['fn'],
+ timeout?: number | undefined,
+ ) => Spec;
+ throwingExpectationFailures: () => boolean;
+ randomizeTests: (value: unknown) => void;
+ randomTests: () => boolean;
+ seed: (value: unknown) => unknown;
+ execute: (
+ runnablesToRun?: string[] | undefined,
+ suiteTree?: Suite | undefined,
+ ) => Promise<void>;
+ fdescribe: (
+ description: string,
+ specDefinitions: SpecDefinitionsFn,
+ ) => Suite;
+ spyOn: (
+ obj: Record<string, Spy>,
+ methodName: string,
+ accessType?: keyof PropertyDescriptor | undefined,
+ ) => Spy;
+ beforeEach: (
+ beforeEachFunction: QueueableFn['fn'],
+ timeout?: number | undefined,
+ ) => void;
+ afterEach: (
+ afterEachFunction: QueueableFn['fn'],
+ timeout?: number | undefined,
+ ) => void;
+ clearReporters: () => void;
+ addReporter: (reporterToAdd: Reporter) => void;
+ it: (
+ description: string,
+ fn: QueueableFn['fn'],
+ timeout?: number | undefined,
+ ) => Spec;
+ xdescribe: (
+ description: string,
+ specDefinitions: SpecDefinitionsFn,
+ ) => Suite;
+ xit: (
+ description: string,
+ fn: QueueableFn['fn'],
+ timeout?: number | undefined,
+ ) => Spec;
+ beforeAll: (
+ beforeAllFunction: QueueableFn['fn'],
+ timeout?: number | undefined,
+ ) => void;
+ todo: () => Spec;
+ provideFallbackReporter: (reporterToAdd: Reporter) => void;
+ allowRespy: (allow: boolean) => void;
+ describe: (
+ description: string,
+ specDefinitions: SpecDefinitionsFn,
+ ) => Suite;
+ };
+};
+
+declare type JasmineMatcher = {
+ (matchersUtil: unknown, context: unknown): JasmineMatcher;
+ compare: () => RawMatcherFn;
+ negativeCompare: () => RawMatcherFn;
+};
+
+declare type JasmineMatchersObject = {
+ [id: string]: JasmineMatcher;
+};
+
+declare class JsApiReporter implements Reporter {
+ started: boolean;
+ finished: boolean;
+ runDetails: RunDetails;
+ jasmineStarted: (runDetails: RunDetails) => void;
+ jasmineDone: (runDetails: RunDetails) => void;
+ status: () => unknown;
+ executionTime: () => unknown;
+ suiteStarted: (result: SuiteResult) => void;
+ suiteDone: (result: SuiteResult) => void;
+ suiteResults: (index: number, length: number) => Array<SuiteResult>;
+ suites: () => Record<string, SuiteResult>;
+ specResults: (index: number, length: number) => Array<SpecResult>;
+ specDone: (result: SpecResult) => void;
+ specs: () => Array<SpecResult>;
+ specStarted: (spec: SpecResult) => void;
+ constructor(options: {timer?: Timer});
+}
+
+declare type Options = {
+ matcherName: string;
+ passed: boolean;
+ actual?: any;
+ error?: any;
+ expected?: any;
+ message?: string | null;
+};
+
+declare type Options_2 = {
+ clearTimeout: typeof globalThis['clearTimeout'];
+ fail: (error: Error) => void;
+ onException: (error: Error) => void;
+ queueableFns: Array<QueueableFn>;
+ setTimeout: typeof globalThis['setTimeout'];
+ userContext: unknown;
+};
+
+declare type PromiseCallback =
+ | (() => void | PromiseLike<void>)
+ | undefined
+ | null;
+
+declare type QueueableFn = {
+ fn: (done: DoneFn) => void;
+ timeout?: () => number;
+ initError?: Error;
+};
+
+declare function queueRunner(options: Options_2): PromiseLike<void> & {
+ cancel: () => void;
+ catch: (onRejected?: PromiseCallback) => Promise<void>;
+};
+
+declare type RawMatcherFn = (
+ expected: unknown,
+ actual: unknown,
+ options?: unknown,
+) => ExpectationResult;
+
+declare class ReportDispatcher implements Reporter {
+ addReporter: (reporter: Reporter) => void;
+ provideFallbackReporter: (reporter: Reporter) => void;
+ clearReporters: () => void;
+ jasmineDone: (runDetails: RunDetails) => void;
+ jasmineStarted: (runDetails: RunDetails) => void;
+ specDone: (result: SpecResult) => void;
+ specStarted: (spec: SpecResult) => void;
+ suiteDone: (result: SuiteResult) => void;
+ suiteStarted: (result: SuiteResult) => void;
+ constructor(methods: Array<keyof Reporter>);
+}
+
+declare type Reporter = {
+ jasmineDone: (runDetails: RunDetails) => void;
+ jasmineStarted: (runDetails: RunDetails) => void;
+ specDone: (result: SpecResult) => void;
+ specStarted: (spec: SpecResult) => void;
+ suiteDone: (result: SuiteResult) => void;
+ suiteStarted: (result: SuiteResult) => void;
+};
+
+declare type RunDetails = {
+ totalSpecsDefined?: number;
+ failedExpectations?: SuiteResult['failedExpectations'];
+};
+
+declare class Spec {
+ id: string;
+ description: string;
+ resultCallback: (result: SpecResult) => void;
+ queueableFn: QueueableFn;
+ beforeAndAfterFns: () => {
+ befores: Array<QueueableFn>;
+ afters: Array<QueueableFn>;
+ };
+ userContext: () => unknown;
+ onStart: (spec: Spec) => void;
+ getSpecName: (spec: Spec) => string;
+ queueRunnerFactory: typeof queueRunner;
+ throwOnExpectationFailure: boolean;
+ initError: Error;
+ result: SpecResult;
+ disabled?: boolean;
+ currentRun?: ReturnType<typeof queueRunner>;
+ markedTodo?: boolean;
+ markedPending?: boolean;
+ expand?: boolean;
+ static pendingSpecExceptionMessage: string;
+ static isPendingSpecException(e: Error): boolean;
+ constructor(attrs: Attributes);
+ addExpectationResult(passed: boolean, data: Options, isError?: boolean): void;
+ execute(onComplete?: () => void, enabled?: boolean): void;
+ cancel(): void;
+ onException(error: ExpectationFailed | AssertionErrorWithStack): void;
+ disable(): void;
+ pend(message?: string): void;
+ todo(): void;
+ getResult(): SpecResult;
+ status(
+ enabled?: boolean,
+ ): 'todo' | 'passed' | 'failed' | 'pending' | 'disabled';
+ isExecutable(): boolean;
+ getFullName(): string;
+ isAssertionError(error: Error): boolean;
+}
+
+declare type SpecDefinitionsFn = () => void;
+
+declare type SpecResult = {
+ id: string;
+ description: string;
+ fullName: string;
+ duration?: Milliseconds;
+ failedExpectations: Array<FailedAssertion>;
+ testPath: Config.Path;
+ passedExpectations: Array<ReturnType<typeof expectationResultFactory>>;
+ pendingReason: string;
+ status: Status;
+ __callsite?: {
+ getColumnNumber: () => number;
+ getLineNumber: () => number;
+ };
+};
+
+declare interface Spy extends Record<string, any> {
+ (this: Record<string, unknown>, ...args: Array<any>): unknown;
+ and: SpyStrategy;
+ calls: CallTracker;
+ restoreObjectToOriginalState?: () => void;
+}
+
+declare class SpyRegistry {
+ allowRespy: (allow: unknown) => void;
+ spyOn: (
+ obj: Record<string, Spy>,
+ methodName: string,
+ accessType?: keyof PropertyDescriptor,
+ ) => Spy;
+ clearSpies: () => void;
+ respy: unknown;
+ private _spyOnProperty;
+ constructor({currentSpies}?: {currentSpies?: () => Array<Spy>});
+}
+
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ */
+declare class SpyStrategy {
+ identity: () => string;
+ exec: (...args: Array<any>) => unknown;
+ callThrough: () => unknown;
+ returnValue: (value: unknown) => unknown;
+ returnValues: () => unknown;
+ throwError: (something: string | Error) => unknown;
+ callFake: (fn: Function) => unknown;
+ stub: (fn: Function) => unknown;
+ constructor({
+ name,
+ fn,
+ getSpy,
+ }?: {
+ name?: string;
+ fn?: Function;
+ getSpy?: () => unknown;
+ });
+}
+
+declare class Suite {
+ id: string;
+ parentSuite?: Suite;
+ description: string;
+ throwOnExpectationFailure: boolean;
+ beforeFns: Array<QueueableFn>;
+ afterFns: Array<QueueableFn>;
+ beforeAllFns: Array<QueueableFn>;
+ afterAllFns: Array<QueueableFn>;
+ disabled: boolean;
+ children: Array<Suite | Spec>;
+ result: SuiteResult;
+ sharedContext?: object;
+ markedPending: boolean;
+ markedTodo: boolean;
+ isFocused: boolean;
+ constructor(attrs: Attributes_2);
+ getFullName(): string;
+ disable(): void;
+ pend(_message?: string): void;
+ beforeEach(fn: QueueableFn): void;
+ beforeAll(fn: QueueableFn): void;
+ afterEach(fn: QueueableFn): void;
+ afterAll(fn: QueueableFn): void;
+ addChild(child: Suite | Spec): void;
+ status(): 'failed' | 'pending' | 'disabled' | 'finished';
+ isExecutable(): boolean;
+ canBeReentered(): boolean;
+ getResult(): SuiteResult;
+ sharedUserContext(): object;
+ clonedSharedUserContext(): object;
+ onException(...args: Parameters<Spec['onException']>): void;
+ addExpectationResult(...args: Parameters<Spec['addExpectationResult']>): void;
+ execute(..._args: Array<any>): void;
+}
+
+declare type SuiteResult = {
+ id: string;
+ description: string;
+ fullName: string;
+ failedExpectations: Array<ReturnType<typeof expectationResultFactory>>;
+ testPath: Config.Path;
+ status?: string;
+};
+
+declare type SyncExpectationResult = {
+ pass: boolean;
+ message: () => string;
+};
+
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ */
+declare class Timer {
+ start: () => void;
+ elapsed: () => number;
+ constructor(options?: {now?: () => number});
+}
+
+export {};
diff --git i/packages/jest-jasmine2/build/isError.d.ts w/packages/jest-jasmine2/build/isError.d.ts
deleted file mode 100644
index 84ab9b0dc1..0000000000
--- i/packages/jest-jasmine2/build/isError.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function isError(potentialError: any): {
- isError: boolean;
- message: string | null;
-};
diff --git i/packages/jest-jasmine2/build/jasmine/CallTracker.d.ts w/packages/jest-jasmine2/build/jasmine/CallTracker.d.ts
deleted file mode 100644
index be35903635..0000000000
--- i/packages/jest-jasmine2/build/jasmine/CallTracker.d.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-export declare type Context = {
- object: unknown;
- args: Array<unknown>;
- returnValue?: unknown;
-};
-declare class CallTracker {
- track: (context: Context) => void;
- any: () => boolean;
- count: () => number;
- argsFor: (index: number) => Array<unknown>;
- all: () => Array<Context>;
- allArgs: () => Array<unknown>;
- first: () => Context;
- mostRecent: () => Context;
- reset: () => void;
- constructor();
-}
-export default CallTracker;
diff --git i/packages/jest-jasmine2/build/jasmine/Env.d.ts w/packages/jest-jasmine2/build/jasmine/Env.d.ts
deleted file mode 100644
index c5050a9078..0000000000
--- i/packages/jest-jasmine2/build/jasmine/Env.d.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import {QueueableFn} from '../queueRunner';
-import type {
- AssertionErrorWithStack,
- Jasmine,
- Reporter,
- SpecDefinitionsFn,
- Spy,
-} from '../types';
-import type {default as Spec} from './Spec';
-import type Suite from './Suite';
-export default function jasmineEnv(j$: Jasmine): {
- new (): {
- specFilter: (spec: Spec) => boolean;
- catchExceptions: (value: unknown) => boolean;
- throwOnExpectationFailure: (value: unknown) => void;
- catchingExceptions: () => boolean;
- topSuite: () => Suite;
- fail: (error: Error | AssertionErrorWithStack) => void;
- pending: (message: string) => void;
- afterAll: (
- afterAllFunction: QueueableFn['fn'],
- timeout?: number | undefined,
- ) => void;
- fit: (
- description: string,
- fn: QueueableFn['fn'],
- timeout?: number | undefined,
- ) => Spec;
- throwingExpectationFailures: () => boolean;
- randomizeTests: (value: unknown) => void;
- randomTests: () => boolean;
- seed: (value: unknown) => unknown;
- execute: (
- runnablesToRun?: string[] | undefined,
- suiteTree?: Suite | undefined,
- ) => Promise<void>;
- fdescribe: (
- description: string,
- specDefinitions: SpecDefinitionsFn,
- ) => Suite;
- spyOn: (
- obj: Record<string, Spy>,
- methodName: string,
- accessType?: keyof PropertyDescriptor | undefined,
- ) => Spy;
- beforeEach: (
- beforeEachFunction: QueueableFn['fn'],
- timeout?: number | undefined,
- ) => void;
- afterEach: (
- afterEachFunction: QueueableFn['fn'],
- timeout?: number | undefined,
- ) => void;
- clearReporters: () => void;
- addReporter: (reporterToAdd: Reporter) => void;
- it: (
- description: string,
- fn: QueueableFn['fn'],
- timeout?: number | undefined,
- ) => Spec;
- xdescribe: (
- description: string,
- specDefinitions: SpecDefinitionsFn,
- ) => Suite;
- xit: (
- description: string,
- fn: QueueableFn['fn'],
- timeout?: number | undefined,
- ) => Spec;
- beforeAll: (
- beforeAllFunction: QueueableFn['fn'],
- timeout?: number | undefined,
- ) => void;
- todo: () => Spec;
- provideFallbackReporter: (reporterToAdd: Reporter) => void;
- allowRespy: (allow: boolean) => void;
- describe: (
- description: string,
- specDefinitions: SpecDefinitionsFn,
- ) => Suite;
- };
-};
diff --git i/packages/jest-jasmine2/build/jasmine/JsApiReporter.d.ts w/packages/jest-jasmine2/build/jasmine/JsApiReporter.d.ts
deleted file mode 100644
index c01a6cd1c8..0000000000
--- i/packages/jest-jasmine2/build/jasmine/JsApiReporter.d.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {Reporter, RunDetails} from '../types';
-import type {SpecResult} from './Spec';
-import type {SuiteResult} from './Suite';
-import type Timer from './Timer';
-export default class JsApiReporter implements Reporter {
- started: boolean;
- finished: boolean;
- runDetails: RunDetails;
- jasmineStarted: (runDetails: RunDetails) => void;
- jasmineDone: (runDetails: RunDetails) => void;
- status: () => unknown;
- executionTime: () => unknown;
- suiteStarted: (result: SuiteResult) => void;
- suiteDone: (result: SuiteResult) => void;
- suiteResults: (index: number, length: number) => Array<SuiteResult>;
- suites: () => Record<string, SuiteResult>;
- specResults: (index: number, length: number) => Array<SpecResult>;
- specDone: (result: SpecResult) => void;
- specs: () => Array<SpecResult>;
- specStarted: (spec: SpecResult) => void;
- constructor(options: {timer?: Timer});
-}
diff --git i/packages/jest-jasmine2/build/jasmine/ReportDispatcher.d.ts w/packages/jest-jasmine2/build/jasmine/ReportDispatcher.d.ts
deleted file mode 100644
index 8f1b2f8ba7..0000000000
--- i/packages/jest-jasmine2/build/jasmine/ReportDispatcher.d.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {Reporter, RunDetails} from '../types';
-import type {SpecResult} from './Spec';
-import type {SuiteResult} from './Suite';
-export default class ReportDispatcher implements Reporter {
- addReporter: (reporter: Reporter) => void;
- provideFallbackReporter: (reporter: Reporter) => void;
- clearReporters: () => void;
- jasmineDone: (runDetails: RunDetails) => void;
- jasmineStarted: (runDetails: RunDetails) => void;
- specDone: (result: SpecResult) => void;
- specStarted: (spec: SpecResult) => void;
- suiteDone: (result: SuiteResult) => void;
- suiteStarted: (result: SuiteResult) => void;
- constructor(methods: Array<keyof Reporter>);
-}
diff --git i/packages/jest-jasmine2/build/jasmine/Spec.d.ts w/packages/jest-jasmine2/build/jasmine/Spec.d.ts
deleted file mode 100644
index 2848c94137..0000000000
--- i/packages/jest-jasmine2/build/jasmine/Spec.d.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {FailedAssertion, Milliseconds, Status} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import ExpectationFailed from '../ExpectationFailed';
-import expectationResultFactory, {
- Options as ExpectationResultFactoryOptions,
-} from '../expectationResultFactory';
-import type {QueueableFn, default as queueRunner} from '../queueRunner';
-import type {AssertionErrorWithStack} from '../types';
-export declare type Attributes = {
- id: string;
- resultCallback: (result: Spec['result']) => void;
- description: string;
- throwOnExpectationFailure: unknown;
- getTestPath: () => Config.Path;
- queueableFn: QueueableFn;
- beforeAndAfterFns: () => {
- befores: Array<QueueableFn>;
- afters: Array<QueueableFn>;
- };
- userContext: () => unknown;
- onStart: (context: Spec) => void;
- getSpecName: (spec: Spec) => string;
- queueRunnerFactory: typeof queueRunner;
-};
-export declare type SpecResult = {
- id: string;
- description: string;
- fullName: string;
- duration?: Milliseconds;
- failedExpectations: Array<FailedAssertion>;
- testPath: Config.Path;
- passedExpectations: Array<ReturnType<typeof expectationResultFactory>>;
- pendingReason: string;
- status: Status;
- __callsite?: {
- getColumnNumber: () => number;
- getLineNumber: () => number;
- };
-};
-export default class Spec {
- id: string;
- description: string;
- resultCallback: (result: SpecResult) => void;
- queueableFn: QueueableFn;
- beforeAndAfterFns: () => {
- befores: Array<QueueableFn>;
- afters: Array<QueueableFn>;
- };
- userContext: () => unknown;
- onStart: (spec: Spec) => void;
- getSpecName: (spec: Spec) => string;
- queueRunnerFactory: typeof queueRunner;
- throwOnExpectationFailure: boolean;
- initError: Error;
- result: SpecResult;
- disabled?: boolean;
- currentRun?: ReturnType<typeof queueRunner>;
- markedTodo?: boolean;
- markedPending?: boolean;
- expand?: boolean;
- static pendingSpecExceptionMessage: string;
- static isPendingSpecException(e: Error): boolean;
- constructor(attrs: Attributes);
- addExpectationResult(
- passed: boolean,
- data: ExpectationResultFactoryOptions,
- isError?: boolean,
- ): void;
- execute(onComplete?: () => void, enabled?: boolean): void;
- cancel(): void;
- onException(error: ExpectationFailed | AssertionErrorWithStack): void;
- disable(): void;
- pend(message?: string): void;
- todo(): void;
- getResult(): SpecResult;
- status(
- enabled?: boolean,
- ): 'todo' | 'passed' | 'failed' | 'pending' | 'disabled';
- isExecutable(): boolean;
- getFullName(): string;
- isAssertionError(error: Error): boolean;
-}
diff --git i/packages/jest-jasmine2/build/jasmine/SpyStrategy.d.ts w/packages/jest-jasmine2/build/jasmine/SpyStrategy.d.ts
deleted file mode 100644
index fa4477b01a..0000000000
--- i/packages/jest-jasmine2/build/jasmine/SpyStrategy.d.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-export default class SpyStrategy {
- identity: () => string;
- exec: (...args: Array<any>) => unknown;
- callThrough: () => unknown;
- returnValue: (value: unknown) => unknown;
- returnValues: () => unknown;
- throwError: (something: string | Error) => unknown;
- callFake: (fn: Function) => unknown;
- stub: (fn: Function) => unknown;
- constructor({
- name,
- fn,
- getSpy,
- }?: {
- name?: string;
- fn?: Function;
- getSpy?: () => unknown;
- });
-}
diff --git i/packages/jest-jasmine2/build/jasmine/Suite.d.ts w/packages/jest-jasmine2/build/jasmine/Suite.d.ts
deleted file mode 100644
index a328eec57c..0000000000
--- i/packages/jest-jasmine2/build/jasmine/Suite.d.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {Config} from '@jest/types';
-import expectationResultFactory from '../expectationResultFactory';
-import type {QueueableFn} from '../queueRunner';
-import type Spec from './Spec';
-export declare type SuiteResult = {
- id: string;
- description: string;
- fullName: string;
- failedExpectations: Array<ReturnType<typeof expectationResultFactory>>;
- testPath: Config.Path;
- status?: string;
-};
-export declare type Attributes = {
- id: string;
- parentSuite?: Suite;
- description: string;
- throwOnExpectationFailure?: boolean;
- getTestPath: () => Config.Path;
-};
-export default class Suite {
- id: string;
- parentSuite?: Suite;
- description: string;
- throwOnExpectationFailure: boolean;
- beforeFns: Array<QueueableFn>;
- afterFns: Array<QueueableFn>;
- beforeAllFns: Array<QueueableFn>;
- afterAllFns: Array<QueueableFn>;
- disabled: boolean;
- children: Array<Suite | Spec>;
- result: SuiteResult;
- sharedContext?: object;
- markedPending: boolean;
- markedTodo: boolean;
- isFocused: boolean;
- constructor(attrs: Attributes);
- getFullName(): string;
- disable(): void;
- pend(_message?: string): void;
- beforeEach(fn: QueueableFn): void;
- beforeAll(fn: QueueableFn): void;
- afterEach(fn: QueueableFn): void;
- afterAll(fn: QueueableFn): void;
- addChild(child: Suite | Spec): void;
- status(): 'failed' | 'pending' | 'disabled' | 'finished';
- isExecutable(): boolean;
- canBeReentered(): boolean;
- getResult(): SuiteResult;
- sharedUserContext(): object;
- clonedSharedUserContext(): object;
- onException(...args: Parameters<Spec['onException']>): void;
- addExpectationResult(...args: Parameters<Spec['addExpectationResult']>): void;
- execute(..._args: Array<any>): void;
-}
diff --git i/packages/jest-jasmine2/build/jasmine/Timer.d.ts w/packages/jest-jasmine2/build/jasmine/Timer.d.ts
deleted file mode 100644
index a4ff812f78..0000000000
--- i/packages/jest-jasmine2/build/jasmine/Timer.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-export default class Timer {
- start: () => void;
- elapsed: () => number;
- constructor(options?: {now?: () => number});
-}
diff --git i/packages/jest-jasmine2/build/jasmine/createSpy.d.ts w/packages/jest-jasmine2/build/jasmine/createSpy.d.ts
deleted file mode 100644
index 9f2fe226b6..0000000000
--- i/packages/jest-jasmine2/build/jasmine/createSpy.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {Spy} from '../types';
-interface Fn extends Record<string, unknown> {
- (): unknown;
-}
-declare function createSpy(name: string, originalFn: Fn): Spy;
-export default createSpy;
diff --git i/packages/jest-jasmine2/build/jasmine/jasmineLight.d.ts w/packages/jest-jasmine2/build/jasmine/jasmineLight.d.ts
deleted file mode 100644
index a892b1cbe0..0000000000
--- i/packages/jest-jasmine2/build/jasmine/jasmineLight.d.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {Jasmine, SpecDefinitionsFn} from '../types';
-import JsApiReporter from './JsApiReporter';
-export declare const create: (createOptions: Record<string, any>) => Jasmine;
-export declare const _interface: (
- jasmine: Jasmine,
- env: any,
-) => {
- describe(description: string, specDefinitions: SpecDefinitionsFn): any;
- xdescribe(description: string, specDefinitions: SpecDefinitionsFn): any;
- fdescribe(description: string, specDefinitions: SpecDefinitionsFn): any;
- it(): any;
- xit(): any;
- fit(): any;
- beforeEach(): any;
- afterEach(): any;
- beforeAll(): any;
- afterAll(): any;
- pending(): any;
- fail(): any;
- spyOn(
- obj: Record<string, any>,
- methodName: string,
- accessType?: string | undefined,
- ): any;
- jsApiReporter: JsApiReporter;
- jasmine: Jasmine;
-};
diff --git i/packages/jest-jasmine2/build/jasmine/spyRegistry.d.ts w/packages/jest-jasmine2/build/jasmine/spyRegistry.d.ts
deleted file mode 100644
index 5234adceb4..0000000000
--- i/packages/jest-jasmine2/build/jasmine/spyRegistry.d.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {Spy} from '../types';
-export default class SpyRegistry {
- allowRespy: (allow: unknown) => void;
- spyOn: (
- obj: Record<string, Spy>,
- methodName: string,
- accessType?: keyof PropertyDescriptor,
- ) => Spy;
- clearSpies: () => void;
- respy: unknown;
- private _spyOnProperty;
- constructor({currentSpies}?: {currentSpies?: () => Array<Spy>});
-}
diff --git i/packages/jest-jasmine2/build/jasmineAsyncInstall.d.ts w/packages/jest-jasmine2/build/jasmineAsyncInstall.d.ts
deleted file mode 100644
index 046d58869c..0000000000
--- i/packages/jest-jasmine2/build/jasmineAsyncInstall.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config, Global} from '@jest/types';
-export default function jasmineAsyncInstall(
- globalConfig: Config.GlobalConfig,
- global: Global.Global,
-): void;
diff --git i/packages/jest-jasmine2/build/jestExpect.d.ts w/packages/jest-jasmine2/build/jestExpect.d.ts
deleted file mode 100644
index e9d9293ee2..0000000000
--- i/packages/jest-jasmine2/build/jestExpect.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function jestExpect(config: {expand: boolean}): void;
diff --git i/packages/jest-jasmine2/build/pTimeout.d.ts w/packages/jest-jasmine2/build/pTimeout.d.ts
deleted file mode 100644
index 52bb03c731..0000000000
--- i/packages/jest-jasmine2/build/pTimeout.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function pTimeout(
- promise: Promise<void>,
- ms: number,
- clearTimeout: typeof globalThis['clearTimeout'],
- setTimeout: typeof globalThis['setTimeout'],
- onTimeout: () => void,
-): Promise<void>;
diff --git i/packages/jest-jasmine2/build/queueRunner.d.ts w/packages/jest-jasmine2/build/queueRunner.d.ts
deleted file mode 100644
index ac670d5571..0000000000
--- i/packages/jest-jasmine2/build/queueRunner.d.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare type Options = {
- clearTimeout: typeof globalThis['clearTimeout'];
- fail: (error: Error) => void;
- onException: (error: Error) => void;
- queueableFns: Array<QueueableFn>;
- setTimeout: typeof globalThis['setTimeout'];
- userContext: unknown;
-};
-export interface DoneFn {
- (error?: any): void;
- fail: (error: Error) => void;
-}
-export declare type QueueableFn = {
- fn: (done: DoneFn) => void;
- timeout?: () => number;
- initError?: Error;
-};
-declare type PromiseCallback =
- | (() => void | PromiseLike<void>)
- | undefined
- | null;
-export default function queueRunner(options: Options): PromiseLike<void> & {
- cancel: () => void;
- catch: (onRejected?: PromiseCallback) => Promise<void>;
-};
-export {};
diff --git i/packages/jest-jasmine2/build/reporter.d.ts w/packages/jest-jasmine2/build/reporter.d.ts
deleted file mode 100644
index 33df1d815b..0000000000
--- i/packages/jest-jasmine2/build/reporter.d.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import {TestResult} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import type {SpecResult} from './jasmine/Spec';
-import type {SuiteResult} from './jasmine/Suite';
-import type {Reporter, RunDetails} from './types';
-export default class Jasmine2Reporter implements Reporter {
- private _testResults;
- private _globalConfig;
- private _config;
- private _currentSuites;
- private _resolve;
- private _resultsPromise;
- private _startTimes;
- private _testPath;
- constructor(
- globalConfig: Config.GlobalConfig,
- config: Config.ProjectConfig,
- testPath: Config.Path,
- );
- jasmineStarted(_runDetails: RunDetails): void;
- specStarted(spec: SpecResult): void;
- specDone(result: SpecResult): void;
- suiteStarted(suite: SuiteResult): void;
- suiteDone(_result: SuiteResult): void;
- jasmineDone(_runDetails: RunDetails): void;
- getResults(): Promise<TestResult>;
- private _addMissingMessageToStack;
- private _extractSpecResults;
-}
diff --git i/packages/jest-jasmine2/build/setup_jest_globals.d.ts w/packages/jest-jasmine2/build/setup_jest_globals.d.ts
deleted file mode 100644
index 548aae16dd..0000000000
--- i/packages/jest-jasmine2/build/setup_jest_globals.d.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import {SnapshotState} from 'jest-snapshot';
-import type {Plugin} from 'pretty-format';
-export declare type SetupOptions = {
- config: Config.ProjectConfig;
- globalConfig: Config.GlobalConfig;
- localRequire: (moduleName: string) => Plugin;
- testPath: Config.Path;
-};
-export default function setupJestGlobals({
- config,
- globalConfig,
- localRequire,
- testPath,
-}: SetupOptions): Promise<SnapshotState>;
diff --git i/packages/jest-jasmine2/build/treeProcessor.d.ts w/packages/jest-jasmine2/build/treeProcessor.d.ts
deleted file mode 100644
index 25e7e123fa..0000000000
--- i/packages/jest-jasmine2/build/treeProcessor.d.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type Suite from './jasmine/Suite';
-declare type Options = {
- nodeComplete: (suite: TreeNode) => void;
- nodeStart: (suite: TreeNode) => void;
- queueRunnerFactory: any;
- runnableIds: Array<string>;
- tree: TreeNode;
-};
-export declare type TreeNode = {
- afterAllFns: Array<unknown>;
- beforeAllFns: Array<unknown>;
- disabled?: boolean;
- execute: (onComplete: () => void, enabled: boolean) => void;
- id: string;
- onException: (error: Error) => void;
- sharedUserContext: () => unknown;
- children?: Array<TreeNode>;
-} & Pick<Suite, 'getResult' | 'parentSuite' | 'result' | 'markedPending'>;
-export default function treeProcessor(options: Options): void;
-export {};
diff --git i/packages/jest-jasmine2/build/types.d.ts w/packages/jest-jasmine2/build/types.d.ts
deleted file mode 100644
index 30d9c617b5..0000000000
--- i/packages/jest-jasmine2/build/types.d.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {AssertionError} from 'assert';
-import type {Config} from '@jest/types';
-import type {Expect} from 'expect';
-import type CallTracker from './jasmine/CallTracker';
-import type Env from './jasmine/Env';
-import type JsApiReporter from './jasmine/JsApiReporter';
-import type ReportDispatcher from './jasmine/ReportDispatcher';
-import type {default as Spec, SpecResult} from './jasmine/Spec';
-import type SpyStrategy from './jasmine/SpyStrategy';
-import type {default as Suite, SuiteResult} from './jasmine/Suite';
-import type Timer from './jasmine/Timer';
-import type createSpy from './jasmine/createSpy';
-import type SpyRegistry from './jasmine/spyRegistry';
-export declare type SpecDefinitionsFn = () => void;
-export interface AssertionErrorWithStack extends AssertionError {
- stack: string;
-}
-export declare type SyncExpectationResult = {
- pass: boolean;
- message: () => string;
-};
-export declare type AsyncExpectationResult = Promise<SyncExpectationResult>;
-export declare type ExpectationResult =
- | SyncExpectationResult
- | AsyncExpectationResult;
-export declare type RawMatcherFn = (
- expected: unknown,
- actual: unknown,
- options?: unknown,
-) => ExpectationResult;
-export declare type RunDetails = {
- totalSpecsDefined?: number;
- failedExpectations?: SuiteResult['failedExpectations'];
-};
-export declare type Reporter = {
- jasmineDone: (runDetails: RunDetails) => void;
- jasmineStarted: (runDetails: RunDetails) => void;
- specDone: (result: SpecResult) => void;
- specStarted: (spec: SpecResult) => void;
- suiteDone: (result: SuiteResult) => void;
- suiteStarted: (result: SuiteResult) => void;
-};
-export interface Spy extends Record<string, any> {
- (this: Record<string, unknown>, ...args: Array<any>): unknown;
- and: SpyStrategy;
- calls: CallTracker;
- restoreObjectToOriginalState?: () => void;
-}
-declare type JasmineMatcher = {
- (matchersUtil: unknown, context: unknown): JasmineMatcher;
- compare: () => RawMatcherFn;
- negativeCompare: () => RawMatcherFn;
-};
-export declare type JasmineMatchersObject = {
- [id: string]: JasmineMatcher;
-};
-export declare type Jasmine = {
- _DEFAULT_TIMEOUT_INTERVAL: number;
- DEFAULT_TIMEOUT_INTERVAL: number;
- currentEnv_: ReturnType<typeof Env>['prototype'];
- getEnv: () => ReturnType<typeof Env>['prototype'];
- createSpy: typeof createSpy;
- Env: ReturnType<typeof Env>;
- JsApiReporter: typeof JsApiReporter;
- ReportDispatcher: typeof ReportDispatcher;
- Spec: typeof Spec;
- SpyRegistry: typeof SpyRegistry;
- Suite: typeof Suite;
- Timer: typeof Timer;
- version: string;
- testPath: Config.Path;
- addMatchers: (matchers: JasmineMatchersObject) => void;
-} & Expect &
- typeof globalThis;
-declare global {
- namespace NodeJS {
- interface Global {
- expect: Expect;
- }
- }
-}
-export {};
diff --git i/packages/jest-leak-detector/build/index.d.ts w/packages/jest-leak-detector/build/index.d.ts
index 1e514311a9..9480a8a339 100644
--- i/packages/jest-leak-detector/build/index.d.ts
+++ w/packages/jest-leak-detector/build/index.d.ts
@@ -4,9 +4,13 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-export default class LeakDetector {
+
+declare class LeakDetector {
private _isReferenceBeingHeld;
constructor(value: unknown);
isLeaking(): Promise<boolean>;
private _runGarbageCollector;
}
+export default LeakDetector;
+
+export {};
diff --git i/packages/jest-matcher-utils/build/Replaceable.d.ts w/packages/jest-matcher-utils/build/Replaceable.d.ts
deleted file mode 100644
index 49a9f7d39f..0000000000
--- i/packages/jest-matcher-utils/build/Replaceable.d.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-declare type ReplaceableForEachCallBack = (
- value: unknown,
- key: unknown,
- object: unknown,
-) => void;
-export default class Replaceable {
- object: any;
- type: string;
- constructor(object: any);
- static isReplaceable(obj1: unknown, obj2: unknown): boolean;
- forEach(cb: ReplaceableForEachCallBack): void;
- get(key: any): any;
- set(key: any, value: any): void;
-}
-export {};
diff --git i/packages/jest-matcher-utils/build/deepCyclicCopyReplaceable.d.ts w/packages/jest-matcher-utils/build/deepCyclicCopyReplaceable.d.ts
deleted file mode 100644
index 772d1da46d..0000000000
--- i/packages/jest-matcher-utils/build/deepCyclicCopyReplaceable.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function deepCyclicCopyReplaceable<T>(
- value: T,
- cycles?: WeakMap<any, any>,
-): T;
diff --git i/packages/jest-matcher-utils/build/index.d.ts w/packages/jest-matcher-utils/build/index.d.ts
index 216c2c98a7..c9f911b252 100644
--- i/packages/jest-matcher-utils/build/index.d.ts
+++ w/packages/jest-matcher-utils/build/index.d.ts
@@ -5,39 +5,20 @@
* LICENSE file in the root directory of this source tree.
*/
import chalk = require('chalk');
-import {DiffOptions as ImportDiffOptions} from 'jest-diff';
-declare type MatcherHintColor = (arg: string) => string;
-export declare type MatcherHintOptions = {
- comment?: string;
- expectedColor?: MatcherHintColor;
- isDirectExpectCall?: boolean;
- isNot?: boolean;
- promise?: string;
- receivedColor?: MatcherHintColor;
- secondArgument?: string;
- secondArgumentColor?: MatcherHintColor;
-};
-export declare type DiffOptions = ImportDiffOptions;
-export declare const EXPECTED_COLOR: chalk.Chalk;
-export declare const RECEIVED_COLOR: chalk.Chalk;
-export declare const INVERTED_COLOR: chalk.Chalk;
+import {DiffOptions as DiffOptions_2} from 'jest-diff';
+
export declare const BOLD_WEIGHT: chalk.Chalk;
+
+export declare const diff: (
+ a: unknown,
+ b: unknown,
+ options?: DiffOptions_2 | undefined,
+) => string | null;
+
+export declare type DiffOptions = DiffOptions_2;
+
export declare const DIM_COLOR: chalk.Chalk;
-export declare const SUGGEST_TO_CONTAIN_EQUAL: string;
-export declare const stringify: (object: unknown, maxDepth?: number) => string;
-export declare const highlightTrailingWhitespace: (text: string) => string;
-export declare const printReceived: (object: unknown) => string;
-export declare const printExpected: (value: unknown) => string;
-export declare const printWithType: (
- name: string,
- value: unknown,
- print: (value: unknown) => string,
-) => string;
-export declare const ensureNoExpected: (
- expected: unknown,
- matcherName: string,
- options?: MatcherHintOptions | undefined,
-) => void;
+
/**
* Ensures that `actual` is of type `number | bigint`
*/
@@ -46,6 +27,13 @@ export declare const ensureActualIsNumber: (
matcherName: string,
options?: MatcherHintOptions | undefined,
) => void;
+
+export declare const ensureExpectedIsNonNegativeInteger: (
+ expected: unknown,
+ matcherName: string,
+ options?: MatcherHintOptions | undefined,
+) => void;
+
/**
* Ensures that `expected` is of type `number | bigint`
*/
@@ -54,6 +42,13 @@ export declare const ensureExpectedIsNumber: (
matcherName: string,
options?: MatcherHintOptions | undefined,
) => void;
+
+export declare const ensureNoExpected: (
+ expected: unknown,
+ matcherName: string,
+ options?: MatcherHintOptions | undefined,
+) => void;
+
/**
* Ensures that `actual` & `expected` are of type `number | bigint`
*/
@@ -63,35 +58,67 @@ export declare const ensureNumbers: (
matcherName: string,
options?: MatcherHintOptions | undefined,
) => void;
-export declare const ensureExpectedIsNonNegativeInteger: (
- expected: unknown,
- matcherName: string,
- options?: MatcherHintOptions | undefined,
-) => void;
-export declare const printDiffOrStringify: (
- expected: unknown,
- received: unknown,
- expectedLabel: string,
- receivedLabel: string,
- expand: boolean,
-) => string;
-export declare const diff: (
- a: unknown,
- b: unknown,
- options?: ImportDiffOptions | undefined,
-) => string | null;
-export declare const pluralize: (word: string, count: number) => string;
-declare type PrintLabel = (string: string) => string;
+
+export declare const EXPECTED_COLOR: chalk.Chalk;
+
export declare const getLabelPrinter: (...strings: Array<string>) => PrintLabel;
+
+export declare const highlightTrailingWhitespace: (text: string) => string;
+
+export declare const INVERTED_COLOR: chalk.Chalk;
+
export declare const matcherErrorMessage: (
hint: string,
generic: string,
specific?: string | undefined,
) => string;
+
export declare const matcherHint: (
matcherName: string,
received?: string,
expected?: string,
options?: MatcherHintOptions,
) => string;
+
+declare type MatcherHintColor = (arg: string) => string;
+
+export declare type MatcherHintOptions = {
+ comment?: string;
+ expectedColor?: MatcherHintColor;
+ isDirectExpectCall?: boolean;
+ isNot?: boolean;
+ promise?: string;
+ receivedColor?: MatcherHintColor;
+ secondArgument?: string;
+ secondArgumentColor?: MatcherHintColor;
+};
+
+export declare const pluralize: (word: string, count: number) => string;
+
+export declare const printDiffOrStringify: (
+ expected: unknown,
+ received: unknown,
+ expectedLabel: string,
+ receivedLabel: string,
+ expand: boolean,
+) => string;
+
+export declare const printExpected: (value: unknown) => string;
+
+declare type PrintLabel = (string: string) => string;
+
+export declare const printReceived: (object: unknown) => string;
+
+export declare const printWithType: (
+ name: string,
+ value: unknown,
+ print: (value: unknown) => string,
+) => string;
+
+export declare const RECEIVED_COLOR: chalk.Chalk;
+
+export declare const stringify: (object: unknown, maxDepth?: number) => string;
+
+export declare const SUGGEST_TO_CONTAIN_EQUAL: string;
+
export {};
diff --git i/packages/jest-message-util/build/index.d.ts w/packages/jest-message-util/build/index.d.ts
index 8528716ff3..7635b6e311 100644
--- i/packages/jest-message-util/build/index.d.ts
+++ w/packages/jest-message-util/build/index.d.ts
@@ -4,17 +4,10 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-import type {Config, TestResult} from '@jest/types';
-import type {Frame} from './types';
-export type {Frame} from './types';
-export declare type StackTraceConfig = Pick<
- Config.ProjectConfig,
- 'rootDir' | 'testMatch'
->;
-export declare type StackTraceOptions = {
- noStackTrace: boolean;
- noCodeFrame?: boolean;
-};
+import type {Config} from '@jest/types';
+import type {StackData} from 'stack-utils';
+import type {TestResult} from '@jest/types';
+
export declare const formatExecError: (
error: Error | TestResult.SerializableError | string | undefined,
config: StackTraceConfig,
@@ -22,24 +15,45 @@ export declare const formatExecError: (
testPath?: string | undefined,
reuseMessage?: boolean | undefined,
) => string;
-export declare const getStackTraceLines: (
- stack: string,
- options?: StackTraceOptions,
-) => Array<string>;
-export declare const getTopFrame: (lines: Array<string>) => Frame | null;
-export declare const formatStackTrace: (
- stack: string,
- config: StackTraceConfig,
- options: StackTraceOptions,
- testPath?: string | undefined,
-) => string;
+
export declare const formatResultsErrors: (
testResults: Array<TestResult.AssertionResult>,
config: StackTraceConfig,
options: StackTraceOptions,
testPath?: string | undefined,
) => string | null;
+
+export declare const formatStackTrace: (
+ stack: string,
+ config: StackTraceConfig,
+ options: StackTraceOptions,
+ testPath?: string | undefined,
+) => string;
+
+export declare interface Frame extends StackData {
+ file: string;
+}
+
+export declare const getStackTraceLines: (
+ stack: string,
+ options?: StackTraceOptions,
+) => Array<string>;
+
+export declare const getTopFrame: (lines: Array<string>) => Frame | null;
+
export declare const separateMessageFromStack: (content: string) => {
message: string;
stack: string;
};
+
+export declare type StackTraceConfig = Pick<
+ Config.ProjectConfig,
+ 'rootDir' | 'testMatch'
+>;
+
+export declare type StackTraceOptions = {
+ noStackTrace: boolean;
+ noCodeFrame?: boolean;
+};
+
+export {};
diff --git i/packages/jest-message-util/build/types.d.ts w/packages/jest-message-util/build/types.d.ts
deleted file mode 100644
index aa318cb47c..0000000000
--- i/packages/jest-message-util/build/types.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {StackData} from 'stack-utils';
-export interface Frame extends StackData {
- file: string;
-}
diff --git i/packages/jest-mock/build/index.d.ts w/packages/jest-mock/build/index.d.ts
index 31b8cb9788..3d78ce52b8 100644
--- i/packages/jest-mock/build/index.d.ts
+++ w/packages/jest-mock/build/index.d.ts
@@ -4,82 +4,64 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-export declare type MockFunctionMetadataType =
- | 'object'
- | 'array'
- | 'regexp'
- | 'function'
- | 'constant'
- | 'collection'
- | 'null'
- | 'undefined';
-export declare type MockFunctionMetadata<
- T,
- Y extends Array<unknown>,
- Type = MockFunctionMetadataType,
-> = {
- ref?: number;
- members?: Record<string, MockFunctionMetadata<T, Y>>;
- mockImpl?: (...args: Y) => T;
- name?: string;
- refID?: number;
- type?: Type;
- value?: T;
- length?: number;
-};
-export declare type MockableFunction = (...args: Array<any>) => any;
-export declare type MethodKeysOf<T> = {
- [K in keyof T]: T[K] extends MockableFunction ? K : never;
-}[keyof T];
-export declare type PropertyKeysOf<T> = {
- [K in keyof T]: T[K] extends MockableFunction ? never : K;
-}[keyof T];
+export declare type ArgsType<T> = T extends (...args: infer A) => any
+ ? A
+ : never;
+
export declare type ArgumentsOf<T> = T extends (...args: infer A) => any
? A
: never;
+
+export declare interface Constructable {
+ new (...args: Array<any>): any;
+}
+
export declare type ConstructorArgumentsOf<T> = T extends new (
...args: infer A
) => any
? A
: never;
+
+export declare const fn: <T, Y extends unknown[]>(
+ implementation?: ((...args: Y) => T) | undefined,
+) => Mock<T, Y>;
+
+declare type FunctionPropertyNames<T> = {
+ [K in keyof T]: T[K] extends (...args: Array<any>) => any ? K : never;
+}[keyof T] &
+ string;
+
+export declare type MaybeMocked<T> = T extends MockableFunction
+ ? MockedFunction<T>
+ : T extends object
+ ? MockedObject<T>
+ : T;
+
export declare type MaybeMockedConstructor<T> = T extends new (
...args: Array<any>
) => infer R
? MockInstance<R, ConstructorArgumentsOf<T>>
: T;
-export declare type MockedFunction<T extends MockableFunction> =
- MockWithArgs<T> & {
- [K in keyof T]: T[K];
- };
-export declare type MockedFunctionDeep<T extends MockableFunction> =
- MockWithArgs<T> & MockedObjectDeep<T>;
-export declare type MockedObject<T> = MaybeMockedConstructor<T> & {
- [K in MethodKeysOf<T>]: T[K] extends MockableFunction
- ? MockedFunction<T[K]>
- : T[K];
-} & {
- [K in PropertyKeysOf<T>]: T[K];
-};
-export declare type MockedObjectDeep<T> = MaybeMockedConstructor<T> & {
- [K in MethodKeysOf<T>]: T[K] extends MockableFunction
- ? MockedFunctionDeep<T[K]>
- : T[K];
-} & {
- [K in PropertyKeysOf<T>]: MaybeMockedDeep<T[K]>;
-};
+
export declare type MaybeMockedDeep<T> = T extends MockableFunction
? MockedFunctionDeep<T>
: T extends object
? MockedObjectDeep<T>
: T;
-export declare type MaybeMocked<T> = T extends MockableFunction
- ? MockedFunction<T>
- : T extends object
- ? MockedObject<T>
- : T;
-export declare type ArgsType<T> = T extends (...args: infer A) => any
- ? A
- : never;
+
+export declare type MethodKeysOf<T> = {
+ [K in keyof T]: T[K] extends MockableFunction ? K : never;
+}[keyof T];
+
+export declare interface Mock<T, Y extends Array<unknown> = Array<unknown>>
+ extends Function,
+ MockInstance<T, Y> {
+ new (...args: Y): T;
+ (...args: Y): T;
+}
+
+export declare type MockableFunction = (...args: Array<any>) => any;
+
export declare type Mocked<T> = {
[P in keyof T]: T[P] extends (...args: Array<any>) => any
? MockInstance<ReturnType<T[P]>, ArgsType<T[P]>>
@@ -87,6 +69,12 @@ export declare type Mocked<T> = {
? MockedClass<T[P]>
: T[P];
} & T;
+
+export declare const mocked: {
+ <T>(item: T, deep?: false | undefined): MaybeMocked<T>;
+ <T_1>(item: T_1, deep: true): MaybeMockedDeep<T_1>;
+};
+
export declare type MockedClass<T extends Constructable> = MockInstance<
InstanceType<T>,
T extends new (...args: infer P) => any ? P : never
@@ -97,54 +85,56 @@ export declare type MockedClass<T extends Constructable> = MockInstance<
? Mocked<T['prototype']>
: never;
} & T;
-export interface Constructable {
- new (...args: Array<any>): any;
-}
-export interface MockWithArgs<T extends MockableFunction>
- extends MockInstance<ReturnType<T>, ArgumentsOf<T>> {
- new (...args: ConstructorArgumentsOf<T>): T;
- (...args: ArgumentsOf<T>): ReturnType<T>;
-}
-export interface Mock<T, Y extends Array<unknown> = Array<unknown>>
- extends Function,
- MockInstance<T, Y> {
- new (...args: Y): T;
- (...args: Y): T;
-}
-export interface SpyInstance<T, Y extends Array<unknown>>
- extends MockInstance<T, Y> {}
-export interface MockInstance<T, Y extends Array<unknown>> {
- _isMockFunction: true;
- _protoImpl: Function;
- getMockName(): string;
- getMockImplementation(): Function | undefined;
- mock: MockFunctionState<T, Y>;
- mockClear(): this;
- mockReset(): this;
- mockRestore(): void;
- mockImplementation(fn: (...args: Y) => T): this;
- mockImplementation(fn: () => Promise<T>): this;
- mockImplementationOnce(fn: (...args: Y) => T): this;
- mockImplementationOnce(fn: () => Promise<T>): this;
- mockName(name: string): this;
- mockReturnThis(): this;
- mockReturnValue(value: T): this;
- mockReturnValueOnce(value: T): this;
- mockResolvedValue(value: Unpromisify<T>): this;
- mockResolvedValueOnce(value: Unpromisify<T>): this;
- mockRejectedValue(value: unknown): this;
- mockRejectedValueOnce(value: unknown): this;
-}
-declare type Unpromisify<T> = T extends Promise<infer R> ? R : never;
-/**
- * Possible types of a MockFunctionResult.
- * 'return': The call completed by returning normally.
- * 'throw': The call completed by throwing a value.
- * 'incomplete': The call has not completed yet. This is possible if you read
- * the mock function result from within the mock function itself
- * (or a function called by the mock function).
- */
-declare type MockFunctionResultType = 'return' | 'throw' | 'incomplete';
+
+export declare type MockedFunction<T extends MockableFunction> =
+ MockWithArgs<T> & {
+ [K in keyof T]: T[K];
+ };
+
+export declare type MockedFunctionDeep<T extends MockableFunction> =
+ MockWithArgs<T> & MockedObjectDeep<T>;
+
+export declare type MockedObject<T> = MaybeMockedConstructor<T> & {
+ [K in MethodKeysOf<T>]: T[K] extends MockableFunction
+ ? MockedFunction<T[K]>
+ : T[K];
+} & {
+ [K in PropertyKeysOf<T>]: T[K];
+};
+
+export declare type MockedObjectDeep<T> = MaybeMockedConstructor<T> & {
+ [K in MethodKeysOf<T>]: T[K] extends MockableFunction
+ ? MockedFunctionDeep<T[K]>
+ : T[K];
+} & {
+ [K in PropertyKeysOf<T>]: MaybeMockedDeep<T[K]>;
+};
+
+export declare type MockFunctionMetadata<
+ T,
+ Y extends Array<unknown>,
+ Type = MockFunctionMetadataType,
+> = {
+ ref?: number;
+ members?: Record<string, MockFunctionMetadata<T, Y>>;
+ mockImpl?: (...args: Y) => T;
+ name?: string;
+ refID?: number;
+ type?: Type;
+ value?: T;
+ length?: number;
+};
+
+export declare type MockFunctionMetadataType =
+ | 'object'
+ | 'array'
+ | 'regexp'
+ | 'function'
+ | 'constant'
+ | 'collection'
+ | 'null'
+ | 'undefined';
+
/**
* Represents the result of a single call to a mock function.
*/
@@ -159,6 +149,17 @@ declare type MockFunctionResult = {
*/
value: unknown;
};
+
+/**
+ * Possible types of a MockFunctionResult.
+ * 'return': The call completed by returning normally.
+ * 'throw': The call completed by throwing a value.
+ * 'incomplete': The call has not completed yet. This is possible if you read
+ * the mock function result from within the mock function itself
+ * (or a function called by the mock function).
+ */
+declare type MockFunctionResultType = 'return' | 'throw' | 'incomplete';
+
declare type MockFunctionState<T, Y extends Array<unknown>> = {
calls: Array<Y>;
instances: Array<T>;
@@ -172,14 +173,36 @@ declare type MockFunctionState<T, Y extends Array<unknown>> = {
*/
results: Array<MockFunctionResult>;
};
-declare type NonFunctionPropertyNames<T> = {
- [K in keyof T]: T[K] extends (...args: Array<any>) => any ? never : K;
-}[keyof T] &
- string;
-declare type FunctionPropertyNames<T> = {
- [K in keyof T]: T[K] extends (...args: Array<any>) => any ? K : never;
-}[keyof T] &
- string;
+
+export declare interface MockInstance<T, Y extends Array<unknown>> {
+ _isMockFunction: true;
+ _protoImpl: Function;
+ getMockName(): string;
+ getMockImplementation(): Function | undefined;
+ mock: MockFunctionState<T, Y>;
+ mockClear(): this;
+ mockReset(): this;
+ mockRestore(): void;
+ mockImplementation(fn: (...args: Y) => T): this;
+ mockImplementation(fn: () => Promise<T>): this;
+ mockImplementationOnce(fn: (...args: Y) => T): this;
+ mockImplementationOnce(fn: () => Promise<T>): this;
+ mockName(name: string): this;
+ mockReturnThis(): this;
+ mockReturnValue(value: T): this;
+ mockReturnValueOnce(value: T): this;
+ mockResolvedValue(value: Unpromisify<T>): this;
+ mockResolvedValueOnce(value: Unpromisify<T>): this;
+ mockRejectedValue(value: unknown): this;
+ mockRejectedValueOnce(value: unknown): this;
+}
+
+export declare interface MockWithArgs<T extends MockableFunction>
+ extends MockInstance<ReturnType<T>, ArgumentsOf<T>> {
+ new (...args: ConstructorArgumentsOf<T>): T;
+ (...args: ArgumentsOf<T>): ReturnType<T>;
+}
+
export declare class ModuleMocker {
private _environmentGlobal;
private _mockState;
@@ -244,10 +267,20 @@ export declare class ModuleMocker {
mocked<T>(item: T, deep?: false): MaybeMocked<T>;
mocked<T>(item: T, deep: true): MaybeMockedDeep<T>;
}
-export declare const fn: <T, Y extends unknown[]>(
- implementation?: ((...args: Y) => T) | undefined,
-) => Mock<T, Y>;
-export declare const spyOn: {
+
+declare type NonFunctionPropertyNames<T> = {
+ [K in keyof T]: T[K] extends (...args: Array<any>) => any ? never : K;
+}[keyof T] &
+ string;
+
+export declare type PropertyKeysOf<T> = {
+ [K in keyof T]: T[K] extends MockableFunction ? never : K;
+}[keyof T];
+
+export declare interface SpyInstance<T, Y extends Array<unknown>>
+ extends MockInstance<T, Y> {}
+
+declare const spyOn_2: {
<T extends {}, M extends NonFunctionPropertyNames<T>>(
object: T,
methodName: M,
@@ -265,8 +298,8 @@ export declare const spyOn: {
? SpyInstance<ReturnType<T_2[M_2]>, Parameters<T_2[M_2]>>
: never;
};
-export declare const mocked: {
- <T>(item: T, deep?: false | undefined): MaybeMocked<T>;
- <T_1>(item: T_1, deep: true): MaybeMockedDeep<T_1>;
-};
+export {spyOn_2 as spyOn};
+
+declare type Unpromisify<T> = T extends Promise<infer R> ? R : never;
+
export {};
diff --git i/packages/jest-phabricator/build/index.d.ts w/packages/jest-phabricator/build/index.d.ts
index 4bfe5fee37..5e78306657 100644
--- i/packages/jest-phabricator/build/index.d.ts
+++ w/packages/jest-phabricator/build/index.d.ts
@@ -5,6 +5,10 @@
* LICENSE file in the root directory of this source tree.
*/
import type {AggregatedResult} from '@jest/test-result';
-export default function PhabricatorProcessor(
+
+declare function PhabricatorProcessor(
results: AggregatedResult,
): AggregatedResult;
+export default PhabricatorProcessor;
+
+export {};
diff --git i/packages/jest-regex-util/build/index.d.ts w/packages/jest-regex-util/build/index.d.ts
index a15e9d4a12..018afa6e6e 100644
--- i/packages/jest-regex-util/build/index.d.ts
+++ w/packages/jest-regex-util/build/index.d.ts
@@ -1,3 +1,9 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
@@ -6,5 +12,9 @@
*
*/
export declare const escapePathForRegex: (dir: string) => string;
+
export declare const escapeStrForRegex: (string: string) => string;
+
export declare const replacePathSepForRegex: (string: string) => string;
+
+export {};
diff --git i/packages/jest-repl/build/cli/args.d.ts w/packages/jest-repl/build/cli/args.d.ts
deleted file mode 100644
index ee66057b78..0000000000
--- i/packages/jest-repl/build/cli/args.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {Options} from 'yargs';
-export declare const usage = 'Usage: $0 [--config=<pathToConfigFile>]';
-export declare const options: Record<string, Options>;
diff --git i/packages/jest-repl/build/cli/index.d.ts w/packages/jest-repl/build/cli/index.d.ts
deleted file mode 100644
index 7ff71b5e8b..0000000000
--- i/packages/jest-repl/build/cli/index.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env node
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-export declare function run(): void;
diff --git i/packages/jest-repl/build/cli/repl.d.ts w/packages/jest-repl/build/cli/repl.d.ts
deleted file mode 100644
index fac0c7e359..0000000000
--- i/packages/jest-repl/build/cli/repl.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export {};
diff --git i/packages/jest-repl/build/cli/runtime-cli.d.ts w/packages/jest-repl/build/cli/runtime-cli.d.ts
deleted file mode 100644
index 4ffe6f3df1..0000000000
--- i/packages/jest-repl/build/cli/runtime-cli.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export declare function run(
- cliArgv?: Config.Argv,
- cliInfo?: Array<string>,
-): Promise<void>;
diff --git i/packages/jest-repl/build/cli/version.d.ts w/packages/jest-repl/build/cli/version.d.ts
deleted file mode 100644
index f74a8838d2..0000000000
--- i/packages/jest-repl/build/cli/version.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare const VERSION: string;
diff --git i/packages/jest-repl/build/index.d.ts w/packages/jest-repl/build/index.d.ts
index a4724383c6..9f0de0c44f 100644
--- i/packages/jest-repl/build/index.d.ts
+++ w/packages/jest-repl/build/index.d.ts
@@ -4,5 +4,20 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-export {run as repl} from './cli';
-export {run as runtime} from './cli/runtime-cli';
+import type {Config} from '@jest/types';
+
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ */
+export declare function repl(): void;
+
+export declare function runtime(
+ cliArgv?: Config.Argv,
+ cliInfo?: Array<string>,
+): Promise<void>;
+
+export {};
diff --git i/packages/jest-reporters/build/BaseReporter.d.ts w/packages/jest-reporters/build/BaseReporter.d.ts
deleted file mode 100644
index 2dcd3492b9..0000000000
--- i/packages/jest-reporters/build/BaseReporter.d.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {
- AggregatedResult,
- TestCaseResult,
- TestResult,
-} from '@jest/test-result';
-import type {Context, Reporter, ReporterOnStartOptions, Test} from './types';
-export default class BaseReporter implements Reporter {
- private _error?;
- log(message: string): void;
- onRunStart(
- _results?: AggregatedResult,
- _options?: ReporterOnStartOptions,
- ): void;
- onTestCaseResult(_test: Test, _testCaseResult: TestCaseResult): void;
- onTestResult(
- _test?: Test,
- _testResult?: TestResult,
- _results?: AggregatedResult,
- ): void;
- onTestStart(_test?: Test): void;
- onRunComplete(
- _contexts?: Set<Context>,
- _aggregatedResults?: AggregatedResult,
- ): Promise<void> | void;
- protected _setError(error: Error): void;
- getLastError(): Error | undefined;
-}
diff --git i/packages/jest-reporters/build/CoverageReporter.d.ts w/packages/jest-reporters/build/CoverageReporter.d.ts
deleted file mode 100644
index efde425811..0000000000
--- i/packages/jest-reporters/build/CoverageReporter.d.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {AggregatedResult, TestResult} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import BaseReporter from './BaseReporter';
-import type {Context, CoverageReporterOptions, Test} from './types';
-export default class CoverageReporter extends BaseReporter {
- private _coverageMap;
- private _globalConfig;
- private _sourceMapStore;
- private _options;
- private _v8CoverageResults;
- static readonly filename: string;
- constructor(
- globalConfig: Config.GlobalConfig,
- options?: CoverageReporterOptions,
- );
- onTestResult(_test: Test, testResult: TestResult): void;
- onRunComplete(
- contexts: Set<Context>,
- aggregatedResults: AggregatedResult,
- ): Promise<void>;
- private _addUntestedFiles;
- private _checkThreshold;
- private _getCoverageResult;
-}
diff --git i/packages/jest-reporters/build/CoverageWorker.d.ts w/packages/jest-reporters/build/CoverageWorker.d.ts
deleted file mode 100644
index afff186e51..0000000000
--- i/packages/jest-reporters/build/CoverageWorker.d.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import {CoverageWorkerResult} from './generateEmptyCoverage';
-import type {CoverageReporterSerializedOptions} from './types';
-export declare type CoverageWorkerData = {
- globalConfig: Config.GlobalConfig;
- config: Config.ProjectConfig;
- path: Config.Path;
- options?: CoverageReporterSerializedOptions;
-};
-export type {CoverageWorkerResult};
-export declare function worker({
- config,
- globalConfig,
- path,
- options,
-}: CoverageWorkerData): Promise<CoverageWorkerResult | null>;
diff --git i/packages/jest-reporters/build/DefaultReporter.d.ts w/packages/jest-reporters/build/DefaultReporter.d.ts
deleted file mode 100644
index b77eb363e0..0000000000
--- i/packages/jest-reporters/build/DefaultReporter.d.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {
- AggregatedResult,
- TestCaseResult,
- TestResult,
-} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import BaseReporter from './BaseReporter';
-import type {ReporterOnStartOptions, Test} from './types';
-export default class DefaultReporter extends BaseReporter {
- private _clear;
- private _err;
- protected _globalConfig: Config.GlobalConfig;
- private _out;
- private _status;
- private _bufferedOutput;
- static readonly filename: string;
- constructor(globalConfig: Config.GlobalConfig);
- protected __wrapStdio(
- stream: NodeJS.WritableStream | NodeJS.WriteStream,
- ): void;
- forceFlushBufferedOutput(): void;
- protected __clearStatus(): void;
- protected __printStatus(): void;
- onRunStart(
- aggregatedResults: AggregatedResult,
- options: ReporterOnStartOptions,
- ): void;
- onTestStart(test: Test): void;
- onTestCaseResult(test: Test, testCaseResult: TestCaseResult): void;
- onRunComplete(): void;
- onTestResult(
- test: Test,
- testResult: TestResult,
- aggregatedResults: AggregatedResult,
- ): void;
- testFinished(
- config: Config.ProjectConfig,
- testResult: TestResult,
- aggregatedResults: AggregatedResult,
- ): void;
- printTestFileHeader(
- _testPath: Config.Path,
- config: Config.ProjectConfig,
- result: TestResult,
- ): void;
- printTestFileFailureMessage(
- _testPath: Config.Path,
- _config: Config.ProjectConfig,
- result: TestResult,
- ): void;
-}
diff --git i/packages/jest-reporters/build/NotifyReporter.d.ts w/packages/jest-reporters/build/NotifyReporter.d.ts
deleted file mode 100644
index 6c1270e603..0000000000
--- i/packages/jest-reporters/build/NotifyReporter.d.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {AggregatedResult} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import BaseReporter from './BaseReporter';
-import type {Context, TestSchedulerContext} from './types';
-export default class NotifyReporter extends BaseReporter {
- private _notifier;
- private _startRun;
- private _globalConfig;
- private _context;
- static readonly filename: string;
- constructor(
- globalConfig: Config.GlobalConfig,
- startRun: (globalConfig: Config.GlobalConfig) => unknown,
- context: TestSchedulerContext,
- );
- onRunComplete(contexts: Set<Context>, result: AggregatedResult): void;
-}
diff --git i/packages/jest-reporters/build/Status.d.ts w/packages/jest-reporters/build/Status.d.ts
deleted file mode 100644
index 8653163777..0000000000
--- i/packages/jest-reporters/build/Status.d.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {
- AggregatedResult,
- TestCaseResult,
- TestResult,
-} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import type {ReporterOnStartOptions, Test} from './types';
-declare type Cache = {
- content: string;
- clear: string;
-};
-/**
- * A class that generates the CLI status of currently running tests
- * and also provides an ANSI escape sequence to remove status lines
- * from the terminal.
- */
-export default class Status {
- private _cache;
- private _callback?;
- private _currentTests;
- private _currentTestCases;
- private _done;
- private _emitScheduled;
- private _estimatedTime;
- private _interval?;
- private _aggregatedResults?;
- private _showStatus;
- constructor();
- onChange(callback: () => void): void;
- runStarted(
- aggregatedResults: AggregatedResult,
- options: ReporterOnStartOptions,
- ): void;
- runFinished(): void;
- addTestCaseResult(test: Test, testCaseResult: TestCaseResult): void;
- testStarted(testPath: Config.Path, config: Config.ProjectConfig): void;
- testFinished(
- _config: Config.ProjectConfig,
- testResult: TestResult,
- aggregatedResults: AggregatedResult,
- ): void;
- get(): Cache;
- private _emit;
- private _debouncedEmit;
- private _tick;
-}
-export {};
diff --git i/packages/jest-reporters/build/SummaryReporter.d.ts w/packages/jest-reporters/build/SummaryReporter.d.ts
deleted file mode 100644
index 85b41ed564..0000000000
--- i/packages/jest-reporters/build/SummaryReporter.d.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {AggregatedResult} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import BaseReporter from './BaseReporter';
-import type {Context, ReporterOnStartOptions} from './types';
-export default class SummaryReporter extends BaseReporter {
- private _estimatedTime;
- private _globalConfig;
- static readonly filename: string;
- constructor(globalConfig: Config.GlobalConfig);
- private _write;
- onRunStart(
- aggregatedResults: AggregatedResult,
- options: ReporterOnStartOptions,
- ): void;
- onRunComplete(
- contexts: Set<Context>,
- aggregatedResults: AggregatedResult,
- ): void;
- private _printSnapshotSummary;
- private _printSummary;
- private _getTestSummary;
-}
diff --git i/packages/jest-reporters/build/VerboseReporter.d.ts w/packages/jest-reporters/build/VerboseReporter.d.ts
deleted file mode 100644
index 1fb9e245f9..0000000000
--- i/packages/jest-reporters/build/VerboseReporter.d.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {
- AggregatedResult,
- AssertionResult,
- Suite,
- TestResult,
-} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import DefaultReporter from './DefaultReporter';
-import type {Test} from './types';
-export default class VerboseReporter extends DefaultReporter {
- protected _globalConfig: Config.GlobalConfig;
- static readonly filename: string;
- constructor(globalConfig: Config.GlobalConfig);
- protected __wrapStdio(
- stream: NodeJS.WritableStream | NodeJS.WriteStream,
- ): void;
- static filterTestResults(
- testResults: Array<AssertionResult>,
- ): Array<AssertionResult>;
- static groupTestsBySuites(testResults: Array<AssertionResult>): Suite;
- onTestResult(
- test: Test,
- result: TestResult,
- aggregatedResults: AggregatedResult,
- ): void;
- private _logTestResults;
- private _logSuite;
- private _getIcon;
- private _logTest;
- private _logTests;
- private _logTodoOrPendingTest;
- private _logLine;
-}
diff --git i/packages/jest-reporters/build/generateEmptyCoverage.d.ts w/packages/jest-reporters/build/generateEmptyCoverage.d.ts
deleted file mode 100644
index 5d18f501dc..0000000000
--- i/packages/jest-reporters/build/generateEmptyCoverage.d.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {V8Coverage} from 'collect-v8-coverage';
-import {FileCoverage} from 'istanbul-lib-coverage';
-import type {Config} from '@jest/types';
-declare type SingleV8Coverage = V8Coverage[number];
-export declare type CoverageWorkerResult =
- | {
- kind: 'BabelCoverage';
- coverage: FileCoverage;
- }
- | {
- kind: 'V8Coverage';
- result: SingleV8Coverage;
- };
-export default function generateEmptyCoverage(
- source: string,
- filename: Config.Path,
- globalConfig: Config.GlobalConfig,
- config: Config.ProjectConfig,
- changedFiles?: Set<Config.Path>,
- sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>,
-): Promise<CoverageWorkerResult | null>;
-export {};
diff --git i/packages/jest-reporters/build/getResultHeader.d.ts w/packages/jest-reporters/build/getResultHeader.d.ts
deleted file mode 100644
index 374736ea8c..0000000000
--- i/packages/jest-reporters/build/getResultHeader.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {TestResult} from '@jest/test-result';
-import type {Config} from '@jest/types';
-export default function getResultHeader(
- result: TestResult,
- globalConfig: Config.GlobalConfig,
- projectConfig?: Config.ProjectConfig,
-): string;
diff --git i/packages/jest-reporters/build/getSnapshotStatus.d.ts w/packages/jest-reporters/build/getSnapshotStatus.d.ts
deleted file mode 100644
index 97c97f308e..0000000000
--- i/packages/jest-reporters/build/getSnapshotStatus.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {TestResult} from '@jest/test-result';
-export default function getSnapshotStatus(
- snapshot: TestResult['snapshot'],
- afterUpdate: boolean,
-): Array<string>;
diff --git i/packages/jest-reporters/build/getSnapshotSummary.d.ts w/packages/jest-reporters/build/getSnapshotSummary.d.ts
deleted file mode 100644
index 0dd0f81107..0000000000
--- i/packages/jest-reporters/build/getSnapshotSummary.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {SnapshotSummary} from '@jest/test-result';
-import type {Config} from '@jest/types';
-export default function getSnapshotSummary(
- snapshots: SnapshotSummary,
- globalConfig: Config.GlobalConfig,
- updateCommand: string,
-): Array<string>;
diff --git i/packages/jest-reporters/build/getWatermarks.d.ts w/packages/jest-reporters/build/getWatermarks.d.ts
deleted file mode 100644
index faae4722da..0000000000
--- i/packages/jest-reporters/build/getWatermarks.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import istanbulReport = require('istanbul-lib-report');
-import type {Config} from '@jest/types';
-export default function getWatermarks(
- config: Config.GlobalConfig,
-): istanbulReport.Watermarks;
diff --git i/packages/jest-reporters/build/index.d.ts w/packages/jest-reporters/build/index.d.ts
index 2bb5414094..7d06a69d12 100644
--- i/packages/jest-reporters/build/index.d.ts
+++ w/packages/jest-reporters/build/index.d.ts
@@ -4,45 +4,235 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-import getResultHeader from './getResultHeader';
-export type {Config} from '@jest/types';
-export type {
- AggregatedResult,
- SnapshotSummary,
- TestResult,
-} from '@jest/test-result';
-export {default as BaseReporter} from './BaseReporter';
-export {default as CoverageReporter} from './CoverageReporter';
-export {default as DefaultReporter} from './DefaultReporter';
-export {default as NotifyReporter} from './NotifyReporter';
-export {default as SummaryReporter} from './SummaryReporter';
-export {default as VerboseReporter} from './VerboseReporter';
-export type {
- Context,
- Reporter,
- ReporterOnStartOptions,
- SummaryOptions,
- Test,
-} from './types';
+/// <reference types="node" />
+
+import {AggregatedResult} from '@jest/test-result';
+import type {AssertionResult} from '@jest/test-result';
+import {Config} from '@jest/types';
+import type {FS} from 'jest-haste-map';
+import {GlobalConfig} from '@jest/types/build/Config';
+import type {ModuleMap} from 'jest-haste-map';
+import {ProjectConfig} from '@jest/types/build/Config';
+import type Resolver from 'jest-resolve';
+import {SnapshotSummary} from '@jest/test-result';
+import type {Suite} from '@jest/test-result';
+import type {TestCaseResult} from '@jest/test-result';
+import {TestResult} from '@jest/test-result';
+
+export {AggregatedResult};
+
+export declare class BaseReporter implements Reporter {
+ private _error?;
+ log(message: string): void;
+ onRunStart(
+ _results?: AggregatedResult,
+ _options?: ReporterOnStartOptions,
+ ): void;
+ onTestCaseResult(_test: Test, _testCaseResult: TestCaseResult): void;
+ onTestResult(
+ _test?: Test,
+ _testResult?: TestResult,
+ _results?: AggregatedResult,
+ ): void;
+ onTestStart(_test?: Test): void;
+ onRunComplete(
+ _contexts?: Set<Context>,
+ _aggregatedResults?: AggregatedResult,
+ ): Promise<void> | void;
+ protected _setError(error: Error): void;
+ getLastError(): Error | undefined;
+}
+
+export {Config};
+
+export declare type Context = {
+ config: Config.ProjectConfig;
+ hasteFS: FS;
+ moduleMap: ModuleMap;
+ resolver: Resolver;
+};
+
+export declare class CoverageReporter extends BaseReporter {
+ private _coverageMap;
+ private _globalConfig;
+ private _sourceMapStore;
+ private _options;
+ private _v8CoverageResults;
+ static readonly filename: string;
+ constructor(
+ globalConfig: Config.GlobalConfig,
+ options?: CoverageReporterOptions,
+ );
+ onTestResult(_test: Test, testResult: TestResult): void;
+ onRunComplete(
+ contexts: Set<Context>,
+ aggregatedResults: AggregatedResult,
+ ): Promise<void>;
+ private _addUntestedFiles;
+ private _checkThreshold;
+ private _getCoverageResult;
+}
+
+declare type CoverageReporterOptions = {
+ changedFiles?: Set<Config.Path>;
+ sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>;
+};
+
+export declare class DefaultReporter extends BaseReporter {
+ private _clear;
+ private _err;
+ protected _globalConfig: Config.GlobalConfig;
+ private _out;
+ private _status;
+ private _bufferedOutput;
+ static readonly filename: string;
+ constructor(globalConfig: Config.GlobalConfig);
+ protected __wrapStdio(
+ stream: NodeJS.WritableStream | NodeJS.WriteStream,
+ ): void;
+ forceFlushBufferedOutput(): void;
+ protected __clearStatus(): void;
+ protected __printStatus(): void;
+ onRunStart(
+ aggregatedResults: AggregatedResult,
+ options: ReporterOnStartOptions,
+ ): void;
+ onTestStart(test: Test): void;
+ onTestCaseResult(test: Test, testCaseResult: TestCaseResult): void;
+ onRunComplete(): void;
+ onTestResult(
+ test: Test,
+ testResult: TestResult,
+ aggregatedResults: AggregatedResult,
+ ): void;
+ testFinished(
+ config: Config.ProjectConfig,
+ testResult: TestResult,
+ aggregatedResults: AggregatedResult,
+ ): void;
+ printTestFileHeader(
+ _testPath: Config.Path,
+ config: Config.ProjectConfig,
+ result: TestResult,
+ ): void;
+ printTestFileFailureMessage(
+ _testPath: Config.Path,
+ _config: Config.ProjectConfig,
+ result: TestResult,
+ ): void;
+}
+
+declare function getResultHeader(
+ result: TestResult,
+ globalConfig: Config.GlobalConfig,
+ projectConfig?: Config.ProjectConfig,
+): string;
+
+export declare class NotifyReporter extends BaseReporter {
+ private _notifier;
+ private _startRun;
+ private _globalConfig;
+ private _context;
+ static readonly filename: string;
+ constructor(
+ globalConfig: Config.GlobalConfig,
+ startRun: (globalConfig: Config.GlobalConfig) => unknown,
+ context: TestSchedulerContext,
+ );
+ onRunComplete(contexts: Set<Context>, result: AggregatedResult): void;
+}
+
+export declare interface Reporter {
+ readonly onTestResult?: (
+ test: Test,
+ testResult: TestResult,
+ aggregatedResult: AggregatedResult,
+ ) => Promise<void> | void;
+ readonly onTestFileResult?: (
+ test: Test,
+ testResult: TestResult,
+ aggregatedResult: AggregatedResult,
+ ) => Promise<void> | void;
+ readonly onTestCaseResult?: (
+ test: Test,
+ testCaseResult: TestCaseResult,
+ ) => Promise<void> | void;
+ readonly onRunStart: (
+ results: AggregatedResult,
+ options: ReporterOnStartOptions,
+ ) => Promise<void> | void;
+ readonly onTestStart?: (test: Test) => Promise<void> | void;
+ readonly onTestFileStart?: (test: Test) => Promise<void> | void;
+ readonly onRunComplete: (
+ contexts: Set<Context>,
+ results: AggregatedResult,
+ ) => Promise<void> | void;
+ readonly getLastError: () => Error | void;
+}
+
+export declare type ReporterOnStartOptions = {
+ estimatedTime: number;
+ showStatus: boolean;
+};
+
+export {SnapshotSummary};
+
+export declare type SummaryOptions = {
+ currentTestCases?: Array<{
+ test: Test;
+ testCaseResult: TestCaseResult;
+ }>;
+ estimatedTime?: number;
+ roundTime?: boolean;
+ width?: number;
+};
+
+export declare class SummaryReporter extends BaseReporter {
+ private _estimatedTime;
+ private _globalConfig;
+ static readonly filename: string;
+ constructor(globalConfig: Config.GlobalConfig);
+ private _write;
+ onRunStart(
+ aggregatedResults: AggregatedResult,
+ options: ReporterOnStartOptions,
+ ): void;
+ onRunComplete(
+ contexts: Set<Context>,
+ aggregatedResults: AggregatedResult,
+ ): void;
+ private _printSnapshotSummary;
+ private _printSummary;
+ private _getTestSummary;
+}
+
+export declare type Test = {
+ context: Context;
+ duration?: number;
+ path: Config.Path;
+};
+
+export {TestResult};
+
+declare type TestSchedulerContext = {
+ firstRun: boolean;
+ previousSuccess: boolean;
+ changedFiles?: Set<Config.Path>;
+};
+
export declare const utils: {
formatTestPath: (
- config:
- | import('@jest/types/build/Config').ProjectConfig
- | import('@jest/types/build/Config').GlobalConfig,
+ config: ProjectConfig | GlobalConfig,
testPath: string,
) => string;
getResultHeader: typeof getResultHeader;
getSummary: (
- aggregatedResults: import('@jest/test-result').AggregatedResult,
- options?: import('./types').SummaryOptions | undefined,
- ) => string;
- printDisplayName: (
- config: import('@jest/types/build/Config').ProjectConfig,
+ aggregatedResults: AggregatedResult,
+ options?: SummaryOptions | undefined,
) => string;
+ printDisplayName: (config: ProjectConfig) => string;
relativePath: (
- config:
- | import('@jest/types/build/Config').ProjectConfig
- | import('@jest/types/build/Config').GlobalConfig,
+ config: ProjectConfig | GlobalConfig,
testPath: string,
) => {
basename: string;
@@ -50,10 +240,35 @@ export declare const utils: {
};
trimAndFormatPath: (
pad: number,
- config:
- | import('@jest/types/build/Config').ProjectConfig
- | import('@jest/types/build/Config').GlobalConfig,
+ config: ProjectConfig | GlobalConfig,
testPath: string,
columns: number,
) => string;
};
+
+export declare class VerboseReporter extends DefaultReporter {
+ protected _globalConfig: Config.GlobalConfig;
+ static readonly filename: string;
+ constructor(globalConfig: Config.GlobalConfig);
+ protected __wrapStdio(
+ stream: NodeJS.WritableStream | NodeJS.WriteStream,
+ ): void;
+ static filterTestResults(
+ testResults: Array<AssertionResult>,
+ ): Array<AssertionResult>;
+ static groupTestsBySuites(testResults: Array<AssertionResult>): Suite;
+ onTestResult(
+ test: Test,
+ result: TestResult,
+ aggregatedResults: AggregatedResult,
+ ): void;
+ private _logTestResults;
+ private _logSuite;
+ private _getIcon;
+ private _logTest;
+ private _logTests;
+ private _logTodoOrPendingTest;
+ private _logLine;
+}
+
+export {};
diff --git i/packages/jest-reporters/build/types.d.ts w/packages/jest-reporters/build/types.d.ts
deleted file mode 100644
index a76e96f547..0000000000
--- i/packages/jest-reporters/build/types.d.ts
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {
- AggregatedResult,
- SerializableError,
- TestCaseResult,
- TestResult,
-} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import type {FS as HasteFS, ModuleMap} from 'jest-haste-map';
-import type Resolver from 'jest-resolve';
-import type {worker} from './CoverageWorker';
-export declare type ReporterOnStartOptions = {
- estimatedTime: number;
- showStatus: boolean;
-};
-export declare type Context = {
- config: Config.ProjectConfig;
- hasteFS: HasteFS;
- moduleMap: ModuleMap;
- resolver: Resolver;
-};
-export declare type Test = {
- context: Context;
- duration?: number;
- path: Config.Path;
-};
-export declare type CoverageWorker = {
- worker: typeof worker;
-};
-export declare type CoverageReporterOptions = {
- changedFiles?: Set<Config.Path>;
- sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>;
-};
-export declare type CoverageReporterSerializedOptions = {
- changedFiles?: Array<Config.Path>;
- sourcesRelatedToTestsInChangedFiles?: Array<Config.Path>;
-};
-export declare type OnTestStart = (test: Test) => Promise<void>;
-export declare type OnTestFailure = (
- test: Test,
- error: SerializableError,
-) => Promise<unknown>;
-export declare type OnTestSuccess = (
- test: Test,
- result: TestResult,
-) => Promise<unknown>;
-export interface Reporter {
- readonly onTestResult?: (
- test: Test,
- testResult: TestResult,
- aggregatedResult: AggregatedResult,
- ) => Promise<void> | void;
- readonly onTestFileResult?: (
- test: Test,
- testResult: TestResult,
- aggregatedResult: AggregatedResult,
- ) => Promise<void> | void;
- readonly onTestCaseResult?: (
- test: Test,
- testCaseResult: TestCaseResult,
- ) => Promise<void> | void;
- readonly onRunStart: (
- results: AggregatedResult,
- options: ReporterOnStartOptions,
- ) => Promise<void> | void;
- readonly onTestStart?: (test: Test) => Promise<void> | void;
- readonly onTestFileStart?: (test: Test) => Promise<void> | void;
- readonly onRunComplete: (
- contexts: Set<Context>,
- results: AggregatedResult,
- ) => Promise<void> | void;
- readonly getLastError: () => Error | void;
-}
-export declare type SummaryOptions = {
- currentTestCases?: Array<{
- test: Test;
- testCaseResult: TestCaseResult;
- }>;
- estimatedTime?: number;
- roundTime?: boolean;
- width?: number;
-};
-export declare type TestRunnerOptions = {
- serial: boolean;
-};
-export declare type TestRunData = Array<{
- context: Context;
- matches: {
- allTests: number;
- tests: Array<Test>;
- total: number;
- };
-}>;
-export declare type TestSchedulerContext = {
- firstRun: boolean;
- previousSuccess: boolean;
- changedFiles?: Set<Config.Path>;
-};
diff --git i/packages/jest-reporters/build/utils.d.ts w/packages/jest-reporters/build/utils.d.ts
deleted file mode 100644
index f4fc31882f..0000000000
--- i/packages/jest-reporters/build/utils.d.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {AggregatedResult} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import type {SummaryOptions} from './types';
-export declare const printDisplayName: (config: Config.ProjectConfig) => string;
-export declare const trimAndFormatPath: (
- pad: number,
- config: Config.ProjectConfig | Config.GlobalConfig,
- testPath: Config.Path,
- columns: number,
-) => string;
-export declare const formatTestPath: (
- config: Config.GlobalConfig | Config.ProjectConfig,
- testPath: Config.Path,
-) => string;
-export declare const relativePath: (
- config: Config.GlobalConfig | Config.ProjectConfig,
- testPath: Config.Path,
-) => {
- basename: string;
- dirname: string;
-};
-export declare const getSummary: (
- aggregatedResults: AggregatedResult,
- options?: SummaryOptions | undefined,
-) => string;
-export declare const wrapAnsiString: (
- string: string,
- terminalWidth: number,
-) => string;
diff --git i/packages/jest-resolve-dependencies/build/index.d.ts w/packages/jest-resolve-dependencies/build/index.d.ts
index 34cfe96ecf..6795dc06f4 100644
--- i/packages/jest-resolve-dependencies/build/index.d.ts
+++ w/packages/jest-resolve-dependencies/build/index.d.ts
@@ -5,13 +5,11 @@
* LICENSE file in the root directory of this source tree.
*/
import type {Config} from '@jest/types';
-import type {FS as HasteFS} from 'jest-haste-map';
-import type {ResolveModuleConfig, default as Resolver} from 'jest-resolve';
+import type {default as default_2} from 'jest-resolve';
+import type {FS} from 'jest-haste-map';
+import type {ResolveModuleConfig} from 'jest-resolve';
import {SnapshotResolver} from 'jest-snapshot';
-export declare type ResolvedModule = {
- file: Config.Path;
- dependencies: Array<Config.Path>;
-};
+
/**
* DependencyResolver is used to resolve the direct dependencies of a module or
* to retrieve a list of all transitive inverse dependencies.
@@ -21,8 +19,8 @@ export declare class DependencyResolver {
private _resolver;
private _snapshotResolver;
constructor(
- resolver: Resolver,
- hasteFS: HasteFS,
+ resolver: default_2,
+ hasteFS: FS,
snapshotResolver: SnapshotResolver,
);
resolve(file: Config.Path, options?: ResolveModuleConfig): Array<Config.Path>;
@@ -37,3 +35,10 @@ export declare class DependencyResolver {
options?: ResolveModuleConfig,
): Array<Config.Path>;
}
+
+export declare type ResolvedModule = {
+ file: Config.Path;
+ dependencies: Array<Config.Path>;
+};
+
+export {};
diff --git i/packages/jest-resolve/build/ModuleNotFoundError.d.ts w/packages/jest-resolve/build/ModuleNotFoundError.d.ts
deleted file mode 100644
index c3676e8c79..0000000000
--- i/packages/jest-resolve/build/ModuleNotFoundError.d.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default class ModuleNotFoundError extends Error {
- code: string;
- hint?: string;
- requireStack?: Array<Config.Path>;
- siblingWithSimilarExtensionFound?: boolean;
- moduleName?: string;
- private _originalMessage?;
- constructor(message: string, moduleName?: string);
- buildMessage(rootDir: Config.Path): void;
- static duckType(error: ModuleNotFoundError): ModuleNotFoundError;
-}
diff --git i/packages/jest-resolve/build/defaultResolver.d.ts w/packages/jest-resolve/build/defaultResolver.d.ts
deleted file mode 100644
index ad53abb074..0000000000
--- i/packages/jest-resolve/build/defaultResolver.d.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import {PkgJson} from './fileWalkers';
-interface ResolverOptions {
- basedir: Config.Path;
- browser?: boolean;
- conditions?: Array<string>;
- defaultResolver: typeof defaultResolver;
- extensions?: Array<string>;
- moduleDirectory?: Array<string>;
- paths?: Array<Config.Path>;
- rootDir?: Config.Path;
- packageFilter?: (pkg: PkgJson, dir: string) => PkgJson;
- pathFilter?: (pkg: PkgJson, path: string, relativePath: string) => string;
-}
-declare global {
- namespace NodeJS {
- interface ProcessVersions {
- pnp?: any;
- }
- }
-}
-export default function defaultResolver(
- path: Config.Path,
- options: ResolverOptions,
-): Config.Path;
-export {};
diff --git i/packages/jest-resolve/build/fileWalkers.d.ts w/packages/jest-resolve/build/fileWalkers.d.ts
deleted file mode 100644
index 7c00302f39..0000000000
--- i/packages/jest-resolve/build/fileWalkers.d.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export declare function clearFsCache(): void;
-export declare type PkgJson = Record<string, unknown>;
-export declare function readPackageCached(path: Config.Path): PkgJson;
-export declare function findClosestPackageJson(
- start: Config.Path,
-): Config.Path | undefined;
-export declare function isFile(file: Config.Path): boolean;
-export declare function isDirectory(dir: Config.Path): boolean;
-export declare function realpathSync(file: Config.Path): Config.Path;
diff --git i/packages/jest-resolve/build/index.d.ts w/packages/jest-resolve/build/index.d.ts
index 4bf6ac49f5..46bc2dbef3 100644
--- i/packages/jest-resolve/build/index.d.ts
+++ w/packages/jest-resolve/build/index.d.ts
@@ -4,7 +4,183 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-import Resolver from './resolver';
-export type {ResolveModuleConfig} from './resolver';
-export * from './utils';
+import type {Config} from '@jest/types';
+import type {IModuleMap} from 'jest-haste-map';
+
+declare function cachedShouldLoadAsEsm(
+ path: Config.Path,
+ extensionsToTreatAsEsm: Array<Config.Path>,
+): boolean;
+
+declare type FindNodeModuleConfig = {
+ basedir: Config.Path;
+ browser?: boolean;
+ conditions?: Array<string>;
+ extensions?: Array<string>;
+ moduleDirectory?: Array<string>;
+ paths?: Array<Config.Path>;
+ resolver?: Config.Path | null;
+ rootDir?: Config.Path;
+ throwIfNotFound?: boolean;
+};
+
+declare type ModuleNameMapperConfig = {
+ regex: RegExp;
+ moduleName: string | Array<string>;
+};
+
+declare class ModuleNotFoundError extends Error {
+ code: string;
+ hint?: string;
+ requireStack?: Array<Config.Path>;
+ siblingWithSimilarExtensionFound?: boolean;
+ moduleName?: string;
+ private _originalMessage?;
+ constructor(message: string, moduleName?: string);
+ buildMessage(rootDir: Config.Path): void;
+ static duckType(error: ModuleNotFoundError): ModuleNotFoundError;
+}
+
+export declare type ResolveModuleConfig = {
+ conditions?: Array<string>;
+ skipNodeResolution?: boolean;
+ paths?: Array<Config.Path>;
+};
+
+declare class Resolver {
+ private readonly _options;
+ private readonly _moduleMap;
+ private readonly _moduleIDCache;
+ private readonly _moduleNameCache;
+ private readonly _modulePathCache;
+ private readonly _supportsNativePlatform;
+ constructor(moduleMap: IModuleMap, options: ResolverConfig);
+ static ModuleNotFoundError: typeof ModuleNotFoundError;
+ static tryCastModuleNotFoundError(error: unknown): ModuleNotFoundError | null;
+ static clearDefaultResolverCache(): void;
+ static findNodeModule(
+ path: Config.Path,
+ options: FindNodeModuleConfig,
+ ): Config.Path | null;
+ static unstable_shouldLoadAsEsm: typeof cachedShouldLoadAsEsm;
+ resolveModuleFromDirIfExists(
+ dirname: Config.Path,
+ moduleName: string,
+ options?: ResolveModuleConfig,
+ ): Config.Path | null;
+ resolveModule(
+ from: Config.Path,
+ moduleName: string,
+ options?: ResolveModuleConfig,
+ ): Config.Path;
+ private _isAliasModule;
+ isCoreModule(moduleName: string): boolean;
+ getModule(name: string): Config.Path | null;
+ getModulePath(from: Config.Path, moduleName: string): Config.Path;
+ getPackage(name: string): Config.Path | null;
+ getMockModule(from: Config.Path, name: string): Config.Path | null;
+ getModulePaths(from: Config.Path): Array<Config.Path>;
+ getModuleID(
+ virtualMocks: Map<string, boolean>,
+ from: Config.Path,
+ moduleName?: string,
+ options?: ResolveModuleConfig,
+ ): string;
+ private _getModuleType;
+ private _getAbsolutePath;
+ private _getMockPath;
+ private _getVirtualMockPath;
+ private _isModuleResolved;
+ resolveStubModuleName(
+ from: Config.Path,
+ moduleName: string,
+ ): Config.Path | null;
+}
export default Resolver;
+
+declare type ResolverConfig = {
+ defaultPlatform?: string | null;
+ extensions: Array<string>;
+ hasCoreModules: boolean;
+ moduleDirectories: Array<string>;
+ moduleNameMapper?: Array<ModuleNameMapperConfig> | null;
+ modulePaths?: Array<Config.Path>;
+ platforms?: Array<string>;
+ resolver?: Config.Path | null;
+ rootDir: Config.Path;
+};
+
+/**
+ * Finds the runner to use:
+ *
+ * 1. looks for jest-runner-<name> relative to project.
+ * 1. looks for jest-runner-<name> relative to Jest.
+ * 1. looks for <name> relative to project.
+ * 1. looks for <name> relative to Jest.
+ */
+export declare const resolveRunner: (
+ resolver: string | undefined | null,
+ {
+ filePath,
+ rootDir,
+ requireResolveFunction,
+ }: {
+ filePath: string;
+ rootDir: Config.Path;
+ requireResolveFunction?: ((moduleName: string) => string) | undefined;
+ },
+) => string;
+
+export declare const resolveSequencer: (
+ resolver: string | undefined | null,
+ {
+ filePath,
+ rootDir,
+ requireResolveFunction,
+ }: {
+ filePath: string;
+ rootDir: Config.Path;
+ requireResolveFunction?: ((moduleName: string) => string) | undefined;
+ },
+) => string;
+
+/**
+ * Finds the test environment to use:
+ *
+ * 1. looks for jest-environment-<name> relative to project.
+ * 1. looks for jest-environment-<name> relative to Jest.
+ * 1. looks for <name> relative to project.
+ * 1. looks for <name> relative to Jest.
+ */
+export declare const resolveTestEnvironment: ({
+ rootDir,
+ testEnvironment: filePath,
+ requireResolveFunction,
+}: {
+ rootDir: Config.Path;
+ testEnvironment: string;
+ requireResolveFunction?: ((moduleName: string) => string) | undefined;
+}) => string;
+
+/**
+ * Finds the watch plugins to use:
+ *
+ * 1. looks for jest-watch-<name> relative to project.
+ * 1. looks for jest-watch-<name> relative to Jest.
+ * 1. looks for <name> relative to project.
+ * 1. looks for <name> relative to Jest.
+ */
+export declare const resolveWatchPlugin: (
+ resolver: string | undefined | null,
+ {
+ filePath,
+ rootDir,
+ requireResolveFunction,
+ }: {
+ filePath: string;
+ rootDir: Config.Path;
+ requireResolveFunction?: ((moduleName: string) => string) | undefined;
+ },
+) => string;
+
+export {};
diff --git i/packages/jest-resolve/build/isBuiltinModule.d.ts w/packages/jest-resolve/build/isBuiltinModule.d.ts
deleted file mode 100644
index 70ede3ee9c..0000000000
--- i/packages/jest-resolve/build/isBuiltinModule.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function isBuiltinModule(module: string): boolean;
diff --git i/packages/jest-resolve/build/nodeModulesPaths.d.ts w/packages/jest-resolve/build/nodeModulesPaths.d.ts
deleted file mode 100644
index 64fc6b9262..0000000000
--- i/packages/jest-resolve/build/nodeModulesPaths.d.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- * Adapted from: https://github.com/substack/node-resolve
- */
-import type {Config} from '@jest/types';
-declare type NodeModulesPathsOptions = {
- moduleDirectory?: Array<string>;
- paths?: Array<Config.Path>;
-};
-export default function nodeModulesPaths(
- basedir: Config.Path,
- options: NodeModulesPathsOptions,
-): Array<Config.Path>;
-export {};
diff --git i/packages/jest-resolve/build/resolver.d.ts w/packages/jest-resolve/build/resolver.d.ts
deleted file mode 100644
index 3a3af0752b..0000000000
--- i/packages/jest-resolve/build/resolver.d.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import type {IModuleMap} from 'jest-haste-map';
-import ModuleNotFoundError from './ModuleNotFoundError';
-import shouldLoadAsEsm from './shouldLoadAsEsm';
-import type {ResolverConfig} from './types';
-declare type FindNodeModuleConfig = {
- basedir: Config.Path;
- browser?: boolean;
- conditions?: Array<string>;
- extensions?: Array<string>;
- moduleDirectory?: Array<string>;
- paths?: Array<Config.Path>;
- resolver?: Config.Path | null;
- rootDir?: Config.Path;
- throwIfNotFound?: boolean;
-};
-export declare type ResolveModuleConfig = {
- conditions?: Array<string>;
- skipNodeResolution?: boolean;
- paths?: Array<Config.Path>;
-};
-export default class Resolver {
- private readonly _options;
- private readonly _moduleMap;
- private readonly _moduleIDCache;
- private readonly _moduleNameCache;
- private readonly _modulePathCache;
- private readonly _supportsNativePlatform;
- constructor(moduleMap: IModuleMap, options: ResolverConfig);
- static ModuleNotFoundError: typeof ModuleNotFoundError;
- static tryCastModuleNotFoundError(error: unknown): ModuleNotFoundError | null;
- static clearDefaultResolverCache(): void;
- static findNodeModule(
- path: Config.Path,
- options: FindNodeModuleConfig,
- ): Config.Path | null;
- static unstable_shouldLoadAsEsm: typeof shouldLoadAsEsm;
- resolveModuleFromDirIfExists(
- dirname: Config.Path,
- moduleName: string,
- options?: ResolveModuleConfig,
- ): Config.Path | null;
- resolveModule(
- from: Config.Path,
- moduleName: string,
- options?: ResolveModuleConfig,
- ): Config.Path;
- private _isAliasModule;
- isCoreModule(moduleName: string): boolean;
- getModule(name: string): Config.Path | null;
- getModulePath(from: Config.Path, moduleName: string): Config.Path;
- getPackage(name: string): Config.Path | null;
- getMockModule(from: Config.Path, name: string): Config.Path | null;
- getModulePaths(from: Config.Path): Array<Config.Path>;
- getModuleID(
- virtualMocks: Map<string, boolean>,
- from: Config.Path,
- moduleName?: string,
- options?: ResolveModuleConfig,
- ): string;
- private _getModuleType;
- private _getAbsolutePath;
- private _getMockPath;
- private _getVirtualMockPath;
- private _isModuleResolved;
- resolveStubModuleName(
- from: Config.Path,
- moduleName: string,
- ): Config.Path | null;
-}
-export {};
diff --git i/packages/jest-resolve/build/shouldLoadAsEsm.d.ts w/packages/jest-resolve/build/shouldLoadAsEsm.d.ts
deleted file mode 100644
index 8acf24185c..0000000000
--- i/packages/jest-resolve/build/shouldLoadAsEsm.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export declare function clearCachedLookups(): void;
-export default function cachedShouldLoadAsEsm(
- path: Config.Path,
- extensionsToTreatAsEsm: Array<Config.Path>,
-): boolean;
diff --git i/packages/jest-resolve/build/types.d.ts w/packages/jest-resolve/build/types.d.ts
deleted file mode 100644
index bb94fd760d..0000000000
--- i/packages/jest-resolve/build/types.d.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export declare type ResolverConfig = {
- defaultPlatform?: string | null;
- extensions: Array<string>;
- hasCoreModules: boolean;
- moduleDirectories: Array<string>;
- moduleNameMapper?: Array<ModuleNameMapperConfig> | null;
- modulePaths?: Array<Config.Path>;
- platforms?: Array<string>;
- resolver?: Config.Path | null;
- rootDir: Config.Path;
-};
-declare type ModuleNameMapperConfig = {
- regex: RegExp;
- moduleName: string | Array<string>;
-};
-export {};
diff --git i/packages/jest-resolve/build/utils.d.ts w/packages/jest-resolve/build/utils.d.ts
deleted file mode 100644
index 2236e11298..0000000000
--- i/packages/jest-resolve/build/utils.d.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-/**
- * Finds the test environment to use:
- *
- * 1. looks for jest-environment-<name> relative to project.
- * 1. looks for jest-environment-<name> relative to Jest.
- * 1. looks for <name> relative to project.
- * 1. looks for <name> relative to Jest.
- */
-export declare const resolveTestEnvironment: ({
- rootDir,
- testEnvironment: filePath,
- requireResolveFunction,
-}: {
- rootDir: Config.Path;
- testEnvironment: string;
- requireResolveFunction?: ((moduleName: string) => string) | undefined;
-}) => string;
-/**
- * Finds the watch plugins to use:
- *
- * 1. looks for jest-watch-<name> relative to project.
- * 1. looks for jest-watch-<name> relative to Jest.
- * 1. looks for <name> relative to project.
- * 1. looks for <name> relative to Jest.
- */
-export declare const resolveWatchPlugin: (
- resolver: string | undefined | null,
- {
- filePath,
- rootDir,
- requireResolveFunction,
- }: {
- filePath: string;
- rootDir: Config.Path;
- requireResolveFunction?: ((moduleName: string) => string) | undefined;
- },
-) => string;
-/**
- * Finds the runner to use:
- *
- * 1. looks for jest-runner-<name> relative to project.
- * 1. looks for jest-runner-<name> relative to Jest.
- * 1. looks for <name> relative to project.
- * 1. looks for <name> relative to Jest.
- */
-export declare const resolveRunner: (
- resolver: string | undefined | null,
- {
- filePath,
- rootDir,
- requireResolveFunction,
- }: {
- filePath: string;
- rootDir: Config.Path;
- requireResolveFunction?: ((moduleName: string) => string) | undefined;
- },
-) => string;
-export declare const resolveSequencer: (
- resolver: string | undefined | null,
- {
- filePath,
- rootDir,
- requireResolveFunction,
- }: {
- filePath: string;
- rootDir: Config.Path;
- requireResolveFunction?: ((moduleName: string) => string) | undefined;
- },
-) => string;
diff --git i/packages/jest-runner/build/index.d.ts w/packages/jest-runner/build/index.d.ts
index b91a035281..1a0ee961d3 100644
--- i/packages/jest-runner/build/index.d.ts
+++ w/packages/jest-runner/build/index.d.ts
@@ -4,27 +4,33 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-import Emittery = require('emittery');
-import type {Test, TestEvents} from '@jest/test-result';
import type {Config} from '@jest/types';
-import type {
- OnTestFailure,
- OnTestStart,
- OnTestSuccess,
- TestRunnerContext,
- TestRunnerOptions,
- TestWatcher,
-} from './types';
-export type {Test, TestFileEvent, TestEvents} from '@jest/test-result';
-export type {
- OnTestFailure,
- OnTestStart,
- OnTestSuccess,
- TestWatcher,
- TestRunnerContext,
- TestRunnerOptions,
-} from './types';
-export default class TestRunner {
+import Emittery = require('emittery');
+import type {SerializableError} from '@jest/test-result';
+import {Test} from '@jest/test-result';
+import {TestEvents} from '@jest/test-result';
+import {TestFileEvent} from '@jest/test-result';
+import type {TestResult} from '@jest/test-result';
+
+export declare type OnTestFailure = (
+ test: Test,
+ serializableError: SerializableError,
+) => Promise<void>;
+
+export declare type OnTestStart = (test: Test) => Promise<void>;
+
+export declare type OnTestSuccess = (
+ test: Test,
+ testResult: TestResult,
+) => Promise<void>;
+
+export {Test};
+
+export {TestEvents};
+
+export {TestFileEvent};
+
+declare class TestRunner {
private readonly _globalConfig;
private readonly _context;
private readonly eventEmitter;
@@ -46,3 +52,29 @@ export default class TestRunner {
listener: (eventData: TestEvents[Name]) => void | Promise<void>,
): Emittery.UnsubscribeFn;
}
+export default TestRunner;
+
+export declare type TestRunnerContext = {
+ changedFiles?: Set<Config.Path>;
+ sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>;
+};
+
+export declare type TestRunnerOptions = {
+ serial: boolean;
+};
+
+export declare interface TestWatcher
+ extends Emittery<{
+ change: WatcherState;
+ }> {
+ state: WatcherState;
+ setState(state: WatcherState): void;
+ isInterrupted(): boolean;
+ isWatchMode(): boolean;
+}
+
+declare type WatcherState = {
+ interrupted: boolean;
+};
+
+export {};
diff --git i/packages/jest-runner/build/runTest.d.ts w/packages/jest-runner/build/runTest.d.ts
deleted file mode 100644
index fec8abcbdc..0000000000
--- i/packages/jest-runner/build/runTest.d.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {TestFileEvent, TestResult} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import Resolver from 'jest-resolve';
-import type {TestRunnerContext} from './types';
-export default function runTest(
- path: Config.Path,
- globalConfig: Config.GlobalConfig,
- config: Config.ProjectConfig,
- resolver: Resolver,
- context?: TestRunnerContext,
- sendMessageToJest?: TestFileEvent,
-): Promise<TestResult>;
diff --git i/packages/jest-runner/build/testWorker.d.ts w/packages/jest-runner/build/testWorker.d.ts
deleted file mode 100644
index 0740041813..0000000000
--- i/packages/jest-runner/build/testWorker.d.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {TestResult} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import {SerializableModuleMap} from 'jest-haste-map';
-import type {TestRunnerSerializedContext} from './types';
-export declare type SerializableResolver = {
- config: Config.ProjectConfig;
- serializableModuleMap: SerializableModuleMap;
-};
-declare type WorkerData = {
- config: Config.ProjectConfig;
- globalConfig: Config.GlobalConfig;
- path: Config.Path;
- context?: TestRunnerSerializedContext;
-};
-export declare function setup(setupData: {
- serializableResolvers: Array<SerializableResolver>;
-}): void;
-export declare function worker({
- config,
- globalConfig,
- path,
- context,
-}: WorkerData): Promise<TestResult>;
-export {};
diff --git i/packages/jest-runner/build/types.d.ts w/packages/jest-runner/build/types.d.ts
deleted file mode 100644
index e41d5dc5c9..0000000000
--- i/packages/jest-runner/build/types.d.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type Emittery = require('emittery');
-import type {JestEnvironment} from '@jest/environment';
-import type {
- SerializableError,
- Test,
- TestFileEvent,
- TestResult,
-} from '@jest/test-result';
-import type {Config} from '@jest/types';
-import type RuntimeType from 'jest-runtime';
-export declare type ErrorWithCode = Error & {
- code?: string;
-};
-export declare type OnTestStart = (test: Test) => Promise<void>;
-export declare type OnTestFailure = (
- test: Test,
- serializableError: SerializableError,
-) => Promise<void>;
-export declare type OnTestSuccess = (
- test: Test,
- testResult: TestResult,
-) => Promise<void>;
-export declare type TestFramework = (
- globalConfig: Config.GlobalConfig,
- config: Config.ProjectConfig,
- environment: JestEnvironment,
- runtime: RuntimeType,
- testPath: string,
- sendMessageToJest?: TestFileEvent,
-) => Promise<TestResult>;
-export declare type TestRunnerOptions = {
- serial: boolean;
-};
-export declare type TestRunnerContext = {
- changedFiles?: Set<Config.Path>;
- sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>;
-};
-export declare type TestRunnerSerializedContext = {
- changedFiles?: Array<Config.Path>;
- sourcesRelatedToTestsInChangedFiles?: Array<Config.Path>;
-};
-declare type WatcherState = {
- interrupted: boolean;
-};
-export interface TestWatcher
- extends Emittery<{
- change: WatcherState;
- }> {
- state: WatcherState;
- setState(state: WatcherState): void;
- isInterrupted(): boolean;
- isWatchMode(): boolean;
-}
-export {};
diff --git i/packages/jest-runtime/build/helpers.d.ts w/packages/jest-runtime/build/helpers.d.ts
deleted file mode 100644
index 54dd1243ea..0000000000
--- i/packages/jest-runtime/build/helpers.d.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export declare const createOutsideJestVmPath: (path: string) => string;
-export declare const decodePossibleOutsideJestVmPath: (
- outsideJestVmPath: string,
-) => string | undefined;
-export declare const findSiblingsWithFileExtension: (
- moduleFileExtensions: Config.ProjectConfig['moduleFileExtensions'],
- from: Config.Path,
- moduleName: string,
-) => string;
diff --git i/packages/jest-runtime/build/index.d.ts w/packages/jest-runtime/build/index.d.ts
index d05111cb82..ebc6cb755b 100644
--- i/packages/jest-runtime/build/index.d.ts
+++ w/packages/jest-runtime/build/index.d.ts
@@ -4,25 +4,28 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
+import {CallerTransformOptions} from '@jest/transform';
+import type {Config} from '@jest/types';
+import type {FS} from 'jest-haste-map';
+import HasteMap from 'jest-haste-map';
+import type {IModuleMap} from 'jest-haste-map';
import type {JestEnvironment} from '@jest/environment';
import type * as JestGlobals from '@jest/globals';
+import type {ModuleMap} from 'jest-haste-map';
+import Resolver from 'jest-resolve';
+import {ScriptTransformer} from '@jest/transform';
+import {shouldInstrument} from '@jest/transform';
+import {ShouldInstrumentOptions} from '@jest/transform';
import type {SourceMapRegistry} from '@jest/source-map';
import type {V8CoverageResult} from '@jest/test-result';
-import {
- CallerTransformOptions,
- ScriptTransformer,
- ShouldInstrumentOptions,
- shouldInstrument,
-} from '@jest/transform';
-import type {Config, Global} from '@jest/types';
-import type {IModuleMap} from 'jest-haste-map';
-import HasteMap from 'jest-haste-map';
-import Resolver from 'jest-resolve';
-import type {Context} from './types';
-export type {Context} from './types';
-interface JestGlobals extends Global.TestFrameworkGlobals {
- expect: typeof JestGlobals.expect;
-}
+
+export declare type Context = {
+ config: Config.ProjectConfig;
+ hasteFS: FS;
+ moduleMap: ModuleMap;
+ resolver: Resolver;
+};
+
declare type HasteMapOptions = {
console?: Console;
maxWorkers: number;
@@ -30,10 +33,13 @@ declare type HasteMapOptions = {
watch?: boolean;
watchman: boolean;
};
-interface InternalModuleOptions extends Required<CallerTransformOptions> {
+
+declare interface InternalModuleOptions
+ extends Required<CallerTransformOptions> {
isInternalModule: boolean;
}
-export default class Runtime {
+
+declare class Runtime {
private readonly _cacheFS;
private readonly _config;
private readonly _coverageOptions;
@@ -172,3 +178,6 @@ export default class Runtime {
private readFile;
setGlobalsForRuntime(globals: JestGlobals): void;
}
+export default Runtime;
+
+export {};
diff --git i/packages/jest-runtime/build/types.d.ts w/packages/jest-runtime/build/types.d.ts
deleted file mode 100644
index e944112cbf..0000000000
--- i/packages/jest-runtime/build/types.d.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import type {FS as HasteFS, ModuleMap} from 'jest-haste-map';
-import type Resolver from 'jest-resolve';
-export declare type Context = {
- config: Config.ProjectConfig;
- hasteFS: HasteFS;
- moduleMap: ModuleMap;
- resolver: Resolver;
-};
diff --git i/packages/jest-serializer/build/index.d.ts w/packages/jest-serializer/build/index.d.ts
index 2e9f8511dd..ce703f31cf 100644
--- i/packages/jest-serializer/build/index.d.ts
+++ w/packages/jest-serializer/build/index.d.ts
@@ -4,13 +4,8 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-/// <reference path="../v8.d.ts" />
/// <reference types="node" />
-declare type Path = string;
-export declare function deserialize(buffer: Buffer): unknown;
-export declare function serialize(content: unknown): Buffer;
-export declare function readFileSync(filePath: Path): unknown;
-export declare function writeFileSync(filePath: Path, content: unknown): void;
+
declare const _default: {
deserialize: typeof deserialize;
readFileSync: typeof readFileSync;
@@ -18,3 +13,17 @@ declare const _default: {
writeFileSync: typeof writeFileSync;
};
export default _default;
+
+export declare function deserialize(buffer: Buffer): unknown;
+
+/// <reference path="../v8.d.ts" />
+
+declare type Path = string;
+
+export declare function readFileSync(filePath: Path): unknown;
+
+export declare function serialize(content: unknown): Buffer;
+
+export declare function writeFileSync(filePath: Path, content: unknown): void;
+
+export {};
diff --git i/packages/jest-snapshot/build/InlineSnapshots.d.ts w/packages/jest-snapshot/build/InlineSnapshots.d.ts
deleted file mode 100644
index 3b59e0ebeb..0000000000
--- i/packages/jest-snapshot/build/InlineSnapshots.d.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Expression} from '@babel/types';
-import type {Config} from '@jest/types';
-import type {Frame} from 'jest-message-util';
-export declare type InlineSnapshot = {
- snapshot: string;
- frame: Frame;
- node?: Expression;
-};
-export declare function saveInlineSnapshots(
- snapshots: Array<InlineSnapshot>,
- prettierPath: Config.Path,
-): void;
diff --git i/packages/jest-snapshot/build/SnapshotResolver.d.ts w/packages/jest-snapshot/build/SnapshotResolver.d.ts
deleted file mode 100644
index af171b519b..0000000000
--- i/packages/jest-snapshot/build/SnapshotResolver.d.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export declare type SnapshotResolver = {
- testPathForConsistencyCheck: string;
- resolveSnapshotPath(testPath: Config.Path, extension?: string): Config.Path;
- resolveTestPath(snapshotPath: Config.Path, extension?: string): Config.Path;
-};
-export declare const EXTENSION = 'snap';
-export declare const DOT_EXTENSION: string;
-export declare const isSnapshotPath: (path: string) => boolean;
-declare type LocalRequire = (module: string) => unknown;
-export declare const buildSnapshotResolver: (
- config: Config.ProjectConfig,
- localRequire?: Promise<LocalRequire> | LocalRequire,
-) => Promise<SnapshotResolver>;
-export {};
diff --git i/packages/jest-snapshot/build/State.d.ts w/packages/jest-snapshot/build/State.d.ts
deleted file mode 100644
index acf9c51655..0000000000
--- i/packages/jest-snapshot/build/State.d.ts
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import type {OptionsReceived as PrettyFormatOptions} from 'pretty-format';
-export declare type SnapshotStateOptions = {
- updateSnapshot: Config.SnapshotUpdateState;
- prettierPath: Config.Path;
- expand?: boolean;
- snapshotFormat: PrettyFormatOptions;
-};
-export declare type SnapshotMatchOptions = {
- testName: string;
- received: unknown;
- key?: string;
- inlineSnapshot?: string;
- isInline: boolean;
- error?: Error;
-};
-declare type SnapshotReturnOptions = {
- actual: string;
- count: number;
- expected?: string;
- key: string;
- pass: boolean;
-};
-declare type SaveStatus = {
- deleted: boolean;
- saved: boolean;
-};
-export default class SnapshotState {
- private _counters;
- private _dirty;
- private _index;
- private _updateSnapshot;
- private _snapshotData;
- private _initialData;
- private _snapshotPath;
- private _inlineSnapshots;
- private _uncheckedKeys;
- private _prettierPath;
- private _snapshotFormat;
- added: number;
- expand: boolean;
- matched: number;
- unmatched: number;
- updated: number;
- constructor(snapshotPath: Config.Path, options: SnapshotStateOptions);
- markSnapshotsAsCheckedForTest(testName: string): void;
- private _addSnapshot;
- clear(): void;
- save(): SaveStatus;
- getUncheckedCount(): number;
- getUncheckedKeys(): Array<string>;
- removeUncheckedKeys(): void;
- match({
- testName,
- received,
- key,
- inlineSnapshot,
- isInline,
- error,
- }: SnapshotMatchOptions): SnapshotReturnOptions;
- fail(testName: string, _received: unknown, key?: string): string;
-}
-export {};
diff --git i/packages/jest-snapshot/build/colors.d.ts w/packages/jest-snapshot/build/colors.d.ts
deleted file mode 100644
index 23e290582e..0000000000
--- i/packages/jest-snapshot/build/colors.d.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare const aForeground2 = 90;
-export declare const aBackground2 = 225;
-export declare const bForeground2 = 23;
-export declare const bBackground2 = 195;
-export declare type RGB = [number, number, number];
-export declare const aForeground3: RGB;
-export declare const aBackground3: RGB;
-export declare const bForeground3: RGB;
-export declare const bBackground3: RGB;
diff --git i/packages/jest-snapshot/build/dedentLines.d.ts w/packages/jest-snapshot/build/dedentLines.d.ts
deleted file mode 100644
index 65723923c7..0000000000
--- i/packages/jest-snapshot/build/dedentLines.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare const dedentLines: (
- input: Array<string>,
-) => Array<string> | null;
diff --git i/packages/jest-snapshot/build/index.d.ts w/packages/jest-snapshot/build/index.d.ts
index 0e7d117f5e..da48added7 100644
--- i/packages/jest-snapshot/build/index.d.ts
+++ w/packages/jest-snapshot/build/index.d.ts
@@ -5,19 +5,21 @@
* LICENSE file in the root directory of this source tree.
*/
import type {Config} from '@jest/types';
-import type {FS as HasteFS} from 'jest-haste-map';
-import {SnapshotResolver} from './SnapshotResolver';
-import type {Context, ExpectationResult} from './types';
-export {addSerializer, getSerializers} from './plugins';
-export {
- EXTENSION,
- buildSnapshotResolver,
- isSnapshotPath,
-} from './SnapshotResolver';
-export type {SnapshotResolver} from './SnapshotResolver';
-export {default as SnapshotState} from './State';
+import type {FS} from 'jest-haste-map';
+import type {MatcherState} from 'expect';
+import type {OptionsReceived} from 'pretty-format';
+import {Plugin as Plugin_2} from 'pretty-format';
+import {Plugins} from 'pretty-format';
+
+export declare const addSerializer: (plugin: Plugin_2) => void;
+
+export declare const buildSnapshotResolver: (
+ config: Config.ProjectConfig,
+ localRequire?: Promise<LocalRequire> | LocalRequire,
+) => Promise<SnapshotResolver>;
+
export declare const cleanup: (
- hasteFS: HasteFS,
+ hasteFS: FS,
update: Config.SnapshotUpdateState,
snapshotResolver: SnapshotResolver,
testPathIgnorePatterns?: string[] | undefined,
@@ -25,27 +27,121 @@ export declare const cleanup: (
filesRemoved: number;
filesRemovedList: Array<string>;
};
+
+declare type Context = MatcherState & {
+ snapshotState: SnapshotState;
+};
+
+declare type ExpectationResult = {
+ pass: boolean;
+ message: () => string;
+};
+
+export declare const EXTENSION = 'snap';
+
+export declare const getSerializers: () => Plugins;
+
+export declare const isSnapshotPath: (path: string) => boolean;
+
+declare type LocalRequire = (module: string) => unknown;
+
+declare type SaveStatus = {
+ deleted: boolean;
+ saved: boolean;
+};
+
+declare type SnapshotMatchOptions = {
+ testName: string;
+ received: unknown;
+ key?: string;
+ inlineSnapshot?: string;
+ isInline: boolean;
+ error?: Error;
+};
+
+export declare type SnapshotResolver = {
+ testPathForConsistencyCheck: string;
+ resolveSnapshotPath(testPath: Config.Path, extension?: string): Config.Path;
+ resolveTestPath(snapshotPath: Config.Path, extension?: string): Config.Path;
+};
+
+declare type SnapshotReturnOptions = {
+ actual: string;
+ count: number;
+ expected?: string;
+ key: string;
+ pass: boolean;
+};
+
+export declare class SnapshotState {
+ private _counters;
+ private _dirty;
+ private _index;
+ private _updateSnapshot;
+ private _snapshotData;
+ private _initialData;
+ private _snapshotPath;
+ private _inlineSnapshots;
+ private _uncheckedKeys;
+ private _prettierPath;
+ private _snapshotFormat;
+ added: number;
+ expand: boolean;
+ matched: number;
+ unmatched: number;
+ updated: number;
+ constructor(snapshotPath: Config.Path, options: SnapshotStateOptions);
+ markSnapshotsAsCheckedForTest(testName: string): void;
+ private _addSnapshot;
+ clear(): void;
+ save(): SaveStatus;
+ getUncheckedCount(): number;
+ getUncheckedKeys(): Array<string>;
+ removeUncheckedKeys(): void;
+ match({
+ testName,
+ received,
+ key,
+ inlineSnapshot,
+ isInline,
+ error,
+ }: SnapshotMatchOptions): SnapshotReturnOptions;
+ fail(testName: string, _received: unknown, key?: string): string;
+}
+
+declare type SnapshotStateOptions = {
+ updateSnapshot: Config.SnapshotUpdateState;
+ prettierPath: Config.Path;
+ expand?: boolean;
+ snapshotFormat: OptionsReceived;
+};
+
+export declare const toMatchInlineSnapshot: (
+ this: Context,
+ received: unknown,
+ propertiesOrSnapshot?: string | object | undefined,
+ inlineSnapshot?: string | undefined,
+) => ExpectationResult;
+
export declare const toMatchSnapshot: (
this: Context,
received: unknown,
propertiesOrHint?: string | object | undefined,
hint?: string | undefined,
) => ExpectationResult;
-export declare const toMatchInlineSnapshot: (
+
+export declare const toThrowErrorMatchingInlineSnapshot: (
this: Context,
received: unknown,
- propertiesOrSnapshot?: string | object | undefined,
inlineSnapshot?: string | undefined,
+ fromPromise?: boolean | undefined,
) => ExpectationResult;
+
export declare const toThrowErrorMatchingSnapshot: (
this: Context,
received: unknown,
hint: string | undefined,
fromPromise: boolean,
) => ExpectationResult;
-export declare const toThrowErrorMatchingInlineSnapshot: (
- this: Context,
- received: unknown,
- inlineSnapshot?: string | undefined,
- fromPromise?: boolean | undefined,
-) => ExpectationResult;
+
+export {};
diff --git i/packages/jest-snapshot/build/mockSerializer.d.ts w/packages/jest-snapshot/build/mockSerializer.d.ts
deleted file mode 100644
index eccb4b3afa..0000000000
--- i/packages/jest-snapshot/build/mockSerializer.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {NewPlugin} from 'pretty-format';
-export declare const serialize: NewPlugin['serialize'];
-export declare const test: NewPlugin['test'];
-declare const plugin: NewPlugin;
-export default plugin;
diff --git i/packages/jest-snapshot/build/plugins.d.ts w/packages/jest-snapshot/build/plugins.d.ts
deleted file mode 100644
index 3a8c5449db..0000000000
--- i/packages/jest-snapshot/build/plugins.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import {
- Plugin as PrettyFormatPlugin,
- Plugins as PrettyFormatPlugins,
-} from 'pretty-format';
-export declare const addSerializer: (plugin: PrettyFormatPlugin) => void;
-export declare const getSerializers: () => PrettyFormatPlugins;
diff --git i/packages/jest-snapshot/build/printSnapshot.d.ts w/packages/jest-snapshot/build/printSnapshot.d.ts
deleted file mode 100644
index 33c9ad096b..0000000000
--- i/packages/jest-snapshot/build/printSnapshot.d.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import chalk = require('chalk');
-import {DiffOptionsColor} from 'jest-diff';
-import type {MatchSnapshotConfig} from './types';
-declare type Chalk = chalk.Chalk;
-export declare const getSnapshotColorForChalkInstance: (
- chalkInstance: Chalk,
-) => DiffOptionsColor;
-export declare const getReceivedColorForChalkInstance: (
- chalkInstance: Chalk,
-) => DiffOptionsColor;
-export declare const aSnapshotColor: DiffOptionsColor;
-export declare const bReceivedColor: DiffOptionsColor;
-export declare const noColor: (string: string) => string;
-export declare const HINT_ARG = 'hint';
-export declare const SNAPSHOT_ARG = 'snapshot';
-export declare const PROPERTIES_ARG = 'properties';
-export declare const matcherHintFromConfig: (
- {
- context: {isNot, promise},
- hint,
- inlineSnapshot,
- matcherName,
- properties,
- }: MatchSnapshotConfig,
- isUpdatable: boolean,
-) => string;
-export declare const printExpected: (val: unknown) => string;
-export declare const printReceived: (val: unknown) => string;
-export declare const printPropertiesAndReceived: (
- properties: object,
- received: object,
- expand: boolean,
-) => string;
-export declare const printSnapshotAndReceived: (
- a: string,
- b: string,
- received: unknown,
- expand: boolean,
-) => string;
-export {};
diff --git i/packages/jest-snapshot/build/types.d.ts w/packages/jest-snapshot/build/types.d.ts
deleted file mode 100644
index 0cd22174fd..0000000000
--- i/packages/jest-snapshot/build/types.d.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {MatcherState} from 'expect';
-import type SnapshotState from './State';
-export declare type Context = MatcherState & {
- snapshotState: SnapshotState;
-};
-export declare type MatchSnapshotConfig = {
- context: Context;
- hint?: string;
- inlineSnapshot?: string;
- isInline: boolean;
- matcherName: string;
- properties?: object;
- received: any;
-};
-export declare type SnapshotData = Record<string, string>;
-export declare type ExpectationResult = {
- pass: boolean;
- message: () => string;
-};
diff --git i/packages/jest-snapshot/build/utils.d.ts w/packages/jest-snapshot/build/utils.d.ts
deleted file mode 100644
index d9308a92ce..0000000000
--- i/packages/jest-snapshot/build/utils.d.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import {OptionsReceived as PrettyFormatOptions} from 'pretty-format';
-import type {SnapshotData} from './types';
-export declare const SNAPSHOT_VERSION = '1';
-export declare const SNAPSHOT_GUIDE_LINK = 'https://goo.gl/fbAQLP';
-export declare const SNAPSHOT_VERSION_WARNING: string;
-export declare const testNameToKey: (
- testName: Config.Path,
- count: number,
-) => string;
-export declare const keyToTestName: (key: string) => string;
-export declare const getSnapshotData: (
- snapshotPath: Config.Path,
- update: Config.SnapshotUpdateState,
-) => {
- data: SnapshotData;
- dirty: boolean;
-};
-export declare const addExtraLineBreaks: (string: string) => string;
-export declare const removeExtraLineBreaks: (string: string) => string;
-export declare const removeLinesBeforeExternalMatcherTrap: (
- stack: string,
-) => string;
-export declare const serialize: (
- val: unknown,
- indent?: number,
- formatOverrides?: PrettyFormatOptions,
-) => string;
-export declare const minify: (val: unknown) => string;
-export declare const deserializeString: (stringified: string) => string;
-export declare const escapeBacktickString: (str: string) => string;
-export declare const ensureDirectoryExists: (filePath: Config.Path) => void;
-export declare const saveSnapshotFile: (
- snapshotData: SnapshotData,
- snapshotPath: Config.Path,
-) => void;
-export declare const deepMerge: (target: any, source: any) => any;
diff --git i/packages/jest-source-map/build/getCallsite.d.ts w/packages/jest-source-map/build/getCallsite.d.ts
deleted file mode 100644
index f630b347dc..0000000000
--- i/packages/jest-source-map/build/getCallsite.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import callsites = require('callsites');
-import type {SourceMapRegistry} from './types';
-export default function getCallsite(
- level: number,
- sourceMaps?: SourceMapRegistry | null,
-): callsites.CallSite;
diff --git i/packages/jest-source-map/build/index.d.ts w/packages/jest-source-map/build/index.d.ts
index 836c82a030..cd442162fe 100644
--- i/packages/jest-source-map/build/index.d.ts
+++ w/packages/jest-source-map/build/index.d.ts
@@ -4,5 +4,13 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-export {default as getCallsite} from './getCallsite';
-export type {SourceMapRegistry} from './types';
+import callsites = require('callsites');
+
+export declare function getCallsite(
+ level: number,
+ sourceMaps?: SourceMapRegistry | null,
+): callsites.CallSite;
+
+export declare type SourceMapRegistry = Map<string, string>;
+
+export {};
diff --git i/packages/jest-source-map/build/types.d.ts w/packages/jest-source-map/build/types.d.ts
deleted file mode 100644
index 3910875a0e..0000000000
--- i/packages/jest-source-map/build/types.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare type SourceMapRegistry = Map<string, string>;
diff --git i/packages/jest-test-result/build/formatTestResults.d.ts w/packages/jest-test-result/build/formatTestResults.d.ts
deleted file mode 100644
index 603381767c..0000000000
--- i/packages/jest-test-result/build/formatTestResults.d.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {
- AggregatedResult,
- CodeCoverageFormatter,
- CodeCoverageReporter,
- FormattedTestResults,
-} from './types';
-export default function formatTestResults(
- results: AggregatedResult,
- codeCoverageFormatter?: CodeCoverageFormatter,
- reporter?: CodeCoverageReporter,
-): FormattedTestResults;
diff --git i/packages/jest-test-result/build/helpers.d.ts w/packages/jest-test-result/build/helpers.d.ts
deleted file mode 100644
index d3862e2379..0000000000
--- i/packages/jest-test-result/build/helpers.d.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import type {AggregatedResult, SerializableError, TestResult} from './types';
-export declare const makeEmptyAggregatedTestResult: () => AggregatedResult;
-export declare const buildFailureTestResult: (
- testPath: Config.Path,
- err: SerializableError,
-) => TestResult;
-export declare const addResult: (
- aggregatedResults: AggregatedResult,
- testResult: TestResult,
-) => void;
-export declare const createEmptyTestResult: () => TestResult;
diff --git i/packages/jest-test-result/build/index.d.ts w/packages/jest-test-result/build/index.d.ts
index cba969dc73..5e2d28dc7e 100644
--- i/packages/jest-test-result/build/index.d.ts
+++ w/packages/jest-test-result/build/index.d.ts
@@ -4,30 +4,230 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-export {default as formatTestResults} from './formatTestResults';
-export {
- addResult,
- buildFailureTestResult,
- createEmptyTestResult,
- makeEmptyAggregatedTestResult,
-} from './helpers';
-export type {
- AggregatedResult,
- AssertionLocation,
+import type {Config} from '@jest/types';
+import type {ConsoleBuffer} from '@jest/console';
+import type {CoverageMap} from 'istanbul-lib-coverage';
+import type {CoverageMapData} from 'istanbul-lib-coverage';
+import type {FS} from 'jest-haste-map';
+import type {ModuleMap} from 'jest-haste-map';
+import type Resolver from 'jest-resolve';
+import type {TestResult as TestResult_2} from '@jest/types';
+import type {TransformTypes} from '@jest/types';
+import type {V8Coverage} from 'collect-v8-coverage';
+
+export declare const addResult: (
+ aggregatedResults: AggregatedResult,
+ testResult: TestResult,
+) => void;
+
+export declare type AggregatedResult = AggregatedResultWithoutCoverage & {
+ coverageMap?: CoverageMap | null;
+};
+
+declare type AggregatedResultWithoutCoverage = {
+ numFailedTests: number;
+ numFailedTestSuites: number;
+ numPassedTests: number;
+ numPassedTestSuites: number;
+ numPendingTests: number;
+ numTodoTests: number;
+ numPendingTestSuites: number;
+ numRuntimeErrorTestSuites: number;
+ numTotalTests: number;
+ numTotalTestSuites: number;
+ openHandles: Array<Error>;
+ snapshot: SnapshotSummary;
+ startTime: number;
+ success: boolean;
+ testResults: Array<TestResult>;
+ wasInterrupted: boolean;
+};
+
+export declare type AssertionLocation = {
+ fullName: string;
+ path: string;
+};
+
+export declare type AssertionResult = TestResult_2.AssertionResult;
+
+export declare const buildFailureTestResult: (
+ testPath: Config.Path,
+ err: SerializableError,
+) => TestResult;
+
+declare type Bytes = number;
+
+declare type CodeCoverageFormatter = (
+ coverage: CoverageMapData | null | undefined,
+ reporter: CodeCoverageReporter,
+) => Record<string, unknown> | null | undefined;
+
+declare type CodeCoverageReporter = unknown;
+
+declare type Context = {
+ config: Config.ProjectConfig;
+ hasteFS: FS;
+ moduleMap: ModuleMap;
+ resolver: Resolver;
+};
+
+export declare const createEmptyTestResult: () => TestResult;
+
+export declare type FailedAssertion = {
+ matcherName?: string;
+ message?: string;
+ actual?: unknown;
+ pass?: boolean;
+ passed?: boolean;
+ expected?: unknown;
+ isNot?: boolean;
+ stack?: string;
+ error?: unknown;
+};
+
+declare type FormattedAssertionResult = Pick<
AssertionResult,
- FailedAssertion,
- FormattedTestResults,
- Milliseconds,
- RuntimeTransformResult,
- SerializableError,
- SnapshotSummary,
- Status,
- Suite,
- Test,
- TestEvents,
- TestFileEvent,
- TestResult,
- TestResultsProcessor,
- TestCaseResult,
- V8CoverageResult,
-} from './types';
+ 'ancestorTitles' | 'fullName' | 'location' | 'status' | 'title'
+> & {
+ failureMessages: AssertionResult['failureMessages'] | null;
+};
+
+declare type FormattedTestResult = {
+ message: string;
+ name: string;
+ summary: string;
+ status: 'failed' | 'passed';
+ startTime: number;
+ endTime: number;
+ coverage: unknown;
+ assertionResults: Array<FormattedAssertionResult>;
+};
+
+export declare type FormattedTestResults = {
+ coverageMap?: CoverageMap | null | undefined;
+ numFailedTests: number;
+ numFailedTestSuites: number;
+ numPassedTests: number;
+ numPassedTestSuites: number;
+ numPendingTests: number;
+ numPendingTestSuites: number;
+ numRuntimeErrorTestSuites: number;
+ numTotalTests: number;
+ numTotalTestSuites: number;
+ snapshot: SnapshotSummary;
+ startTime: number;
+ success: boolean;
+ testResults: Array<FormattedTestResult>;
+ wasInterrupted: boolean;
+};
+
+export declare function formatTestResults(
+ results: AggregatedResult,
+ codeCoverageFormatter?: CodeCoverageFormatter,
+ reporter?: CodeCoverageReporter,
+): FormattedTestResults;
+
+export declare const makeEmptyAggregatedTestResult: () => AggregatedResult;
+
+export declare type Milliseconds = TestResult_2.Milliseconds;
+
+export declare interface RuntimeTransformResult
+ extends TransformTypes.TransformResult {
+ wrapperLength: number;
+}
+
+export declare type SerializableError = TestResult_2.SerializableError;
+
+export declare type SnapshotSummary = {
+ added: number;
+ didUpdate: boolean;
+ failure: boolean;
+ filesAdded: number;
+ filesRemoved: number;
+ filesRemovedList: Array<string>;
+ filesUnmatched: number;
+ filesUpdated: number;
+ matched: number;
+ total: number;
+ unchecked: number;
+ uncheckedKeysByFile: Array<UncheckedSnapshot>;
+ unmatched: number;
+ updated: number;
+};
+
+export declare type Status = AssertionResult['status'];
+
+export declare type Suite = {
+ title: string;
+ suites: Array<Suite>;
+ tests: Array<AssertionResult>;
+};
+
+export declare type Test = {
+ context: Context;
+ duration?: number;
+ path: Config.Path;
+};
+
+export declare type TestCaseResult = AssertionResult;
+
+export declare type TestEvents = {
+ 'test-file-start': [Test];
+ 'test-file-success': [Test, TestResult];
+ 'test-file-failure': [Test, SerializableError];
+ 'test-case-result': [Config.Path, AssertionResult];
+};
+
+export declare type TestFileEvent<
+ T extends keyof TestEvents = keyof TestEvents,
+> = (eventName: T, args: TestEvents[T]) => unknown;
+
+export declare type TestResult = {
+ console?: ConsoleBuffer;
+ coverage?: CoverageMapData;
+ displayName?: Config.DisplayName;
+ failureMessage?: string | null;
+ leaks: boolean;
+ memoryUsage?: Bytes;
+ numFailingTests: number;
+ numPassingTests: number;
+ numPendingTests: number;
+ numTodoTests: number;
+ openHandles: Array<Error>;
+ perfStats: {
+ end: Milliseconds;
+ runtime: Milliseconds;
+ slow: boolean;
+ start: Milliseconds;
+ };
+ skipped: boolean;
+ snapshot: {
+ added: number;
+ fileDeleted: boolean;
+ matched: number;
+ unchecked: number;
+ uncheckedKeys: Array<string>;
+ unmatched: number;
+ updated: number;
+ };
+ testExecError?: SerializableError;
+ testFilePath: Config.Path;
+ testResults: Array<AssertionResult>;
+ v8Coverage?: V8CoverageResult;
+};
+
+export declare type TestResultsProcessor = (
+ results: AggregatedResult,
+) => AggregatedResult;
+
+declare type UncheckedSnapshot = {
+ filePath: string;
+ keys: Array<string>;
+};
+
+export declare type V8CoverageResult = Array<{
+ codeTransformResult: RuntimeTransformResult | undefined;
+ result: V8Coverage[number];
+}>;
+
+export {};
diff --git i/packages/jest-test-result/build/types.d.ts w/packages/jest-test-result/build/types.d.ts
deleted file mode 100644
index 5135075596..0000000000
--- i/packages/jest-test-result/build/types.d.ts
+++ /dev/null
@@ -1,181 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {V8Coverage} from 'collect-v8-coverage';
-import type {CoverageMap, CoverageMapData} from 'istanbul-lib-coverage';
-import type {ConsoleBuffer} from '@jest/console';
-import type {Config, TestResult, TransformTypes} from '@jest/types';
-import type {FS as HasteFS, ModuleMap} from 'jest-haste-map';
-import type Resolver from 'jest-resolve';
-export interface RuntimeTransformResult extends TransformTypes.TransformResult {
- wrapperLength: number;
-}
-export declare type V8CoverageResult = Array<{
- codeTransformResult: RuntimeTransformResult | undefined;
- result: V8Coverage[number];
-}>;
-export declare type SerializableError = TestResult.SerializableError;
-export declare type FailedAssertion = {
- matcherName?: string;
- message?: string;
- actual?: unknown;
- pass?: boolean;
- passed?: boolean;
- expected?: unknown;
- isNot?: boolean;
- stack?: string;
- error?: unknown;
-};
-export declare type AssertionLocation = {
- fullName: string;
- path: string;
-};
-export declare type Status = AssertionResult['status'];
-export declare type Bytes = number;
-export declare type Milliseconds = TestResult.Milliseconds;
-export declare type AssertionResult = TestResult.AssertionResult;
-export declare type FormattedAssertionResult = Pick<
- AssertionResult,
- 'ancestorTitles' | 'fullName' | 'location' | 'status' | 'title'
-> & {
- failureMessages: AssertionResult['failureMessages'] | null;
-};
-export declare type AggregatedResultWithoutCoverage = {
- numFailedTests: number;
- numFailedTestSuites: number;
- numPassedTests: number;
- numPassedTestSuites: number;
- numPendingTests: number;
- numTodoTests: number;
- numPendingTestSuites: number;
- numRuntimeErrorTestSuites: number;
- numTotalTests: number;
- numTotalTestSuites: number;
- openHandles: Array<Error>;
- snapshot: SnapshotSummary;
- startTime: number;
- success: boolean;
- testResults: Array<TestResult>;
- wasInterrupted: boolean;
-};
-export declare type AggregatedResult = AggregatedResultWithoutCoverage & {
- coverageMap?: CoverageMap | null;
-};
-export declare type TestResultsProcessor = (
- results: AggregatedResult,
-) => AggregatedResult;
-export declare type Suite = {
- title: string;
- suites: Array<Suite>;
- tests: Array<AssertionResult>;
-};
-export declare type TestCaseResult = AssertionResult;
-export declare type TestResult = {
- console?: ConsoleBuffer;
- coverage?: CoverageMapData;
- displayName?: Config.DisplayName;
- failureMessage?: string | null;
- leaks: boolean;
- memoryUsage?: Bytes;
- numFailingTests: number;
- numPassingTests: number;
- numPendingTests: number;
- numTodoTests: number;
- openHandles: Array<Error>;
- perfStats: {
- end: Milliseconds;
- runtime: Milliseconds;
- slow: boolean;
- start: Milliseconds;
- };
- skipped: boolean;
- snapshot: {
- added: number;
- fileDeleted: boolean;
- matched: number;
- unchecked: number;
- uncheckedKeys: Array<string>;
- unmatched: number;
- updated: number;
- };
- testExecError?: SerializableError;
- testFilePath: Config.Path;
- testResults: Array<AssertionResult>;
- v8Coverage?: V8CoverageResult;
-};
-export declare type FormattedTestResult = {
- message: string;
- name: string;
- summary: string;
- status: 'failed' | 'passed';
- startTime: number;
- endTime: number;
- coverage: unknown;
- assertionResults: Array<FormattedAssertionResult>;
-};
-export declare type FormattedTestResults = {
- coverageMap?: CoverageMap | null | undefined;
- numFailedTests: number;
- numFailedTestSuites: number;
- numPassedTests: number;
- numPassedTestSuites: number;
- numPendingTests: number;
- numPendingTestSuites: number;
- numRuntimeErrorTestSuites: number;
- numTotalTests: number;
- numTotalTestSuites: number;
- snapshot: SnapshotSummary;
- startTime: number;
- success: boolean;
- testResults: Array<FormattedTestResult>;
- wasInterrupted: boolean;
-};
-export declare type CodeCoverageReporter = unknown;
-export declare type CodeCoverageFormatter = (
- coverage: CoverageMapData | null | undefined,
- reporter: CodeCoverageReporter,
-) => Record<string, unknown> | null | undefined;
-export declare type UncheckedSnapshot = {
- filePath: string;
- keys: Array<string>;
-};
-export declare type SnapshotSummary = {
- added: number;
- didUpdate: boolean;
- failure: boolean;
- filesAdded: number;
- filesRemoved: number;
- filesRemovedList: Array<string>;
- filesUnmatched: number;
- filesUpdated: number;
- matched: number;
- total: number;
- unchecked: number;
- uncheckedKeysByFile: Array<UncheckedSnapshot>;
- unmatched: number;
- updated: number;
-};
-export declare type Test = {
- context: Context;
- duration?: number;
- path: Config.Path;
-};
-declare type Context = {
- config: Config.ProjectConfig;
- hasteFS: HasteFS;
- moduleMap: ModuleMap;
- resolver: Resolver;
-};
-export declare type TestEvents = {
- 'test-file-start': [Test];
- 'test-file-success': [Test, TestResult];
- 'test-file-failure': [Test, SerializableError];
- 'test-case-result': [Config.Path, AssertionResult];
-};
-export declare type TestFileEvent<
- T extends keyof TestEvents = keyof TestEvents,
-> = (eventName: T, args: TestEvents[T]) => unknown;
-export {};
diff --git i/packages/jest-test-sequencer/build/index.d.ts w/packages/jest-test-sequencer/build/index.d.ts
index a0ffce1ef5..0e3bd7bd69 100644
--- i/packages/jest-test-sequencer/build/index.d.ts
+++ w/packages/jest-test-sequencer/build/index.d.ts
@@ -4,11 +4,14 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-import type {AggregatedResult, Test} from '@jest/test-result';
+import type {AggregatedResult} from '@jest/test-result';
import type {Context} from 'jest-runtime';
-declare type Cache = {
+import type {Test} from '@jest/test-result';
+
+declare type Cache_2 = {
[key: string]: [0 | 1, number];
};
+
/**
* The TestSequencer will ultimately decide which tests should run first.
* It is responsible for storing and reading from a local cache
@@ -22,10 +25,10 @@ declare type Cache = {
* TestSequencer.cacheResults(tests: Array<Test>, results: AggregatedResult)
* is called to store/update this information on the cache map.
*/
-export default class TestSequencer {
+declare class TestSequencer {
private _cache;
_getCachePath(context: Context): string;
- _getCache(test: Test): Cache;
+ _getCache(test: Test): Cache_2;
/**
* Sorting tests is very important because it has a great impact on the
* user-perceived responsiveness and speed of the test run.
@@ -48,4 +51,6 @@ export default class TestSequencer {
allFailedTests(tests: Array<Test>): Array<Test>;
cacheResults(tests: Array<Test>, results: AggregatedResult): void;
}
+export default TestSequencer;
+
export {};
diff --git i/packages/jest-transform/build/ScriptTransformer.d.ts w/packages/jest-transform/build/ScriptTransformer.d.ts
deleted file mode 100644
index 809f97df6b..0000000000
--- i/packages/jest-transform/build/ScriptTransformer.d.ts
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import type {
- Options,
- ReducedTransformOptions,
- RequireAndTranspileModuleOptions,
- StringMap,
- TransformResult,
-} from './types';
-declare class ScriptTransformer {
- private readonly _config;
- private readonly _cacheFS;
- private readonly _cache;
- private readonly _transformCache;
- private _transformsAreLoaded;
- constructor(_config: Config.ProjectConfig, _cacheFS: StringMap);
- private _buildCacheKeyFromFileInfo;
- private _getCacheKey;
- private _getCacheKeyAsync;
- private _createFolderFromCacheKey;
- private _getFileCachePath;
- private _getFileCachePathAsync;
- private _getTransformPath;
- loadTransformers(): Promise<void>;
- private _getTransformer;
- private _instrumentFile;
- private _buildTransformResult;
- transformSource(
- filepath: Config.Path,
- content: string,
- options: ReducedTransformOptions,
- ): TransformResult;
- transformSourceAsync(
- filepath: Config.Path,
- content: string,
- options: ReducedTransformOptions,
- ): Promise<TransformResult>;
- private _transformAndBuildScriptAsync;
- private _transformAndBuildScript;
- transformAsync(
- filename: Config.Path,
- options: Options,
- fileSource?: string,
- ): Promise<TransformResult>;
- transform(
- filename: Config.Path,
- options: Options,
- fileSource?: string,
- ): TransformResult;
- transformJson(
- filename: Config.Path,
- options: Options,
- fileSource: string,
- ): string;
- requireAndTranspileModule<ModuleType = unknown>(
- moduleName: string,
- callback?: (module: ModuleType) => void | Promise<void>,
- options?: RequireAndTranspileModuleOptions,
- ): Promise<ModuleType>;
- shouldTransform(filename: Config.Path): boolean;
-}
-export declare function createTranspilingRequire(
- config: Config.ProjectConfig,
-): Promise<
- <TModuleType = unknown>(
- resolverPath: string,
- applyInteropRequireDefault?: boolean,
- ) => Promise<TModuleType>
->;
-export declare type TransformerType = ScriptTransformer;
-export declare function createScriptTransformer(
- config: Config.ProjectConfig,
- cacheFS?: StringMap,
-): Promise<TransformerType>;
-export {};
diff --git i/packages/jest-transform/build/enhanceUnexpectedTokenMessage.d.ts w/packages/jest-transform/build/enhanceUnexpectedTokenMessage.d.ts
deleted file mode 100644
index 513941ba61..0000000000
--- i/packages/jest-transform/build/enhanceUnexpectedTokenMessage.d.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-interface ErrorWithCodeFrame extends Error {
- codeFrame?: string;
-}
-export default function handlePotentialSyntaxError(
- e: ErrorWithCodeFrame,
-): ErrorWithCodeFrame;
-export declare function enhanceUnexpectedTokenMessage(e: Error): Error;
-export {};
diff --git i/packages/jest-transform/build/index.d.ts w/packages/jest-transform/build/index.d.ts
index e686961b3a..edad4bdd00 100644
--- i/packages/jest-transform/build/index.d.ts
+++ w/packages/jest-transform/build/index.d.ts
@@ -4,21 +4,218 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-export {
- createScriptTransformer,
- createTranspilingRequire,
-} from './ScriptTransformer';
-export type {TransformerType as ScriptTransformer} from './ScriptTransformer';
-export {default as shouldInstrument} from './shouldInstrument';
-export type {
- CallerTransformOptions,
- Transformer,
- SyncTransformer,
- AsyncTransformer,
- ShouldInstrumentOptions,
- Options as TransformationOptions,
- TransformOptions,
- TransformResult,
- TransformedSource,
-} from './types';
-export {default as handlePotentialSyntaxError} from './enhanceUnexpectedTokenMessage';
+import type {Config} from '@jest/types';
+import type {RawSourceMap} from 'source-map';
+import type {TransformTypes} from '@jest/types';
+
+export declare interface AsyncTransformer<OptionType = unknown> {
+ /**
+ * Indicates if the transformer is capable of instrumenting the code for code coverage.
+ *
+ * If V8 coverage is _not_ active, and this is `true`, Jest will assume the code is instrumented.
+ * If V8 coverage is _not_ active, and this is `false`. Jest will instrument the code returned by this transformer using Babel.
+ */
+ canInstrument?: boolean;
+ createTransformer?: (options?: OptionType) => AsyncTransformer<OptionType>;
+ getCacheKey?: (
+ sourceText: string,
+ sourcePath: Config.Path,
+ options: TransformOptions<OptionType>,
+ ) => string;
+ getCacheKeyAsync?: (
+ sourceText: string,
+ sourcePath: Config.Path,
+ options: TransformOptions<OptionType>,
+ ) => Promise<string>;
+ process?: (
+ sourceText: string,
+ sourcePath: Config.Path,
+ options: TransformOptions<OptionType>,
+ ) => TransformedSource;
+ processAsync: (
+ sourceText: string,
+ sourcePath: Config.Path,
+ options: TransformOptions<OptionType>,
+ ) => Promise<TransformedSource>;
+}
+
+export declare interface CallerTransformOptions {
+ supportsDynamicImport: boolean;
+ supportsExportNamespaceFrom: boolean;
+ supportsStaticESM: boolean;
+ supportsTopLevelAwait: boolean;
+}
+
+export declare function createScriptTransformer(
+ config: Config.ProjectConfig,
+ cacheFS?: StringMap,
+): Promise<ScriptTransformer>;
+
+export declare function createTranspilingRequire(
+ config: Config.ProjectConfig,
+): Promise<
+ <TModuleType = unknown>(
+ resolverPath: string,
+ applyInteropRequireDefault?: boolean,
+ ) => Promise<TModuleType>
+>;
+
+declare interface ErrorWithCodeFrame extends Error {
+ codeFrame?: string;
+}
+
+declare interface FixedRawSourceMap extends Omit<RawSourceMap, 'version'> {
+ version: number;
+}
+
+export declare function handlePotentialSyntaxError(
+ e: ErrorWithCodeFrame,
+): ErrorWithCodeFrame;
+
+declare interface ReducedTransformOptions extends CallerTransformOptions {
+ instrument: boolean;
+}
+
+declare interface RequireAndTranspileModuleOptions
+ extends ReducedTransformOptions {
+ applyInteropRequireDefault: boolean;
+}
+
+export declare type ScriptTransformer = ScriptTransformer_2;
+
+declare class ScriptTransformer_2 {
+ private readonly _config;
+ private readonly _cacheFS;
+ private readonly _cache;
+ private readonly _transformCache;
+ private _transformsAreLoaded;
+ constructor(_config: Config.ProjectConfig, _cacheFS: StringMap);
+ private _buildCacheKeyFromFileInfo;
+ private _getCacheKey;
+ private _getCacheKeyAsync;
+ private _createFolderFromCacheKey;
+ private _getFileCachePath;
+ private _getFileCachePathAsync;
+ private _getTransformPath;
+ loadTransformers(): Promise<void>;
+ private _getTransformer;
+ private _instrumentFile;
+ private _buildTransformResult;
+ transformSource(
+ filepath: Config.Path,
+ content: string,
+ options: ReducedTransformOptions,
+ ): TransformResult;
+ transformSourceAsync(
+ filepath: Config.Path,
+ content: string,
+ options: ReducedTransformOptions,
+ ): Promise<TransformResult>;
+ private _transformAndBuildScriptAsync;
+ private _transformAndBuildScript;
+ transformAsync(
+ filename: Config.Path,
+ options: TransformationOptions,
+ fileSource?: string,
+ ): Promise<TransformResult>;
+ transform(
+ filename: Config.Path,
+ options: TransformationOptions,
+ fileSource?: string,
+ ): TransformResult;
+ transformJson(
+ filename: Config.Path,
+ options: TransformationOptions,
+ fileSource: string,
+ ): string;
+ requireAndTranspileModule<ModuleType = unknown>(
+ moduleName: string,
+ callback?: (module: ModuleType) => void | Promise<void>,
+ options?: RequireAndTranspileModuleOptions,
+ ): Promise<ModuleType>;
+ shouldTransform(filename: Config.Path): boolean;
+}
+
+export declare function shouldInstrument(
+ filename: Config.Path,
+ options: ShouldInstrumentOptions,
+ config: Config.ProjectConfig,
+): boolean;
+
+export declare interface ShouldInstrumentOptions
+ extends Pick<
+ Config.GlobalConfig,
+ | 'collectCoverage'
+ | 'collectCoverageFrom'
+ | 'collectCoverageOnlyFrom'
+ | 'coverageProvider'
+ > {
+ changedFiles?: Set<Config.Path>;
+ sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>;
+}
+
+declare type StringMap = Map<string, string>;
+
+export declare interface SyncTransformer<OptionType = unknown> {
+ /**
+ * Indicates if the transformer is capable of instrumenting the code for code coverage.
+ *
+ * If V8 coverage is _not_ active, and this is `true`, Jest will assume the code is instrumented.
+ * If V8 coverage is _not_ active, and this is `false`. Jest will instrument the code returned by this transformer using Babel.
+ */
+ canInstrument?: boolean;
+ createTransformer?: (options?: OptionType) => SyncTransformer<OptionType>;
+ getCacheKey?: (
+ sourceText: string,
+ sourcePath: Config.Path,
+ options: TransformOptions<OptionType>,
+ ) => string;
+ getCacheKeyAsync?: (
+ sourceText: string,
+ sourcePath: Config.Path,
+ options: TransformOptions<OptionType>,
+ ) => Promise<string>;
+ process: (
+ sourceText: string,
+ sourcePath: Config.Path,
+ options: TransformOptions<OptionType>,
+ ) => TransformedSource;
+ processAsync?: (
+ sourceText: string,
+ sourcePath: Config.Path,
+ options: TransformOptions<OptionType>,
+ ) => Promise<TransformedSource>;
+}
+
+export declare interface TransformationOptions
+ extends ShouldInstrumentOptions,
+ CallerTransformOptions {
+ isInternalModule?: boolean;
+}
+
+export declare type TransformedSource =
+ | {
+ code: string;
+ map?: FixedRawSourceMap | string | null;
+ }
+ | string;
+
+declare type Transformer_2<OptionType = unknown> =
+ | SyncTransformer<OptionType>
+ | AsyncTransformer<OptionType>;
+export {Transformer_2 as Transformer};
+
+export declare interface TransformOptions<OptionType = unknown>
+ extends ReducedTransformOptions {
+ /** a cached file system which is used in jest-runtime - useful to improve performance */
+ cacheFS: StringMap;
+ config: Config.ProjectConfig;
+ /** A stringified version of the configuration - useful in cache busting */
+ configString: string;
+ /** the options passed through Jest's config by the user */
+ transformerConfig: OptionType;
+}
+
+export declare type TransformResult = TransformTypes.TransformResult;
+
+export {};
diff --git i/packages/jest-transform/build/runtimeErrorsAndWarnings.d.ts w/packages/jest-transform/build/runtimeErrorsAndWarnings.d.ts
deleted file mode 100644
index 6c2b1e1a76..0000000000
--- i/packages/jest-transform/build/runtimeErrorsAndWarnings.d.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare const makeInvalidReturnValueError: () => string;
-export declare const makeInvalidSourceMapWarning: (
- filename: string,
- transformPath: string,
-) => string;
-export declare const makeInvalidSyncTransformerError: (
- transformPath: string,
-) => string;
-export declare const makeInvalidTransformerError: (
- transformPath: string,
-) => string;
diff --git i/packages/jest-transform/build/shouldInstrument.d.ts w/packages/jest-transform/build/shouldInstrument.d.ts
deleted file mode 100644
index e7cebb46c8..0000000000
--- i/packages/jest-transform/build/shouldInstrument.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-import type {ShouldInstrumentOptions} from './types';
-export default function shouldInstrument(
- filename: Config.Path,
- options: ShouldInstrumentOptions,
- config: Config.ProjectConfig,
-): boolean;
diff --git i/packages/jest-transform/build/types.d.ts w/packages/jest-transform/build/types.d.ts
deleted file mode 100644
index 209fd6cdad..0000000000
--- i/packages/jest-transform/build/types.d.ts
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {RawSourceMap} from 'source-map';
-import type {Config, TransformTypes} from '@jest/types';
-export interface ShouldInstrumentOptions
- extends Pick<
- Config.GlobalConfig,
- | 'collectCoverage'
- | 'collectCoverageFrom'
- | 'collectCoverageOnlyFrom'
- | 'coverageProvider'
- > {
- changedFiles?: Set<Config.Path>;
- sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>;
-}
-export interface Options
- extends ShouldInstrumentOptions,
- CallerTransformOptions {
- isInternalModule?: boolean;
-}
-interface FixedRawSourceMap extends Omit<RawSourceMap, 'version'> {
- version: number;
-}
-export declare type TransformedSource =
- | {
- code: string;
- map?: FixedRawSourceMap | string | null;
- }
- | string;
-export declare type TransformResult = TransformTypes.TransformResult;
-export interface CallerTransformOptions {
- supportsDynamicImport: boolean;
- supportsExportNamespaceFrom: boolean;
- supportsStaticESM: boolean;
- supportsTopLevelAwait: boolean;
-}
-export interface ReducedTransformOptions extends CallerTransformOptions {
- instrument: boolean;
-}
-export interface RequireAndTranspileModuleOptions
- extends ReducedTransformOptions {
- applyInteropRequireDefault: boolean;
-}
-export declare type StringMap = Map<string, string>;
-export interface TransformOptions<OptionType = unknown>
- extends ReducedTransformOptions {
- /** a cached file system which is used in jest-runtime - useful to improve performance */
- cacheFS: StringMap;
- config: Config.ProjectConfig;
- /** A stringified version of the configuration - useful in cache busting */
- configString: string;
- /** the options passed through Jest's config by the user */
- transformerConfig: OptionType;
-}
-export interface SyncTransformer<OptionType = unknown> {
- /**
- * Indicates if the transformer is capable of instrumenting the code for code coverage.
- *
- * If V8 coverage is _not_ active, and this is `true`, Jest will assume the code is instrumented.
- * If V8 coverage is _not_ active, and this is `false`. Jest will instrument the code returned by this transformer using Babel.
- */
- canInstrument?: boolean;
- createTransformer?: (options?: OptionType) => SyncTransformer<OptionType>;
- getCacheKey?: (
- sourceText: string,
- sourcePath: Config.Path,
- options: TransformOptions<OptionType>,
- ) => string;
- getCacheKeyAsync?: (
- sourceText: string,
- sourcePath: Config.Path,
- options: TransformOptions<OptionType>,
- ) => Promise<string>;
- process: (
- sourceText: string,
- sourcePath: Config.Path,
- options: TransformOptions<OptionType>,
- ) => TransformedSource;
- processAsync?: (
- sourceText: string,
- sourcePath: Config.Path,
- options: TransformOptions<OptionType>,
- ) => Promise<TransformedSource>;
-}
-export interface AsyncTransformer<OptionType = unknown> {
- /**
- * Indicates if the transformer is capable of instrumenting the code for code coverage.
- *
- * If V8 coverage is _not_ active, and this is `true`, Jest will assume the code is instrumented.
- * If V8 coverage is _not_ active, and this is `false`. Jest will instrument the code returned by this transformer using Babel.
- */
- canInstrument?: boolean;
- createTransformer?: (options?: OptionType) => AsyncTransformer<OptionType>;
- getCacheKey?: (
- sourceText: string,
- sourcePath: Config.Path,
- options: TransformOptions<OptionType>,
- ) => string;
- getCacheKeyAsync?: (
- sourceText: string,
- sourcePath: Config.Path,
- options: TransformOptions<OptionType>,
- ) => Promise<string>;
- process?: (
- sourceText: string,
- sourcePath: Config.Path,
- options: TransformOptions<OptionType>,
- ) => TransformedSource;
- processAsync: (
- sourceText: string,
- sourcePath: Config.Path,
- options: TransformOptions<OptionType>,
- ) => Promise<TransformedSource>;
-}
-export declare type Transformer<OptionType = unknown> =
- | SyncTransformer<OptionType>
- | AsyncTransformer<OptionType>;
-export {};
diff --git i/packages/jest-types/build/Circus.d.ts w/packages/jest-types/build/Circus.d.ts
deleted file mode 100644
index 058e0393ac..0000000000
--- i/packages/jest-types/build/Circus.d.ts
+++ /dev/null
@@ -1,218 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type * as Global from './Global';
-declare type Process = NodeJS.Process;
-export declare type DoneFn = Global.DoneFn;
-export declare type BlockFn = Global.BlockFn;
-export declare type BlockName = Global.BlockName;
-export declare type BlockMode = void | 'skip' | 'only' | 'todo';
-export declare type TestMode = BlockMode;
-export declare type TestName = Global.TestName;
-export declare type TestFn = Global.TestFn;
-export declare type HookFn = Global.HookFn;
-export declare type AsyncFn = TestFn | HookFn;
-export declare type SharedHookType = 'afterAll' | 'beforeAll';
-export declare type HookType = SharedHookType | 'afterEach' | 'beforeEach';
-export declare type TestContext = Global.TestContext;
-export declare type Exception = any;
-export declare type FormattedError = string;
-export declare type Hook = {
- asyncError: Error;
- fn: HookFn;
- type: HookType;
- parent: DescribeBlock;
- seenDone: boolean;
- timeout: number | undefined | null;
-};
-export interface EventHandler {
- (event: AsyncEvent, state: State): void | Promise<void>;
- (event: SyncEvent, state: State): void;
-}
-export declare type Event = SyncEvent | AsyncEvent;
-interface JestGlobals extends Global.TestFrameworkGlobals {
- expect: unknown;
-}
-export declare type SyncEvent =
- | {
- asyncError: Error;
- mode: BlockMode;
- name: 'start_describe_definition';
- blockName: BlockName;
- }
- | {
- mode: BlockMode;
- name: 'finish_describe_definition';
- blockName: BlockName;
- }
- | {
- asyncError: Error;
- name: 'add_hook';
- hookType: HookType;
- fn: HookFn;
- timeout: number | undefined;
- }
- | {
- asyncError: Error;
- name: 'add_test';
- testName: TestName;
- fn: TestFn;
- mode?: TestMode;
- timeout: number | undefined;
- }
- | {
- name: 'error';
- error: Exception;
- };
-export declare type AsyncEvent =
- | {
- name: 'setup';
- testNamePattern?: string;
- runtimeGlobals: JestGlobals;
- parentProcess: Process;
- }
- | {
- name: 'include_test_location_in_result';
- }
- | {
- name: 'hook_start';
- hook: Hook;
- }
- | {
- name: 'hook_success';
- describeBlock?: DescribeBlock;
- test?: TestEntry;
- hook: Hook;
- }
- | {
- name: 'hook_failure';
- error: string | Exception;
- describeBlock?: DescribeBlock;
- test?: TestEntry;
- hook: Hook;
- }
- | {
- name: 'test_fn_start';
- test: TestEntry;
- }
- | {
- name: 'test_fn_success';
- test: TestEntry;
- }
- | {
- name: 'test_fn_failure';
- error: Exception;
- test: TestEntry;
- }
- | {
- name: 'test_retry';
- test: TestEntry;
- }
- | {
- name: 'test_start';
- test: TestEntry;
- }
- | {
- name: 'test_skip';
- test: TestEntry;
- }
- | {
- name: 'test_todo';
- test: TestEntry;
- }
- | {
- name: 'test_done';
- test: TestEntry;
- }
- | {
- name: 'run_describe_start';
- describeBlock: DescribeBlock;
- }
- | {
- name: 'run_describe_finish';
- describeBlock: DescribeBlock;
- }
- | {
- name: 'run_start';
- }
- | {
- name: 'run_finish';
- }
- | {
- name: 'teardown';
- };
-export declare type MatcherResults = {
- actual: unknown;
- expected: unknown;
- name: string;
- pass: boolean;
-};
-export declare type TestStatus = 'skip' | 'done' | 'todo';
-export declare type TestResult = {
- duration?: number | null;
- errors: Array<FormattedError>;
- errorsDetailed: Array<MatcherResults | unknown>;
- invocations: number;
- status: TestStatus;
- location?: {
- column: number;
- line: number;
- } | null;
- testPath: Array<TestName | BlockName>;
-};
-export declare type RunResult = {
- unhandledErrors: Array<FormattedError>;
- testResults: TestResults;
-};
-export declare type TestResults = Array<TestResult>;
-export declare type GlobalErrorHandlers = {
- uncaughtException: Array<(exception: Exception) => void>;
- unhandledRejection: Array<
- (exception: Exception, promise: Promise<unknown>) => void
- >;
-};
-export declare type State = {
- currentDescribeBlock: DescribeBlock;
- currentlyRunningTest?: TestEntry | null;
- expand?: boolean;
- hasFocusedTests: boolean;
- hasStarted: boolean;
- originalGlobalErrorHandlers?: GlobalErrorHandlers;
- parentProcess: Process | null;
- rootDescribeBlock: DescribeBlock;
- testNamePattern?: RegExp | null;
- testTimeout: number;
- unhandledErrors: Array<Exception>;
- includeTestLocationInResult: boolean;
-};
-export declare type DescribeBlock = {
- type: 'describeBlock';
- children: Array<DescribeBlock | TestEntry>;
- hooks: Array<Hook>;
- mode: BlockMode;
- name: BlockName;
- parent?: DescribeBlock;
- /** @deprecated Please get from `children` array instead */
- tests: Array<TestEntry>;
-};
-export declare type TestError = Exception | [Exception | undefined, Exception];
-export declare type TestEntry = {
- type: 'test';
- asyncError: Exception;
- errors: Array<TestError>;
- fn: TestFn;
- invocations: number;
- mode: TestMode;
- name: TestName;
- parent: DescribeBlock;
- startedAt?: number | null;
- duration?: number | null;
- seenDone: boolean;
- status?: TestStatus | null;
- timeout?: number;
-};
-export {};
diff --git i/packages/jest-types/build/Config.d.ts w/packages/jest-types/build/Config.d.ts
deleted file mode 100644
index a0e6fcd2db..0000000000
--- i/packages/jest-types/build/Config.d.ts
+++ /dev/null
@@ -1,480 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {ForegroundColor} from 'chalk';
-import type {ReportOptions} from 'istanbul-reports';
-import type {Arguments} from 'yargs';
-declare type CoverageProvider = 'babel' | 'v8';
-declare type Timers = 'real' | 'fake' | 'modern' | 'legacy';
-export declare type Path = string;
-export declare type Glob = string;
-export declare type HasteConfig = {
- /** Whether to hash files using SHA-1. */
- computeSha1?: boolean;
- /** The platform to use as the default, e.g. 'ios'. */
- defaultPlatform?: string | null;
- /** Force use of Node's `fs` APIs rather than shelling out to `find` */
- forceNodeFilesystemAPI?: boolean;
- /**
- * Whether to follow symlinks when crawling for files.
- * This options cannot be used in projects which use watchman.
- * Projects with `watchman` set to true will error if this option is set to true.
- */
- enableSymlinks?: boolean;
- /** Path to a custom implementation of Haste. */
- hasteImplModulePath?: string;
- /** All platforms to target, e.g ['ios', 'android']. */
- platforms?: Array<string>;
- /** Whether to throw on error on module collision. */
- throwOnModuleCollision?: boolean;
- /** Custom HasteMap module */
- hasteMapModulePath?: string;
-};
-export declare type CoverageReporterName = keyof ReportOptions;
-export declare type CoverageReporterWithOptions<K = CoverageReporterName> =
- K extends CoverageReporterName
- ? ReportOptions[K] extends never
- ? never
- : [K, Partial<ReportOptions[K]>]
- : never;
-export declare type CoverageReporters = Array<
- CoverageReporterName | CoverageReporterWithOptions
->;
-export declare type ReporterConfig = [string, Record<string, unknown>];
-export declare type TransformerConfig = [string, Record<string, unknown>];
-export interface ConfigGlobals {
- [K: string]: unknown;
-}
-export interface PrettyFormatOptions {}
-export declare type DefaultOptions = {
- automock: boolean;
- bail: number;
- cache: boolean;
- cacheDirectory: Path;
- changedFilesWithAncestor: boolean;
- ci: boolean;
- clearMocks: boolean;
- collectCoverage: boolean;
- coveragePathIgnorePatterns: Array<string>;
- coverageReporters: Array<CoverageReporterName>;
- coverageProvider: CoverageProvider;
- detectLeaks: boolean;
- detectOpenHandles: boolean;
- errorOnDeprecated: boolean;
- expand: boolean;
- extensionsToTreatAsEsm: Array<Path>;
- forceCoverageMatch: Array<Glob>;
- globals: ConfigGlobals;
- haste: HasteConfig;
- injectGlobals: boolean;
- listTests: boolean;
- maxConcurrency: number;
- maxWorkers: number | string;
- moduleDirectories: Array<string>;
- moduleFileExtensions: Array<string>;
- moduleNameMapper: Record<string, string | Array<string>>;
- modulePathIgnorePatterns: Array<string>;
- noStackTrace: boolean;
- notify: boolean;
- notifyMode: NotifyMode;
- passWithNoTests: boolean;
- prettierPath: string;
- resetMocks: boolean;
- resetModules: boolean;
- restoreMocks: boolean;
- roots: Array<Path>;
- runTestsByPath: boolean;
- runner: string;
- setupFiles: Array<Path>;
- setupFilesAfterEnv: Array<Path>;
- skipFilter: boolean;
- slowTestThreshold: number;
- snapshotSerializers: Array<Path>;
- testEnvironment: string;
- testEnvironmentOptions: Record<string, unknown>;
- testFailureExitCode: string | number;
- testLocationInResults: boolean;
- testMatch: Array<Glob>;
- testPathIgnorePatterns: Array<string>;
- testRegex: Array<string>;
- testRunner: string;
- testSequencer: string;
- testURL: string;
- timers: Timers;
- transformIgnorePatterns: Array<Glob>;
- useStderr: boolean;
- watch: boolean;
- watchPathIgnorePatterns: Array<string>;
- watchman: boolean;
-};
-export declare type DisplayName = {
- name: string;
- color: typeof ForegroundColor;
-};
-export declare type InitialOptionsWithRootDir = InitialOptions &
- Required<Pick<InitialOptions, 'rootDir'>>;
-export declare type InitialProjectOptions = Pick<
- InitialOptions & {
- cwd?: string;
- },
- keyof ProjectConfig
->;
-export declare type InitialOptions = Partial<{
- automock: boolean;
- bail: boolean | number;
- cache: boolean;
- cacheDirectory: Path;
- ci: boolean;
- clearMocks: boolean;
- changedFilesWithAncestor: boolean;
- changedSince: string;
- collectCoverage: boolean;
- collectCoverageFrom: Array<Glob>;
- collectCoverageOnlyFrom: {
- [key: string]: boolean;
- };
- coverageDirectory: string;
- coveragePathIgnorePatterns: Array<string>;
- coverageProvider: CoverageProvider;
- coverageReporters: CoverageReporters;
- coverageThreshold: CoverageThreshold;
- dependencyExtractor: string;
- detectLeaks: boolean;
- detectOpenHandles: boolean;
- displayName: string | DisplayName;
- expand: boolean;
- extensionsToTreatAsEsm: Array<Path>;
- extraGlobals: Array<string>;
- filter: Path;
- findRelatedTests: boolean;
- forceCoverageMatch: Array<Glob>;
- forceExit: boolean;
- json: boolean;
- globals: ConfigGlobals;
- globalSetup: string | null | undefined;
- globalTeardown: string | null | undefined;
- haste: HasteConfig;
- injectGlobals: boolean;
- reporters: Array<string | ReporterConfig>;
- logHeapUsage: boolean;
- lastCommit: boolean;
- listTests: boolean;
- maxConcurrency: number;
- maxWorkers: number | string;
- moduleDirectories: Array<string>;
- moduleFileExtensions: Array<string>;
- moduleLoader: Path;
- moduleNameMapper: {
- [key: string]: string | Array<string>;
- };
- modulePathIgnorePatterns: Array<string>;
- modulePaths: Array<string>;
- name: string;
- noStackTrace: boolean;
- notify: boolean;
- notifyMode: string;
- onlyChanged: boolean;
- onlyFailures: boolean;
- outputFile: Path;
- passWithNoTests: boolean;
- /**
- * @deprecated Use `transformIgnorePatterns` options instead.
- */
- preprocessorIgnorePatterns: Array<Glob>;
- preset: string | null | undefined;
- prettierPath: string | null | undefined;
- projects: Array<Glob | InitialProjectOptions>;
- replname: string | null | undefined;
- resetMocks: boolean;
- resetModules: boolean;
- resolver: Path | null | undefined;
- restoreMocks: boolean;
- rootDir: Path;
- roots: Array<Path>;
- runner: string;
- runTestsByPath: boolean;
- /**
- * @deprecated Use `transform` options instead.
- */
- scriptPreprocessor: string;
- setupFiles: Array<Path>;
- /**
- * @deprecated Use `setupFilesAfterEnv` options instead.
- */
- setupTestFrameworkScriptFile: Path;
- setupFilesAfterEnv: Array<Path>;
- silent: boolean;
- skipFilter: boolean;
- skipNodeResolution: boolean;
- slowTestThreshold: number;
- snapshotResolver: Path;
- snapshotSerializers: Array<Path>;
- snapshotFormat: PrettyFormatOptions;
- errorOnDeprecated: boolean;
- testEnvironment: string;
- testEnvironmentOptions: Record<string, unknown>;
- testFailureExitCode: string | number;
- testLocationInResults: boolean;
- testMatch: Array<Glob>;
- testNamePattern: string;
- /**
- * @deprecated Use `roots` options instead.
- */
- testPathDirs: Array<Path>;
- testPathIgnorePatterns: Array<string>;
- testRegex: string | Array<string>;
- testResultsProcessor: string;
- testRunner: string;
- testSequencer: string;
- testURL: string;
- testTimeout: number;
- timers: Timers;
- transform: {
- [regex: string]: Path | TransformerConfig;
- };
- transformIgnorePatterns: Array<Glob>;
- watchPathIgnorePatterns: Array<string>;
- unmockedModulePathPatterns: Array<string>;
- updateSnapshot: boolean;
- useStderr: boolean;
- verbose?: boolean;
- watch: boolean;
- watchAll: boolean;
- watchman: boolean;
- watchPlugins: Array<string | [string, Record<string, unknown>]>;
-}>;
-export declare type SnapshotUpdateState = 'all' | 'new' | 'none';
-declare type NotifyMode =
- | 'always'
- | 'failure'
- | 'success'
- | 'change'
- | 'success-change'
- | 'failure-change';
-export declare type CoverageThresholdValue = {
- branches?: number;
- functions?: number;
- lines?: number;
- statements?: number;
-};
-declare type CoverageThreshold = {
- [path: string]: CoverageThresholdValue;
- global: CoverageThresholdValue;
-};
-export declare type GlobalConfig = {
- bail: number;
- changedSince?: string;
- changedFilesWithAncestor: boolean;
- collectCoverage: boolean;
- collectCoverageFrom: Array<Glob>;
- collectCoverageOnlyFrom?: {
- [key: string]: boolean;
- };
- coverageDirectory: string;
- coveragePathIgnorePatterns?: Array<string>;
- coverageProvider: CoverageProvider;
- coverageReporters: CoverageReporters;
- coverageThreshold?: CoverageThreshold;
- detectLeaks: boolean;
- detectOpenHandles: boolean;
- expand: boolean;
- filter?: Path;
- findRelatedTests: boolean;
- forceExit: boolean;
- json: boolean;
- globalSetup?: string;
- globalTeardown?: string;
- lastCommit: boolean;
- logHeapUsage: boolean;
- listTests: boolean;
- maxConcurrency: number;
- maxWorkers: number;
- noStackTrace: boolean;
- nonFlagArgs: Array<string>;
- noSCM?: boolean;
- notify: boolean;
- notifyMode: NotifyMode;
- outputFile?: Path;
- onlyChanged: boolean;
- onlyFailures: boolean;
- passWithNoTests: boolean;
- projects: Array<Glob>;
- replname?: string;
- reporters?: Array<string | ReporterConfig>;
- runTestsByPath: boolean;
- rootDir: Path;
- silent?: boolean;
- skipFilter: boolean;
- snapshotFormat: PrettyFormatOptions;
- errorOnDeprecated: boolean;
- testFailureExitCode: number;
- testNamePattern?: string;
- testPathPattern: string;
- testResultsProcessor?: string;
- testSequencer: string;
- testTimeout?: number;
- updateSnapshot: SnapshotUpdateState;
- useStderr: boolean;
- verbose?: boolean;
- watch: boolean;
- watchAll: boolean;
- watchman: boolean;
- watchPlugins?: Array<{
- path: string;
- config: Record<string, unknown>;
- }> | null;
-};
-export declare type ProjectConfig = {
- automock: boolean;
- cache: boolean;
- cacheDirectory: Path;
- clearMocks: boolean;
- coveragePathIgnorePatterns: Array<string>;
- cwd: Path;
- dependencyExtractor?: string;
- detectLeaks: boolean;
- detectOpenHandles: boolean;
- displayName?: DisplayName;
- errorOnDeprecated: boolean;
- extensionsToTreatAsEsm: Array<Path>;
- extraGlobals: Array<keyof typeof globalThis>;
- filter?: Path;
- forceCoverageMatch: Array<Glob>;
- globalSetup?: string;
- globalTeardown?: string;
- globals: ConfigGlobals;
- haste: HasteConfig;
- injectGlobals: boolean;
- moduleDirectories: Array<string>;
- moduleFileExtensions: Array<string>;
- moduleLoader?: Path;
- moduleNameMapper: Array<[string, string]>;
- modulePathIgnorePatterns: Array<string>;
- modulePaths?: Array<string>;
- name: string;
- prettierPath: string;
- resetMocks: boolean;
- resetModules: boolean;
- resolver?: Path;
- restoreMocks: boolean;
- rootDir: Path;
- roots: Array<Path>;
- runner: string;
- setupFiles: Array<Path>;
- setupFilesAfterEnv: Array<Path>;
- skipFilter: boolean;
- skipNodeResolution?: boolean;
- slowTestThreshold: number;
- snapshotResolver?: Path;
- snapshotSerializers: Array<Path>;
- snapshotFormat: PrettyFormatOptions;
- testEnvironment: string;
- testEnvironmentOptions: Record<string, unknown>;
- testMatch: Array<Glob>;
- testLocationInResults: boolean;
- testPathIgnorePatterns: Array<string>;
- testRegex: Array<string | RegExp>;
- testRunner: string;
- testURL: string;
- timers: Timers;
- transform: Array<[string, Path, Record<string, unknown>]>;
- transformIgnorePatterns: Array<Glob>;
- watchPathIgnorePatterns: Array<string>;
- unmockedModulePathPatterns?: Array<string>;
-};
-export declare type Argv = Arguments<
- Partial<{
- all: boolean;
- automock: boolean;
- bail: boolean | number;
- cache: boolean;
- cacheDirectory: string;
- changedFilesWithAncestor: boolean;
- changedSince: string;
- ci: boolean;
- clearCache: boolean;
- clearMocks: boolean;
- collectCoverage: boolean;
- collectCoverageFrom: string;
- collectCoverageOnlyFrom: Array<string>;
- color: boolean;
- colors: boolean;
- config: string;
- coverage: boolean;
- coverageDirectory: string;
- coveragePathIgnorePatterns: Array<string>;
- coverageReporters: Array<string>;
- coverageThreshold: string;
- debug: boolean;
- env: string;
- expand: boolean;
- findRelatedTests: boolean;
- forceExit: boolean;
- globals: string;
- globalSetup: string | null | undefined;
- globalTeardown: string | null | undefined;
- haste: string;
- init: boolean;
- injectGlobals: boolean;
- json: boolean;
- lastCommit: boolean;
- logHeapUsage: boolean;
- maxWorkers: number | string;
- moduleDirectories: Array<string>;
- moduleFileExtensions: Array<string>;
- moduleNameMapper: string;
- modulePathIgnorePatterns: Array<string>;
- modulePaths: Array<string>;
- noStackTrace: boolean;
- notify: boolean;
- notifyMode: string;
- onlyChanged: boolean;
- onlyFailures: boolean;
- outputFile: string;
- preset: string | null | undefined;
- projects: Array<string>;
- prettierPath: string | null | undefined;
- resetMocks: boolean;
- resetModules: boolean;
- resolver: string | null | undefined;
- restoreMocks: boolean;
- rootDir: string;
- roots: Array<string>;
- runInBand: boolean;
- selectProjects: Array<string>;
- setupFiles: Array<string>;
- setupFilesAfterEnv: Array<string>;
- showConfig: boolean;
- silent: boolean;
- snapshotSerializers: Array<string>;
- testEnvironment: string;
- testEnvironmentOptions: string;
- testFailureExitCode: string | null | undefined;
- testMatch: Array<string>;
- testNamePattern: string;
- testPathIgnorePatterns: Array<string>;
- testPathPattern: Array<string>;
- testRegex: string | Array<string>;
- testResultsProcessor: string;
- testRunner: string;
- testSequencer: string;
- testURL: string;
- testTimeout: number | null | undefined;
- timers: string;
- transform: string;
- transformIgnorePatterns: Array<string>;
- unmockedModulePathPatterns: Array<string> | null | undefined;
- updateSnapshot: boolean;
- useStderr: boolean;
- verbose: boolean;
- version: boolean;
- watch: boolean;
- watchAll: boolean;
- watchman: boolean;
- watchPathIgnorePatterns: Array<string>;
- }>
->;
-export {};
diff --git i/packages/jest-types/build/Global.d.ts w/packages/jest-types/build/Global.d.ts
deleted file mode 100644
index 89af03b0ba..0000000000
--- i/packages/jest-types/build/Global.d.ts
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {CoverageMapData} from 'istanbul-lib-coverage';
-export declare type ValidTestReturnValues = void | undefined;
-declare type TestReturnValuePromise = Promise<unknown>;
-declare type TestReturnValueGenerator = Generator<void, unknown, void>;
-export declare type TestReturnValue =
- | ValidTestReturnValues
- | TestReturnValuePromise;
-export declare type TestContext = Record<string, unknown>;
-export declare type DoneFn = (reason?: string | Error) => void;
-export declare type DoneTakingTestFn = (
- this: TestContext | undefined,
- done: DoneFn,
-) => ValidTestReturnValues;
-export declare type PromiseReturningTestFn = (
- this: TestContext | undefined,
-) => TestReturnValue;
-export declare type GeneratorReturningTestFn = (
- this: TestContext | undefined,
-) => TestReturnValueGenerator;
-export declare type TestName = string;
-export declare type TestFn =
- | PromiseReturningTestFn
- | GeneratorReturningTestFn
- | DoneTakingTestFn;
-export declare type ConcurrentTestFn = () => TestReturnValuePromise;
-export declare type BlockFn = () => void;
-export declare type BlockName = string;
-export declare type HookFn = TestFn;
-export declare type Col = unknown;
-export declare type Row = ReadonlyArray<Col>;
-export declare type Table = ReadonlyArray<Row>;
-export declare type ArrayTable = Table | Row;
-export declare type TemplateTable = TemplateStringsArray;
-export declare type TemplateData = ReadonlyArray<unknown>;
-export declare type EachTable = ArrayTable | TemplateTable;
-export declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn;
-export declare type EachTestFn<EachCallback extends TestCallback> = (
- ...args: ReadonlyArray<any>
-) => ReturnType<EachCallback>;
-declare type Jasmine = {
- _DEFAULT_TIMEOUT_INTERVAL?: number;
- addMatchers: (matchers: Record<string, unknown>) => void;
-};
-declare type Each<EachCallback extends TestCallback> =
- | ((
- table: EachTable,
- ...taggedTemplateData: TemplateData
- ) => (
- name: BlockName | TestName,
- test: EachTestFn<EachCallback>,
- timeout?: number,
- ) => void)
- | (() => () => void);
-export interface HookBase {
- (fn: HookFn, timeout?: number): void;
-}
-export interface ItBase {
- (testName: TestName, fn: TestFn, timeout?: number): void;
- each: Each<TestFn>;
-}
-export interface It extends ItBase {
- only: ItBase;
- skip: ItBase;
- todo: (testName: TestName) => void;
-}
-export interface ItConcurrentBase {
- (testName: TestName, testFn: ConcurrentTestFn, timeout?: number): void;
- each: Each<ConcurrentTestFn>;
-}
-export interface ItConcurrentExtended extends ItConcurrentBase {
- only: ItConcurrentBase;
- skip: ItConcurrentBase;
-}
-export interface ItConcurrent extends It {
- concurrent: ItConcurrentExtended;
-}
-export interface DescribeBase {
- (blockName: BlockName, blockFn: BlockFn): void;
- each: Each<BlockFn>;
-}
-export interface Describe extends DescribeBase {
- only: DescribeBase;
- skip: DescribeBase;
-}
-export interface TestFrameworkGlobals {
- it: ItConcurrent;
- test: ItConcurrent;
- fit: ItBase & {
- concurrent?: ItConcurrentBase;
- };
- xit: ItBase;
- xtest: ItBase;
- describe: Describe;
- xdescribe: DescribeBase;
- fdescribe: DescribeBase;
- beforeAll: HookBase;
- beforeEach: HookBase;
- afterEach: HookBase;
- afterAll: HookBase;
-}
-export interface GlobalAdditions extends TestFrameworkGlobals {
- __coverage__: CoverageMapData;
- jasmine: Jasmine;
- fail: () => void;
- pending: () => void;
- spyOn: () => void;
- spyOnProperty: () => void;
-}
-export interface Global
- extends GlobalAdditions,
- Omit<typeof globalThis, keyof GlobalAdditions> {
- [extras: string]: unknown;
-}
-export {};
diff --git i/packages/jest-types/build/TestResult.d.ts w/packages/jest-types/build/TestResult.d.ts
deleted file mode 100644
index f290b4ee7c..0000000000
--- i/packages/jest-types/build/TestResult.d.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare type Milliseconds = number;
-declare type Status =
- | 'passed'
- | 'failed'
- | 'skipped'
- | 'pending'
- | 'todo'
- | 'disabled';
-declare type Callsite = {
- column: number;
- line: number;
-};
-export declare type AssertionResult = {
- ancestorTitles: Array<string>;
- duration?: Milliseconds | null;
- failureDetails: Array<unknown>;
- failureMessages: Array<string>;
- fullName: string;
- invocations?: number;
- location?: Callsite | null;
- numPassingAsserts: number;
- status: Status;
- title: string;
-};
-export declare type SerializableError = {
- code?: unknown;
- message: string;
- stack: string | null | undefined;
- type?: string;
-};
-export {};
diff --git i/packages/jest-types/build/Transform.d.ts w/packages/jest-types/build/Transform.d.ts
deleted file mode 100644
index 1fbde20bdd..0000000000
--- i/packages/jest-types/build/Transform.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare type TransformResult = {
- code: string;
- originalCode: string;
- sourceMapPath: string | null;
-};
diff --git i/packages/jest-types/build/index.d.ts w/packages/jest-types/build/index.d.ts
index 5a9d361984..9e76b62459 100644
--- i/packages/jest-types/build/index.d.ts
+++ w/packages/jest-types/build/index.d.ts
@@ -4,9 +4,1043 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-import type * as Circus from './Circus';
-import type * as Config from './Config';
-import type * as Global from './Global';
-import type * as TestResult from './TestResult';
-import type * as TransformTypes from './Transform';
-export type {Circus, Config, Global, TestResult, TransformTypes};
+/// <reference types="node" />
+
+import type {Arguments} from 'yargs';
+import type {CoverageMapData} from 'istanbul-lib-coverage';
+import type {ForegroundColor} from 'chalk';
+import type {ReportOptions} from 'istanbul-reports';
+
+declare type Argv = Arguments<
+ Partial<{
+ all: boolean;
+ automock: boolean;
+ bail: boolean | number;
+ cache: boolean;
+ cacheDirectory: string;
+ changedFilesWithAncestor: boolean;
+ changedSince: string;
+ ci: boolean;
+ clearCache: boolean;
+ clearMocks: boolean;
+ collectCoverage: boolean;
+ collectCoverageFrom: string;
+ collectCoverageOnlyFrom: Array<string>;
+ color: boolean;
+ colors: boolean;
+ config: string;
+ coverage: boolean;
+ coverageDirectory: string;
+ coveragePathIgnorePatterns: Array<string>;
+ coverageReporters: Array<string>;
+ coverageThreshold: string;
+ debug: boolean;
+ env: string;
+ expand: boolean;
+ findRelatedTests: boolean;
+ forceExit: boolean;
+ globals: string;
+ globalSetup: string | null | undefined;
+ globalTeardown: string | null | undefined;
+ haste: string;
+ init: boolean;
+ injectGlobals: boolean;
+ json: boolean;
+ lastCommit: boolean;
+ logHeapUsage: boolean;
+ maxWorkers: number | string;
+ moduleDirectories: Array<string>;
+ moduleFileExtensions: Array<string>;
+ moduleNameMapper: string;
+ modulePathIgnorePatterns: Array<string>;
+ modulePaths: Array<string>;
+ noStackTrace: boolean;
+ notify: boolean;
+ notifyMode: string;
+ onlyChanged: boolean;
+ onlyFailures: boolean;
+ outputFile: string;
+ preset: string | null | undefined;
+ projects: Array<string>;
+ prettierPath: string | null | undefined;
+ resetMocks: boolean;
+ resetModules: boolean;
+ resolver: string | null | undefined;
+ restoreMocks: boolean;
+ rootDir: string;
+ roots: Array<string>;
+ runInBand: boolean;
+ selectProjects: Array<string>;
+ setupFiles: Array<string>;
+ setupFilesAfterEnv: Array<string>;
+ showConfig: boolean;
+ silent: boolean;
+ snapshotSerializers: Array<string>;
+ testEnvironment: string;
+ testEnvironmentOptions: string;
+ testFailureExitCode: string | null | undefined;
+ testMatch: Array<string>;
+ testNamePattern: string;
+ testPathIgnorePatterns: Array<string>;
+ testPathPattern: Array<string>;
+ testRegex: string | Array<string>;
+ testResultsProcessor: string;
+ testRunner: string;
+ testSequencer: string;
+ testURL: string;
+ testTimeout: number | null | undefined;
+ timers: string;
+ transform: string;
+ transformIgnorePatterns: Array<string>;
+ unmockedModulePathPatterns: Array<string> | null | undefined;
+ updateSnapshot: boolean;
+ useStderr: boolean;
+ verbose: boolean;
+ version: boolean;
+ watch: boolean;
+ watchAll: boolean;
+ watchman: boolean;
+ watchPathIgnorePatterns: Array<string>;
+ }>
+>;
+
+declare type ArrayTable = Table | Row;
+
+declare type AssertionResult = {
+ ancestorTitles: Array<string>;
+ duration?: Milliseconds | null;
+ failureDetails: Array<unknown>;
+ failureMessages: Array<string>;
+ fullName: string;
+ invocations?: number;
+ location?: Callsite | null;
+ numPassingAsserts: number;
+ status: Status;
+ title: string;
+};
+
+declare type AsyncEvent =
+ | {
+ name: 'setup';
+ testNamePattern?: string;
+ runtimeGlobals: JestGlobals;
+ parentProcess: Process;
+ }
+ | {
+ name: 'include_test_location_in_result';
+ }
+ | {
+ name: 'hook_start';
+ hook: Hook;
+ }
+ | {
+ name: 'hook_success';
+ describeBlock?: DescribeBlock;
+ test?: TestEntry;
+ hook: Hook;
+ }
+ | {
+ name: 'hook_failure';
+ error: string | Exception;
+ describeBlock?: DescribeBlock;
+ test?: TestEntry;
+ hook: Hook;
+ }
+ | {
+ name: 'test_fn_start';
+ test: TestEntry;
+ }
+ | {
+ name: 'test_fn_success';
+ test: TestEntry;
+ }
+ | {
+ name: 'test_fn_failure';
+ error: Exception;
+ test: TestEntry;
+ }
+ | {
+ name: 'test_retry';
+ test: TestEntry;
+ }
+ | {
+ name: 'test_start';
+ test: TestEntry;
+ }
+ | {
+ name: 'test_skip';
+ test: TestEntry;
+ }
+ | {
+ name: 'test_todo';
+ test: TestEntry;
+ }
+ | {
+ name: 'test_done';
+ test: TestEntry;
+ }
+ | {
+ name: 'run_describe_start';
+ describeBlock: DescribeBlock;
+ }
+ | {
+ name: 'run_describe_finish';
+ describeBlock: DescribeBlock;
+ }
+ | {
+ name: 'run_start';
+ }
+ | {
+ name: 'run_finish';
+ }
+ | {
+ name: 'teardown';
+ };
+
+declare type AsyncFn = TestFn_2 | HookFn_2;
+
+declare type BlockFn = () => void;
+
+declare type BlockFn_2 = Global.BlockFn;
+
+declare type BlockMode = void | 'skip' | 'only' | 'todo';
+
+declare type BlockName = string;
+
+declare type BlockName_2 = Global.BlockName;
+
+declare type Callsite = {
+ column: number;
+ line: number;
+};
+
+declare namespace Circus {
+ export {
+ DoneFn,
+ BlockFn_2 as BlockFn,
+ BlockName_2 as BlockName,
+ BlockMode,
+ TestMode,
+ TestName_2 as TestName,
+ TestFn_2 as TestFn,
+ HookFn_2 as HookFn,
+ AsyncFn,
+ SharedHookType,
+ HookType,
+ TestContext_2 as TestContext,
+ Exception,
+ FormattedError,
+ Hook,
+ EventHandler,
+ Event_2 as Event,
+ SyncEvent,
+ AsyncEvent,
+ MatcherResults,
+ TestStatus,
+ TestResult_2 as TestResult,
+ RunResult,
+ TestResults,
+ GlobalErrorHandlers,
+ State,
+ DescribeBlock,
+ TestError,
+ TestEntry,
+ };
+}
+export {Circus};
+
+declare type Col = unknown;
+
+declare type ConcurrentTestFn = () => TestReturnValuePromise;
+
+declare namespace Config {
+ export {
+ Path,
+ Glob,
+ HasteConfig,
+ CoverageReporterName,
+ CoverageReporterWithOptions,
+ CoverageReporters,
+ ReporterConfig,
+ TransformerConfig,
+ ConfigGlobals,
+ PrettyFormatOptions,
+ DefaultOptions,
+ DisplayName,
+ InitialOptionsWithRootDir,
+ InitialProjectOptions,
+ InitialOptions,
+ SnapshotUpdateState,
+ CoverageThresholdValue,
+ GlobalConfig,
+ ProjectConfig,
+ Argv,
+ };
+}
+export {Config};
+
+declare interface ConfigGlobals {
+ [K: string]: unknown;
+}
+
+declare type CoverageProvider = 'babel' | 'v8';
+
+declare type CoverageReporterName = keyof ReportOptions;
+
+declare type CoverageReporters = Array<
+ CoverageReporterName | CoverageReporterWithOptions
+>;
+
+declare type CoverageReporterWithOptions<K = CoverageReporterName> =
+ K extends CoverageReporterName
+ ? ReportOptions[K] extends never
+ ? never
+ : [K, Partial<ReportOptions[K]>]
+ : never;
+
+declare type CoverageThreshold = {
+ [path: string]: CoverageThresholdValue;
+ global: CoverageThresholdValue;
+};
+
+declare type CoverageThresholdValue = {
+ branches?: number;
+ functions?: number;
+ lines?: number;
+ statements?: number;
+};
+
+declare type DefaultOptions = {
+ automock: boolean;
+ bail: number;
+ cache: boolean;
+ cacheDirectory: Path;
+ changedFilesWithAncestor: boolean;
+ ci: boolean;
+ clearMocks: boolean;
+ collectCoverage: boolean;
+ coveragePathIgnorePatterns: Array<string>;
+ coverageReporters: Array<CoverageReporterName>;
+ coverageProvider: CoverageProvider;
+ detectLeaks: boolean;
+ detectOpenHandles: boolean;
+ errorOnDeprecated: boolean;
+ expand: boolean;
+ extensionsToTreatAsEsm: Array<Path>;
+ forceCoverageMatch: Array<Glob>;
+ globals: ConfigGlobals;
+ haste: HasteConfig;
+ injectGlobals: boolean;
+ listTests: boolean;
+ maxConcurrency: number;
+ maxWorkers: number | string;
+ moduleDirectories: Array<string>;
+ moduleFileExtensions: Array<string>;
+ moduleNameMapper: Record<string, string | Array<string>>;
+ modulePathIgnorePatterns: Array<string>;
+ noStackTrace: boolean;
+ notify: boolean;
+ notifyMode: NotifyMode;
+ passWithNoTests: boolean;
+ prettierPath: string;
+ resetMocks: boolean;
+ resetModules: boolean;
+ restoreMocks: boolean;
+ roots: Array<Path>;
+ runTestsByPath: boolean;
+ runner: string;
+ setupFiles: Array<Path>;
+ setupFilesAfterEnv: Array<Path>;
+ skipFilter: boolean;
+ slowTestThreshold: number;
+ snapshotSerializers: Array<Path>;
+ testEnvironment: string;
+ testEnvironmentOptions: Record<string, unknown>;
+ testFailureExitCode: string | number;
+ testLocationInResults: boolean;
+ testMatch: Array<Glob>;
+ testPathIgnorePatterns: Array<string>;
+ testRegex: Array<string>;
+ testRunner: string;
+ testSequencer: string;
+ testURL: string;
+ timers: Timers;
+ transformIgnorePatterns: Array<Glob>;
+ useStderr: boolean;
+ watch: boolean;
+ watchPathIgnorePatterns: Array<string>;
+ watchman: boolean;
+};
+
+declare interface Describe extends DescribeBase {
+ only: DescribeBase;
+ skip: DescribeBase;
+}
+
+declare interface DescribeBase {
+ (blockName: BlockName, blockFn: BlockFn): void;
+ each: Each<BlockFn>;
+}
+
+declare type DescribeBlock = {
+ type: 'describeBlock';
+ children: Array<DescribeBlock | TestEntry>;
+ hooks: Array<Hook>;
+ mode: BlockMode;
+ name: BlockName_2;
+ parent?: DescribeBlock;
+ /** @deprecated Please get from `children` array instead */
+ tests: Array<TestEntry>;
+};
+
+declare type DisplayName = {
+ name: string;
+ color: typeof ForegroundColor;
+};
+
+declare type DoneFn = Global.DoneFn;
+
+declare type DoneFn_2 = (reason?: string | Error) => void;
+
+declare type DoneTakingTestFn = (
+ this: TestContext | undefined,
+ done: DoneFn_2,
+) => ValidTestReturnValues;
+
+declare type Each<EachCallback extends TestCallback> =
+ | ((
+ table: EachTable,
+ ...taggedTemplateData: TemplateData
+ ) => (
+ name: BlockName | TestName,
+ test: EachTestFn<EachCallback>,
+ timeout?: number,
+ ) => void)
+ | (() => () => void);
+
+declare type EachTable = ArrayTable | TemplateTable;
+
+declare type EachTestFn<EachCallback extends TestCallback> = (
+ ...args: ReadonlyArray<any>
+) => ReturnType<EachCallback>;
+
+declare type Event_2 = SyncEvent | AsyncEvent;
+
+declare interface EventHandler {
+ (event: AsyncEvent, state: State): void | Promise<void>;
+ (event: SyncEvent, state: State): void;
+}
+
+declare type Exception = any;
+
+declare type FormattedError = string;
+
+declare type GeneratorReturningTestFn = (
+ this: TestContext | undefined,
+) => TestReturnValueGenerator;
+
+declare type Glob = string;
+
+declare namespace Global {
+ export {
+ ValidTestReturnValues,
+ TestReturnValue,
+ TestContext,
+ DoneFn_2 as DoneFn,
+ DoneTakingTestFn,
+ PromiseReturningTestFn,
+ GeneratorReturningTestFn,
+ TestName,
+ TestFn,
+ ConcurrentTestFn,
+ BlockFn,
+ BlockName,
+ HookFn,
+ Col,
+ Row,
+ Table,
+ ArrayTable,
+ TemplateTable,
+ TemplateData,
+ EachTable,
+ TestCallback,
+ EachTestFn,
+ HookBase,
+ ItBase,
+ It,
+ ItConcurrentBase,
+ ItConcurrentExtended,
+ ItConcurrent,
+ DescribeBase,
+ Describe,
+ TestFrameworkGlobals,
+ GlobalAdditions,
+ Global_2 as Global,
+ };
+}
+export {Global};
+
+declare interface Global_2
+ extends GlobalAdditions,
+ Omit<typeof globalThis, keyof GlobalAdditions> {
+ [extras: string]: unknown;
+}
+
+declare interface GlobalAdditions extends TestFrameworkGlobals {
+ __coverage__: CoverageMapData;
+ jasmine: Jasmine;
+ fail: () => void;
+ pending: () => void;
+ spyOn: () => void;
+ spyOnProperty: () => void;
+}
+
+declare type GlobalConfig = {
+ bail: number;
+ changedSince?: string;
+ changedFilesWithAncestor: boolean;
+ collectCoverage: boolean;
+ collectCoverageFrom: Array<Glob>;
+ collectCoverageOnlyFrom?: {
+ [key: string]: boolean;
+ };
+ coverageDirectory: string;
+ coveragePathIgnorePatterns?: Array<string>;
+ coverageProvider: CoverageProvider;
+ coverageReporters: CoverageReporters;
+ coverageThreshold?: CoverageThreshold;
+ detectLeaks: boolean;
+ detectOpenHandles: boolean;
+ expand: boolean;
+ filter?: Path;
+ findRelatedTests: boolean;
+ forceExit: boolean;
+ json: boolean;
+ globalSetup?: string;
+ globalTeardown?: string;
+ lastCommit: boolean;
+ logHeapUsage: boolean;
+ listTests: boolean;
+ maxConcurrency: number;
+ maxWorkers: number;
+ noStackTrace: boolean;
+ nonFlagArgs: Array<string>;
+ noSCM?: boolean;
+ notify: boolean;
+ notifyMode: NotifyMode;
+ outputFile?: Path;
+ onlyChanged: boolean;
+ onlyFailures: boolean;
+ passWithNoTests: boolean;
+ projects: Array<Glob>;
+ replname?: string;
+ reporters?: Array<string | ReporterConfig>;
+ runTestsByPath: boolean;
+ rootDir: Path;
+ silent?: boolean;
+ skipFilter: boolean;
+ snapshotFormat: PrettyFormatOptions;
+ errorOnDeprecated: boolean;
+ testFailureExitCode: number;
+ testNamePattern?: string;
+ testPathPattern: string;
+ testResultsProcessor?: string;
+ testSequencer: string;
+ testTimeout?: number;
+ updateSnapshot: SnapshotUpdateState;
+ useStderr: boolean;
+ verbose?: boolean;
+ watch: boolean;
+ watchAll: boolean;
+ watchman: boolean;
+ watchPlugins?: Array<{
+ path: string;
+ config: Record<string, unknown>;
+ }> | null;
+};
+
+declare type GlobalErrorHandlers = {
+ uncaughtException: Array<(exception: Exception) => void>;
+ unhandledRejection: Array<
+ (exception: Exception, promise: Promise<unknown>) => void
+ >;
+};
+
+declare type HasteConfig = {
+ /** Whether to hash files using SHA-1. */
+ computeSha1?: boolean;
+ /** The platform to use as the default, e.g. 'ios'. */
+ defaultPlatform?: string | null;
+ /** Force use of Node's `fs` APIs rather than shelling out to `find` */
+ forceNodeFilesystemAPI?: boolean;
+ /**
+ * Whether to follow symlinks when crawling for files.
+ * This options cannot be used in projects which use watchman.
+ * Projects with `watchman` set to true will error if this option is set to true.
+ */
+ enableSymlinks?: boolean;
+ /** Path to a custom implementation of Haste. */
+ hasteImplModulePath?: string;
+ /** All platforms to target, e.g ['ios', 'android']. */
+ platforms?: Array<string>;
+ /** Whether to throw on error on module collision. */
+ throwOnModuleCollision?: boolean;
+ /** Custom HasteMap module */
+ hasteMapModulePath?: string;
+};
+
+declare type Hook = {
+ asyncError: Error;
+ fn: HookFn_2;
+ type: HookType;
+ parent: DescribeBlock;
+ seenDone: boolean;
+ timeout: number | undefined | null;
+};
+
+declare interface HookBase {
+ (fn: HookFn, timeout?: number): void;
+}
+
+declare type HookFn = TestFn;
+
+declare type HookFn_2 = Global.HookFn;
+
+declare type HookType = SharedHookType | 'afterEach' | 'beforeEach';
+
+declare type InitialOptions = Partial<{
+ automock: boolean;
+ bail: boolean | number;
+ cache: boolean;
+ cacheDirectory: Path;
+ ci: boolean;
+ clearMocks: boolean;
+ changedFilesWithAncestor: boolean;
+ changedSince: string;
+ collectCoverage: boolean;
+ collectCoverageFrom: Array<Glob>;
+ collectCoverageOnlyFrom: {
+ [key: string]: boolean;
+ };
+ coverageDirectory: string;
+ coveragePathIgnorePatterns: Array<string>;
+ coverageProvider: CoverageProvider;
+ coverageReporters: CoverageReporters;
+ coverageThreshold: CoverageThreshold;
+ dependencyExtractor: string;
+ detectLeaks: boolean;
+ detectOpenHandles: boolean;
+ displayName: string | DisplayName;
+ expand: boolean;
+ extensionsToTreatAsEsm: Array<Path>;
+ extraGlobals: Array<string>;
+ filter: Path;
+ findRelatedTests: boolean;
+ forceCoverageMatch: Array<Glob>;
+ forceExit: boolean;
+ json: boolean;
+ globals: ConfigGlobals;
+ globalSetup: string | null | undefined;
+ globalTeardown: string | null | undefined;
+ haste: HasteConfig;
+ injectGlobals: boolean;
+ reporters: Array<string | ReporterConfig>;
+ logHeapUsage: boolean;
+ lastCommit: boolean;
+ listTests: boolean;
+ maxConcurrency: number;
+ maxWorkers: number | string;
+ moduleDirectories: Array<string>;
+ moduleFileExtensions: Array<string>;
+ moduleLoader: Path;
+ moduleNameMapper: {
+ [key: string]: string | Array<string>;
+ };
+ modulePathIgnorePatterns: Array<string>;
+ modulePaths: Array<string>;
+ name: string;
+ noStackTrace: boolean;
+ notify: boolean;
+ notifyMode: string;
+ onlyChanged: boolean;
+ onlyFailures: boolean;
+ outputFile: Path;
+ passWithNoTests: boolean;
+ /**
+ * @deprecated Use `transformIgnorePatterns` options instead.
+ */
+ preprocessorIgnorePatterns: Array<Glob>;
+ preset: string | null | undefined;
+ prettierPath: string | null | undefined;
+ projects: Array<Glob | InitialProjectOptions>;
+ replname: string | null | undefined;
+ resetMocks: boolean;
+ resetModules: boolean;
+ resolver: Path | null | undefined;
+ restoreMocks: boolean;
+ rootDir: Path;
+ roots: Array<Path>;
+ runner: string;
+ runTestsByPath: boolean;
+ /**
+ * @deprecated Use `transform` options instead.
+ */
+ scriptPreprocessor: string;
+ setupFiles: Array<Path>;
+ /**
+ * @deprecated Use `setupFilesAfterEnv` options instead.
+ */
+ setupTestFrameworkScriptFile: Path;
+ setupFilesAfterEnv: Array<Path>;
+ silent: boolean;
+ skipFilter: boolean;
+ skipNodeResolution: boolean;
+ slowTestThreshold: number;
+ snapshotResolver: Path;
+ snapshotSerializers: Array<Path>;
+ snapshotFormat: PrettyFormatOptions;
+ errorOnDeprecated: boolean;
+ testEnvironment: string;
+ testEnvironmentOptions: Record<string, unknown>;
+ testFailureExitCode: string | number;
+ testLocationInResults: boolean;
+ testMatch: Array<Glob>;
+ testNamePattern: string;
+ /**
+ * @deprecated Use `roots` options instead.
+ */
+ testPathDirs: Array<Path>;
+ testPathIgnorePatterns: Array<string>;
+ testRegex: string | Array<string>;
+ testResultsProcessor: string;
+ testRunner: string;
+ testSequencer: string;
+ testURL: string;
+ testTimeout: number;
+ timers: Timers;
+ transform: {
+ [regex: string]: Path | TransformerConfig;
+ };
+ transformIgnorePatterns: Array<Glob>;
+ watchPathIgnorePatterns: Array<string>;
+ unmockedModulePathPatterns: Array<string>;
+ updateSnapshot: boolean;
+ useStderr: boolean;
+ verbose?: boolean;
+ watch: boolean;
+ watchAll: boolean;
+ watchman: boolean;
+ watchPlugins: Array<string | [string, Record<string, unknown>]>;
+}>;
+
+declare type InitialOptionsWithRootDir = InitialOptions &
+ Required<Pick<InitialOptions, 'rootDir'>>;
+
+declare type InitialProjectOptions = Pick<
+ InitialOptions & {
+ cwd?: string;
+ },
+ keyof ProjectConfig
+>;
+
+declare interface It extends ItBase {
+ only: ItBase;
+ skip: ItBase;
+ todo: (testName: TestName) => void;
+}
+
+declare interface ItBase {
+ (testName: TestName, fn: TestFn, timeout?: number): void;
+ each: Each<TestFn>;
+}
+
+declare interface ItConcurrent extends It {
+ concurrent: ItConcurrentExtended;
+}
+
+declare interface ItConcurrentBase {
+ (testName: TestName, testFn: ConcurrentTestFn, timeout?: number): void;
+ each: Each<ConcurrentTestFn>;
+}
+
+declare interface ItConcurrentExtended extends ItConcurrentBase {
+ only: ItConcurrentBase;
+ skip: ItConcurrentBase;
+}
+
+declare type Jasmine = {
+ _DEFAULT_TIMEOUT_INTERVAL?: number;
+ addMatchers: (matchers: Record<string, unknown>) => void;
+};
+
+declare interface JestGlobals extends Global.TestFrameworkGlobals {
+ expect: unknown;
+}
+
+declare type MatcherResults = {
+ actual: unknown;
+ expected: unknown;
+ name: string;
+ pass: boolean;
+};
+
+declare type Milliseconds = number;
+
+declare type NotifyMode =
+ | 'always'
+ | 'failure'
+ | 'success'
+ | 'change'
+ | 'success-change'
+ | 'failure-change';
+
+declare type Path = string;
+
+declare interface PrettyFormatOptions {}
+
+declare type Process = NodeJS.Process;
+
+declare type ProjectConfig = {
+ automock: boolean;
+ cache: boolean;
+ cacheDirectory: Path;
+ clearMocks: boolean;
+ coveragePathIgnorePatterns: Array<string>;
+ cwd: Path;
+ dependencyExtractor?: string;
+ detectLeaks: boolean;
+ detectOpenHandles: boolean;
+ displayName?: DisplayName;
+ errorOnDeprecated: boolean;
+ extensionsToTreatAsEsm: Array<Path>;
+ extraGlobals: Array<keyof typeof globalThis>;
+ filter?: Path;
+ forceCoverageMatch: Array<Glob>;
+ globalSetup?: string;
+ globalTeardown?: string;
+ globals: ConfigGlobals;
+ haste: HasteConfig;
+ injectGlobals: boolean;
+ moduleDirectories: Array<string>;
+ moduleFileExtensions: Array<string>;
+ moduleLoader?: Path;
+ moduleNameMapper: Array<[string, string]>;
+ modulePathIgnorePatterns: Array<string>;
+ modulePaths?: Array<string>;
+ name: string;
+ prettierPath: string;
+ resetMocks: boolean;
+ resetModules: boolean;
+ resolver?: Path;
+ restoreMocks: boolean;
+ rootDir: Path;
+ roots: Array<Path>;
+ runner: string;
+ setupFiles: Array<Path>;
+ setupFilesAfterEnv: Array<Path>;
+ skipFilter: boolean;
+ skipNodeResolution?: boolean;
+ slowTestThreshold: number;
+ snapshotResolver?: Path;
+ snapshotSerializers: Array<Path>;
+ snapshotFormat: PrettyFormatOptions;
+ testEnvironment: string;
+ testEnvironmentOptions: Record<string, unknown>;
+ testMatch: Array<Glob>;
+ testLocationInResults: boolean;
+ testPathIgnorePatterns: Array<string>;
+ testRegex: Array<string | RegExp>;
+ testRunner: string;
+ testURL: string;
+ timers: Timers;
+ transform: Array<[string, Path, Record<string, unknown>]>;
+ transformIgnorePatterns: Array<Glob>;
+ watchPathIgnorePatterns: Array<string>;
+ unmockedModulePathPatterns?: Array<string>;
+};
+
+declare type PromiseReturningTestFn = (
+ this: TestContext | undefined,
+) => TestReturnValue;
+
+declare type ReporterConfig = [string, Record<string, unknown>];
+
+declare type Row = ReadonlyArray<Col>;
+
+declare type RunResult = {
+ unhandledErrors: Array<FormattedError>;
+ testResults: TestResults;
+};
+
+declare type SerializableError = {
+ code?: unknown;
+ message: string;
+ stack: string | null | undefined;
+ type?: string;
+};
+
+declare type SharedHookType = 'afterAll' | 'beforeAll';
+
+declare type SnapshotUpdateState = 'all' | 'new' | 'none';
+
+declare type State = {
+ currentDescribeBlock: DescribeBlock;
+ currentlyRunningTest?: TestEntry | null;
+ expand?: boolean;
+ hasFocusedTests: boolean;
+ hasStarted: boolean;
+ originalGlobalErrorHandlers?: GlobalErrorHandlers;
+ parentProcess: Process | null;
+ rootDescribeBlock: DescribeBlock;
+ testNamePattern?: RegExp | null;
+ testTimeout: number;
+ unhandledErrors: Array<Exception>;
+ includeTestLocationInResult: boolean;
+};
+
+declare type Status =
+ | 'passed'
+ | 'failed'
+ | 'skipped'
+ | 'pending'
+ | 'todo'
+ | 'disabled';
+
+declare type SyncEvent =
+ | {
+ asyncError: Error;
+ mode: BlockMode;
+ name: 'start_describe_definition';
+ blockName: BlockName_2;
+ }
+ | {
+ mode: BlockMode;
+ name: 'finish_describe_definition';
+ blockName: BlockName_2;
+ }
+ | {
+ asyncError: Error;
+ name: 'add_hook';
+ hookType: HookType;
+ fn: HookFn_2;
+ timeout: number | undefined;
+ }
+ | {
+ asyncError: Error;
+ name: 'add_test';
+ testName: TestName_2;
+ fn: TestFn_2;
+ mode?: TestMode;
+ timeout: number | undefined;
+ }
+ | {
+ name: 'error';
+ error: Exception;
+ };
+
+declare type Table = ReadonlyArray<Row>;
+
+declare type TemplateData = ReadonlyArray<unknown>;
+
+declare type TemplateTable = TemplateStringsArray;
+
+declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn;
+
+declare type TestContext = Record<string, unknown>;
+
+declare type TestContext_2 = Global.TestContext;
+
+declare type TestEntry = {
+ type: 'test';
+ asyncError: Exception;
+ errors: Array<TestError>;
+ fn: TestFn_2;
+ invocations: number;
+ mode: TestMode;
+ name: TestName_2;
+ parent: DescribeBlock;
+ startedAt?: number | null;
+ duration?: number | null;
+ seenDone: boolean;
+ status?: TestStatus | null;
+ timeout?: number;
+};
+
+declare type TestError = Exception | [Exception | undefined, Exception];
+
+declare type TestFn =
+ | PromiseReturningTestFn
+ | GeneratorReturningTestFn
+ | DoneTakingTestFn;
+
+declare type TestFn_2 = Global.TestFn;
+
+declare interface TestFrameworkGlobals {
+ it: ItConcurrent;
+ test: ItConcurrent;
+ fit: ItBase & {
+ concurrent?: ItConcurrentBase;
+ };
+ xit: ItBase;
+ xtest: ItBase;
+ describe: Describe;
+ xdescribe: DescribeBase;
+ fdescribe: DescribeBase;
+ beforeAll: HookBase;
+ beforeEach: HookBase;
+ afterEach: HookBase;
+ afterAll: HookBase;
+}
+
+declare type TestMode = BlockMode;
+
+declare type TestName = string;
+
+declare type TestName_2 = Global.TestName;
+
+declare namespace TestResult {
+ export {Milliseconds, AssertionResult, SerializableError};
+}
+export {TestResult};
+
+declare type TestResult_2 = {
+ duration?: number | null;
+ errors: Array<FormattedError>;
+ errorsDetailed: Array<MatcherResults | unknown>;
+ invocations: number;
+ status: TestStatus;
+ location?: {
+ column: number;
+ line: number;
+ } | null;
+ testPath: Array<TestName_2 | BlockName_2>;
+};
+
+declare type TestResults = Array<TestResult_2>;
+
+declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise;
+
+declare type TestReturnValueGenerator = Generator<void, unknown, void>;
+
+declare type TestReturnValuePromise = Promise<unknown>;
+
+declare type TestStatus = 'skip' | 'done' | 'todo';
+
+declare type Timers = 'real' | 'fake' | 'modern' | 'legacy';
+
+declare type TransformerConfig = [string, Record<string, unknown>];
+
+declare type TransformResult = {
+ code: string;
+ originalCode: string;
+ sourceMapPath: string | null;
+};
+
+declare namespace TransformTypes {
+ export {TransformResult};
+}
+export {TransformTypes};
+
+declare type ValidTestReturnValues = void | undefined;
+
+export {};
diff --git i/packages/jest-util/build/ErrorWithStack.d.ts w/packages/jest-util/build/ErrorWithStack.d.ts
deleted file mode 100644
index 0aba5bb6b4..0000000000
--- i/packages/jest-util/build/ErrorWithStack.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default class ErrorWithStack extends Error {
- constructor(
- message: string | undefined,
- callsite: (...args: Array<any>) => unknown,
- stackLimit?: number,
- );
-}
diff --git i/packages/jest-util/build/clearLine.d.ts w/packages/jest-util/build/clearLine.d.ts
deleted file mode 100644
index cf56b982cb..0000000000
--- i/packages/jest-util/build/clearLine.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-export default function clearLine(stream: NodeJS.WriteStream): void;
diff --git i/packages/jest-util/build/convertDescriptorToString.d.ts w/packages/jest-util/build/convertDescriptorToString.d.ts
deleted file mode 100644
index ddceab048c..0000000000
--- i/packages/jest-util/build/convertDescriptorToString.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function convertDescriptorToString<
- T extends number | string | Function | undefined,
->(descriptor: T): T | string;
diff --git i/packages/jest-util/build/createDirectory.d.ts w/packages/jest-util/build/createDirectory.d.ts
deleted file mode 100644
index 00257448a4..0000000000
--- i/packages/jest-util/build/createDirectory.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function createDirectory(path: Config.Path): void;
diff --git i/packages/jest-util/build/createProcessObject.d.ts w/packages/jest-util/build/createProcessObject.d.ts
deleted file mode 100644
index 29e0db5f4c..0000000000
--- i/packages/jest-util/build/createProcessObject.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-export default function createProcessObject(): NodeJS.Process;
diff --git i/packages/jest-util/build/deepCyclicCopy.d.ts w/packages/jest-util/build/deepCyclicCopy.d.ts
deleted file mode 100644
index a82eb5751e..0000000000
--- i/packages/jest-util/build/deepCyclicCopy.d.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare type DeepCyclicCopyOptions = {
- blacklist?: Set<string>;
- keepPrototype?: boolean;
-};
-export default function deepCyclicCopy<T>(
- value: T,
- options?: DeepCyclicCopyOptions,
- cycles?: WeakMap<any, any>,
-): T;
diff --git i/packages/jest-util/build/formatTime.d.ts w/packages/jest-util/build/formatTime.d.ts
deleted file mode 100644
index 39bdbe3e1d..0000000000
--- i/packages/jest-util/build/formatTime.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function formatTime(
- time: number,
- prefixPower?: number,
- padLeftLength?: number,
-): string;
diff --git i/packages/jest-util/build/globsToMatcher.d.ts w/packages/jest-util/build/globsToMatcher.d.ts
deleted file mode 100644
index f8f870b48a..0000000000
--- i/packages/jest-util/build/globsToMatcher.d.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-declare type Matcher = (str: Config.Path) => boolean;
-/**
- * Converts a list of globs into a function that matches a path against the
- * globs.
- *
- * Every time picomatch is called, it will parse the glob strings and turn
- * them into regexp instances. Instead of calling picomatch repeatedly with
- * the same globs, we can use this function which will build the picomatch
- * matchers ahead of time and then have an optimized path for determining
- * whether an individual path matches.
- *
- * This function is intended to match the behavior of `micromatch()`.
- *
- * @example
- * const isMatch = globsToMatcher(['*.js', '!*.test.js']);
- * isMatch('pizza.js'); // true
- * isMatch('pizza.test.js'); // false
- */
-export default function globsToMatcher(globs: Array<Config.Glob>): Matcher;
-export {};
diff --git i/packages/jest-util/build/index.d.ts w/packages/jest-util/build/index.d.ts
index 4702ae1562..537a1ddce4 100644
--- i/packages/jest-util/build/index.d.ts
+++ w/packages/jest-util/build/index.d.ts
@@ -4,24 +4,121 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-import * as preRunMessage from './preRunMessage';
-import * as specialChars from './specialChars';
-export {default as clearLine} from './clearLine';
-export {default as createDirectory} from './createDirectory';
-export {default as ErrorWithStack} from './ErrorWithStack';
-export {default as installCommonGlobals} from './installCommonGlobals';
-export {default as interopRequireDefault} from './interopRequireDefault';
-export {default as isInteractive} from './isInteractive';
-export {default as isPromise} from './isPromise';
-export {default as setGlobal} from './setGlobal';
-export {default as deepCyclicCopy} from './deepCyclicCopy';
-export {default as convertDescriptorToString} from './convertDescriptorToString';
-export {specialChars};
-export {default as replacePathSepForGlob} from './replacePathSepForGlob';
-export {default as testPathPatternToRegExp} from './testPathPatternToRegExp';
-export {default as globsToMatcher} from './globsToMatcher';
+/// <reference types="node" />
+
+import type {Config} from '@jest/types';
+
+declare const ARROW = ' \u203A ';
+
+declare const CLEAR: string;
+
+export declare function clearLine(stream: NodeJS.WriteStream): void;
+
+export declare function convertDescriptorToString<
+ T extends number | string | Function | undefined,
+>(descriptor: T): T | string;
+
+export declare function createDirectory(path: Config.Path): void;
+
+export declare function deepCyclicCopy<T>(
+ value: T,
+ options?: DeepCyclicCopyOptions,
+ cycles?: WeakMap<any, any>,
+): T;
+
+declare type DeepCyclicCopyOptions = {
+ blacklist?: Set<string>;
+ keepPrototype?: boolean;
+};
+
+export declare class ErrorWithStack extends Error {
+ constructor(
+ message: string | undefined,
+ callsite: (...args: Array<any>) => unknown,
+ stackLimit?: number,
+ );
+}
+
+export declare function formatTime(
+ time: number,
+ prefixPower?: number,
+ padLeftLength?: number,
+): string;
+
+/**
+ * Converts a list of globs into a function that matches a path against the
+ * globs.
+ *
+ * Every time picomatch is called, it will parse the glob strings and turn
+ * them into regexp instances. Instead of calling picomatch repeatedly with
+ * the same globs, we can use this function which will build the picomatch
+ * matchers ahead of time and then have an optimized path for determining
+ * whether an individual path matches.
+ *
+ * This function is intended to match the behavior of `micromatch()`.
+ *
+ * @example
+ * const isMatch = globsToMatcher(['*.js', '!*.test.js']);
+ * isMatch('pizza.js'); // true
+ * isMatch('pizza.test.js'); // false
+ */
+export declare function globsToMatcher(globs: Array<Config.Glob>): Matcher;
+
+declare const ICONS: {
+ failed: string;
+ pending: string;
+ success: string;
+ todo: string;
+};
+
+export declare function installCommonGlobals(
+ globalObject: typeof globalThis,
+ globals: Config.ConfigGlobals,
+): typeof globalThis & Config.ConfigGlobals;
+
+export declare function interopRequireDefault(obj: any): any;
+
+export declare const isInteractive: boolean;
+
+export declare const isPromise: (
+ candidate: unknown,
+) => candidate is Promise<unknown>;
+
+declare type Matcher = (str: Config.Path) => boolean;
+
+export declare function pluralize(word: string, count: number): string;
+
+declare namespace preRunMessage {
+ export {print_2 as print, remove};
+}
export {preRunMessage};
-export {default as pluralize} from './pluralize';
-export {default as formatTime} from './formatTime';
-export {default as tryRealpath} from './tryRealpath';
-export {default as requireOrImportModule} from './requireOrImportModule';
+
+declare const print_2: (stream: NodeJS.WriteStream) => void;
+
+declare const remove: (stream: NodeJS.WriteStream) => void;
+
+export declare function replacePathSepForGlob(path: Config.Path): Config.Glob;
+
+export declare function requireOrImportModule<T>(
+ filePath: Config.Path,
+ applyInteropRequireDefault?: boolean,
+): Promise<T>;
+
+export declare function setGlobal(
+ globalToMutate: typeof globalThis,
+ key: string,
+ value: unknown,
+): void;
+
+declare namespace specialChars {
+ export {ARROW, ICONS, CLEAR};
+}
+export {specialChars};
+
+export declare function testPathPatternToRegExp(
+ testPathPattern: Config.GlobalConfig['testPathPattern'],
+): RegExp;
+
+export declare function tryRealpath(path: Config.Path): Config.Path;
+
+export {};
diff --git i/packages/jest-util/build/installCommonGlobals.d.ts w/packages/jest-util/build/installCommonGlobals.d.ts
deleted file mode 100644
index 2d4c7320c4..0000000000
--- i/packages/jest-util/build/installCommonGlobals.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function installCommonGlobals(
- globalObject: typeof globalThis,
- globals: Config.ConfigGlobals,
-): typeof globalThis & Config.ConfigGlobals;
diff --git i/packages/jest-util/build/interopRequireDefault.d.ts w/packages/jest-util/build/interopRequireDefault.d.ts
deleted file mode 100644
index 91b66e4fc4..0000000000
--- i/packages/jest-util/build/interopRequireDefault.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function interopRequireDefault(obj: any): any;
diff --git i/packages/jest-util/build/isInteractive.d.ts w/packages/jest-util/build/isInteractive.d.ts
deleted file mode 100644
index 57ddbf0a79..0000000000
--- i/packages/jest-util/build/isInteractive.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-declare const _default: boolean;
-export default _default;
diff --git i/packages/jest-util/build/isPromise.d.ts w/packages/jest-util/build/isPromise.d.ts
deleted file mode 100644
index ea8589b908..0000000000
--- i/packages/jest-util/build/isPromise.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-declare const isPromise: (candidate: unknown) => candidate is Promise<unknown>;
-export default isPromise;
diff --git i/packages/jest-util/build/pluralize.d.ts w/packages/jest-util/build/pluralize.d.ts
deleted file mode 100644
index 9be3057928..0000000000
--- i/packages/jest-util/build/pluralize.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function pluralize(word: string, count: number): string;
diff --git i/packages/jest-util/build/preRunMessage.d.ts w/packages/jest-util/build/preRunMessage.d.ts
deleted file mode 100644
index 55acad973e..0000000000
--- i/packages/jest-util/build/preRunMessage.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-export declare const print: (stream: NodeJS.WriteStream) => void;
-export declare const remove: (stream: NodeJS.WriteStream) => void;
diff --git i/packages/jest-util/build/replacePathSepForGlob.d.ts w/packages/jest-util/build/replacePathSepForGlob.d.ts
deleted file mode 100644
index afc8e0f1df..0000000000
--- i/packages/jest-util/build/replacePathSepForGlob.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function replacePathSepForGlob(path: Config.Path): Config.Glob;
diff --git i/packages/jest-util/build/requireOrImportModule.d.ts w/packages/jest-util/build/requireOrImportModule.d.ts
deleted file mode 100644
index 34b9dd610f..0000000000
--- i/packages/jest-util/build/requireOrImportModule.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function requireOrImportModule<T>(
- filePath: Config.Path,
- applyInteropRequireDefault?: boolean,
-): Promise<T>;
diff --git i/packages/jest-util/build/setGlobal.d.ts w/packages/jest-util/build/setGlobal.d.ts
deleted file mode 100644
index 24bbabb901..0000000000
--- i/packages/jest-util/build/setGlobal.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function setGlobal(
- globalToMutate: typeof globalThis,
- key: string,
- value: unknown,
-): void;
diff --git i/packages/jest-util/build/specialChars.d.ts w/packages/jest-util/build/specialChars.d.ts
deleted file mode 100644
index 2e92eaeb25..0000000000
--- i/packages/jest-util/build/specialChars.d.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare const ARROW = ' \u203A ';
-export declare const ICONS: {
- failed: string;
- pending: string;
- success: string;
- todo: string;
-};
-export declare const CLEAR: string;
diff --git i/packages/jest-util/build/testPathPatternToRegExp.d.ts w/packages/jest-util/build/testPathPatternToRegExp.d.ts
deleted file mode 100644
index 1b46be39c9..0000000000
--- i/packages/jest-util/build/testPathPatternToRegExp.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function testPathPatternToRegExp(
- testPathPattern: Config.GlobalConfig['testPathPattern'],
-): RegExp;
diff --git i/packages/jest-util/build/tryRealpath.d.ts w/packages/jest-util/build/tryRealpath.d.ts
deleted file mode 100644
index 02b84d462f..0000000000
--- i/packages/jest-util/build/tryRealpath.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export default function tryRealpath(path: Config.Path): Config.Path;
diff --git i/packages/jest-validate/build/condition.d.ts w/packages/jest-validate/build/condition.d.ts
deleted file mode 100644
index 6b66277512..0000000000
--- i/packages/jest-validate/build/condition.d.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare function getValues<T = unknown>(validOption: T): Array<T>;
-export declare function validationCondition(
- option: unknown,
- validOption: unknown,
-): boolean;
-export declare function multipleValidOptions<T extends Array<unknown>>(
- ...args: T
-): T[number];
diff --git i/packages/jest-validate/build/defaultConfig.d.ts w/packages/jest-validate/build/defaultConfig.d.ts
deleted file mode 100644
index 7a0490a25a..0000000000
--- i/packages/jest-validate/build/defaultConfig.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {ValidationOptions} from './types';
-declare const validationOptions: ValidationOptions;
-export default validationOptions;
diff --git i/packages/jest-validate/build/deprecated.d.ts w/packages/jest-validate/build/deprecated.d.ts
deleted file mode 100644
index fe5f2f4d86..0000000000
--- i/packages/jest-validate/build/deprecated.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {DeprecatedOptions, ValidationOptions} from './types';
-export declare const deprecationWarning: (
- config: Record<string, unknown>,
- option: string,
- deprecatedOptions: DeprecatedOptions,
- options: ValidationOptions,
-) => boolean;
diff --git i/packages/jest-validate/build/errors.d.ts w/packages/jest-validate/build/errors.d.ts
deleted file mode 100644
index 330755bd5d..0000000000
--- i/packages/jest-validate/build/errors.d.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {ValidationOptions} from './types';
-export declare const errorMessage: (
- option: string,
- received: unknown,
- defaultValue: unknown,
- options: ValidationOptions,
- path?: string[] | undefined,
-) => void;
diff --git i/packages/jest-validate/build/exampleConfig.d.ts w/packages/jest-validate/build/exampleConfig.d.ts
deleted file mode 100644
index 86722fb331..0000000000
--- i/packages/jest-validate/build/exampleConfig.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {ValidationOptions} from './types';
-declare const config: ValidationOptions;
-export default config;
diff --git i/packages/jest-validate/build/index.d.ts w/packages/jest-validate/build/index.d.ts
index 7a3331bf88..e0f81fe7c8 100644
--- i/packages/jest-validate/build/index.d.ts
+++ w/packages/jest-validate/build/index.d.ts
@@ -4,13 +4,87 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-export {
- ValidationError,
- createDidYouMeanMessage,
- format,
- logValidationWarning,
-} from './utils';
-export type {DeprecatedOptions} from './types';
-export {default as validate} from './validate';
-export {default as validateCLIOptions} from './validateCLIOptions';
-export {multipleValidOptions} from './condition';
+import type {Config} from '@jest/types';
+import type {Options} from 'yargs';
+
+export declare const createDidYouMeanMessage: (
+ unrecognized: string,
+ allowedOptions: Array<string>,
+) => string;
+
+declare type DeprecatedOptionFunc = (arg: Record<string, unknown>) => string;
+
+export declare type DeprecatedOptions = Record<string, DeprecatedOptionFunc>;
+
+export declare const format: (value: unknown) => string;
+
+export declare const logValidationWarning: (
+ name: string,
+ message: string,
+ comment?: string | null | undefined,
+) => void;
+
+export declare function multipleValidOptions<T extends Array<unknown>>(
+ ...args: T
+): T[number];
+
+declare type Title = {
+ deprecation?: string;
+ error?: string;
+ warning?: string;
+};
+
+export declare const validate: (
+ config: Record<string, unknown>,
+ options: ValidationOptions,
+) => {
+ hasDeprecationWarnings: boolean;
+ isValid: boolean;
+};
+
+export declare function validateCLIOptions(
+ argv: Config.Argv,
+ options: {
+ deprecationEntries: DeprecatedOptions;
+ [s: string]: Options;
+ },
+ rawArgv?: Array<string>,
+): boolean;
+
+export declare class ValidationError extends Error {
+ name: string;
+ message: string;
+ constructor(name: string, message: string, comment?: string | null);
+}
+
+declare type ValidationOptions = {
+ comment?: string;
+ condition?: (option: unknown, validOption: unknown) => boolean;
+ deprecate?: (
+ config: Record<string, unknown>,
+ option: string,
+ deprecatedOptions: DeprecatedOptions,
+ options: ValidationOptions,
+ ) => boolean;
+ deprecatedConfig?: DeprecatedOptions;
+ error?: (
+ option: string,
+ received: unknown,
+ defaultValue: unknown,
+ options: ValidationOptions,
+ path?: Array<string>,
+ ) => void;
+ exampleConfig: Record<string, unknown>;
+ recursive?: boolean;
+ recursiveDenylist?: Array<string>;
+ title?: Title;
+ unknown?: (
+ config: Record<string, unknown>,
+ exampleConfig: Record<string, unknown>,
+ option: string,
+ options: ValidationOptions,
+ path?: Array<string>,
+ ) => void;
+};
+
+export {};
diff --git i/packages/jest-validate/build/types.d.ts w/packages/jest-validate/build/types.d.ts
deleted file mode 100644
index daec969b57..0000000000
--- i/packages/jest-validate/build/types.d.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-declare type Title = {
- deprecation?: string;
- error?: string;
- warning?: string;
-};
-export declare type DeprecatedOptionFunc = (
- arg: Record<string, unknown>,
-) => string;
-export declare type DeprecatedOptions = Record<string, DeprecatedOptionFunc>;
-export declare type ValidationOptions = {
- comment?: string;
- condition?: (option: unknown, validOption: unknown) => boolean;
- deprecate?: (
- config: Record<string, unknown>,
- option: string,
- deprecatedOptions: DeprecatedOptions,
- options: ValidationOptions,
- ) => boolean;
- deprecatedConfig?: DeprecatedOptions;
- error?: (
- option: string,
- received: unknown,
- defaultValue: unknown,
- options: ValidationOptions,
- path?: Array<string>,
- ) => void;
- exampleConfig: Record<string, unknown>;
- recursive?: boolean;
- recursiveDenylist?: Array<string>;
- title?: Title;
- unknown?: (
- config: Record<string, unknown>,
- exampleConfig: Record<string, unknown>,
- option: string,
- options: ValidationOptions,
- path?: Array<string>,
- ) => void;
-};
-export {};
diff --git i/packages/jest-validate/build/utils.d.ts w/packages/jest-validate/build/utils.d.ts
deleted file mode 100644
index 94a8a03d84..0000000000
--- i/packages/jest-validate/build/utils.d.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare const DEPRECATION: string;
-export declare const ERROR: string;
-export declare const WARNING: string;
-export declare const format: (value: unknown) => string;
-export declare const formatPrettyObject: (value: unknown) => string;
-export declare class ValidationError extends Error {
- name: string;
- message: string;
- constructor(name: string, message: string, comment?: string | null);
-}
-export declare const logValidationWarning: (
- name: string,
- message: string,
- comment?: string | null | undefined,
-) => void;
-export declare const createDidYouMeanMessage: (
- unrecognized: string,
- allowedOptions: Array<string>,
-) => string;
diff --git i/packages/jest-validate/build/validate.d.ts w/packages/jest-validate/build/validate.d.ts
deleted file mode 100644
index 954aade5c5..0000000000
--- i/packages/jest-validate/build/validate.d.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {ValidationOptions} from './types';
-declare let hasDeprecationWarnings: boolean;
-declare const validate: (
- config: Record<string, unknown>,
- options: ValidationOptions,
-) => {
- hasDeprecationWarnings: boolean;
- isValid: boolean;
-};
-export default validate;
diff --git i/packages/jest-validate/build/validateCLIOptions.d.ts w/packages/jest-validate/build/validateCLIOptions.d.ts
deleted file mode 100644
index d8113a06d4..0000000000
--- i/packages/jest-validate/build/validateCLIOptions.d.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Options} from 'yargs';
-import type {Config} from '@jest/types';
-import type {DeprecatedOptions} from './types';
-export declare const DOCUMENTATION_NOTE: string;
-export default function validateCLIOptions(
- argv: Config.Argv,
- options: {
- deprecationEntries: DeprecatedOptions;
- [s: string]: Options;
- },
- rawArgv?: Array<string>,
-): boolean;
diff --git i/packages/jest-validate/build/warnings.d.ts w/packages/jest-validate/build/warnings.d.ts
deleted file mode 100644
index 0aa96204ad..0000000000
--- i/packages/jest-validate/build/warnings.d.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {ValidationOptions} from './types';
-export declare const unknownOptionWarning: (
- config: Record<string, unknown>,
- exampleConfig: Record<string, unknown>,
- option: string,
- options: ValidationOptions,
- path?: string[] | undefined,
-) => void;
diff --git i/packages/jest-watcher/build/BaseWatchPlugin.d.ts w/packages/jest-watcher/build/BaseWatchPlugin.d.ts
deleted file mode 100644
index c6ebb0341f..0000000000
--- i/packages/jest-watcher/build/BaseWatchPlugin.d.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {Config} from '@jest/types';
-import type {
- JestHookSubscriber,
- UpdateConfigCallback,
- UsageData,
- WatchPlugin,
-} from './types';
-declare abstract class BaseWatchPlugin implements WatchPlugin {
- protected _stdin: NodeJS.ReadStream;
- protected _stdout: NodeJS.WriteStream;
- constructor({
- stdin,
- stdout,
- }: {
- stdin: NodeJS.ReadStream;
- stdout: NodeJS.WriteStream;
- });
- apply(_hooks: JestHookSubscriber): void;
- getUsageInfo(_globalConfig: Config.GlobalConfig): UsageData | null;
- onKey(_key: string): void;
- run(
- _globalConfig: Config.GlobalConfig,
- _updateConfigAndRun: UpdateConfigCallback,
- ): Promise<void | boolean>;
-}
-export default BaseWatchPlugin;
diff --git i/packages/jest-watcher/build/JestHooks.d.ts w/packages/jest-watcher/build/JestHooks.d.ts
deleted file mode 100644
index 9a63250de3..0000000000
--- i/packages/jest-watcher/build/JestHooks.d.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {JestHookEmitter, JestHookSubscriber} from './types';
-declare type AvailableHooks =
- | 'onFileChange'
- | 'onTestRunComplete'
- | 'shouldRunTestSuite';
-declare class JestHooks {
- private _listeners;
- private _subscriber;
- private _emitter;
- constructor();
- isUsed(hook: AvailableHooks): boolean;
- getSubscriber(): Readonly<JestHookSubscriber>;
- getEmitter(): Readonly<JestHookEmitter>;
-}
-export default JestHooks;
diff --git i/packages/jest-watcher/build/PatternPrompt.d.ts w/packages/jest-watcher/build/PatternPrompt.d.ts
deleted file mode 100644
index 904f4724d5..0000000000
--- i/packages/jest-watcher/build/PatternPrompt.d.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type Prompt from './lib/Prompt';
-import type {ScrollOptions} from './types';
-export default class PatternPrompt {
- protected _pipe: NodeJS.WritableStream;
- protected _prompt: Prompt;
- protected _entityName: string;
- protected _currentUsageRows: number;
- constructor(pipe: NodeJS.WritableStream, prompt: Prompt);
- run(
- onSuccess: (value: string) => void,
- onCancel: () => void,
- options?: {
- header: string;
- },
- ): void;
- protected _onChange(_pattern: string, _options: ScrollOptions): void;
-}
diff --git i/packages/jest-watcher/build/constants.d.ts w/packages/jest-watcher/build/constants.d.ts
deleted file mode 100644
index 3b30344e7e..0000000000
--- i/packages/jest-watcher/build/constants.d.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare const KEYS: {
- ARROW_DOWN: string;
- ARROW_LEFT: string;
- ARROW_RIGHT: string;
- ARROW_UP: string;
- BACKSPACE: string;
- CONTROL_C: string;
- CONTROL_D: string;
- CONTROL_U: string;
- ENTER: string;
- ESCAPE: string;
-};
diff --git i/packages/jest-watcher/build/index.d.ts w/packages/jest-watcher/build/index.d.ts
index 7feb0b18f1..eab664c650 100644
--- i/packages/jest-watcher/build/index.d.ts
+++ w/packages/jest-watcher/build/index.d.ts
@@ -4,19 +4,200 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-export {default as BaseWatchPlugin} from './BaseWatchPlugin';
-export {default as JestHook} from './JestHooks';
-export {default as PatternPrompt} from './PatternPrompt';
-export * from './constants';
-export type {
- AllowedConfigOptions,
- JestHookEmitter,
- JestHookSubscriber,
- ScrollOptions,
- UpdateConfigCallback,
- UsageData,
- WatchPlugin,
- WatchPluginClass,
-} from './types';
-export {default as Prompt} from './lib/Prompt';
-export * from './lib/patternModeHelpers';
+/// <reference types="node" />
+
+import type {AggregatedResult} from '@jest/test-result';
+import type {Config} from '@jest/types';
+
+export declare type AllowedConfigOptions = Partial<
+ Pick<
+ Config.GlobalConfig,
+ | 'bail'
+ | 'changedSince'
+ | 'collectCoverage'
+ | 'collectCoverageFrom'
+ | 'collectCoverageOnlyFrom'
+ | 'coverageDirectory'
+ | 'coverageReporters'
+ | 'findRelatedTests'
+ | 'nonFlagArgs'
+ | 'notify'
+ | 'notifyMode'
+ | 'onlyFailures'
+ | 'reporters'
+ | 'testNamePattern'
+ | 'testPathPattern'
+ | 'updateSnapshot'
+ | 'verbose'
+ > & {
+ mode: 'watch' | 'watchAll';
+ }
+>;
+
+declare type AvailableHooks =
+ | 'onFileChange'
+ | 'onTestRunComplete'
+ | 'shouldRunTestSuite';
+
+export declare abstract class BaseWatchPlugin implements WatchPlugin {
+ protected _stdin: NodeJS.ReadStream;
+ protected _stdout: NodeJS.WriteStream;
+ constructor({
+ stdin,
+ stdout,
+ }: {
+ stdin: NodeJS.ReadStream;
+ stdout: NodeJS.WriteStream;
+ });
+ apply(_hooks: JestHookSubscriber): void;
+ getUsageInfo(_globalConfig: Config.GlobalConfig): UsageData | null;
+ onKey(_key: string): void;
+ run(
+ _globalConfig: Config.GlobalConfig,
+ _updateConfigAndRun: UpdateConfigCallback,
+ ): Promise<void | boolean>;
+}
+
+declare type FileChange = (fs: JestHookExposedFS) => void;
+
+export declare class JestHook {
+ private _listeners;
+ private _subscriber;
+ private _emitter;
+ constructor();
+ isUsed(hook: AvailableHooks): boolean;
+ getSubscriber(): Readonly<JestHookSubscriber>;
+ getEmitter(): Readonly<JestHookEmitter>;
+}
+
+export declare type JestHookEmitter = {
+ onFileChange: (fs: JestHookExposedFS) => void;
+ onTestRunComplete: (results: AggregatedResult) => void;
+ shouldRunTestSuite: (
+ testSuiteInfo: TestSuiteInfo,
+ ) => Promise<boolean> | boolean;
+};
+
+declare type JestHookExposedFS = {
+ projects: Array<{
+ config: Config.ProjectConfig;
+ testPaths: Array<Config.Path>;
+ }>;
+};
+
+export declare type JestHookSubscriber = {
+ onFileChange: (fn: FileChange) => void;
+ onTestRunComplete: (fn: TestRunComplete) => void;
+ shouldRunTestSuite: (fn: ShouldRunTestSuite) => void;
+};
+
+export declare const KEYS: {
+ ARROW_DOWN: string;
+ ARROW_LEFT: string;
+ ARROW_RIGHT: string;
+ ARROW_UP: string;
+ BACKSPACE: string;
+ CONTROL_C: string;
+ CONTROL_D: string;
+ CONTROL_U: string;
+ ENTER: string;
+ ESCAPE: string;
+};
+
+export declare class PatternPrompt {
+ protected _pipe: NodeJS.WritableStream;
+ protected _prompt: Prompt;
+ protected _entityName: string;
+ protected _currentUsageRows: number;
+ constructor(pipe: NodeJS.WritableStream, prompt: Prompt);
+ run(
+ onSuccess: (value: string) => void,
+ onCancel: () => void,
+ options?: {
+ header: string;
+ },
+ ): void;
+ protected _onChange(_pattern: string, _options: ScrollOptions_2): void;
+}
+
+export declare const printPatternCaret: (
+ pattern: string,
+ pipe: NodeJS.WritableStream,
+) => void;
+
+export declare const printRestoredPatternCaret: (
+ pattern: string,
+ currentUsageRows: number,
+ pipe: NodeJS.WritableStream,
+) => void;
+
+export declare class Prompt {
+ private _entering;
+ private _value;
+ private _onChange;
+ private _onSuccess;
+ private _onCancel;
+ private _offset;
+ private _promptLength;
+ private _selection;
+ constructor();
+ private _onResize;
+ enter(
+ onChange: (pattern: string, options: ScrollOptions_2) => void,
+ onSuccess: (pattern: string) => void,
+ onCancel: () => void,
+ ): void;
+ setPromptLength(length: number): void;
+ setPromptSelection(selected: string): void;
+ put(key: string): void;
+ abort(): void;
+ isEntering(): boolean;
+}
+
+declare type ScrollOptions_2 = {
+ offset: number;
+ max: number;
+};
+export {ScrollOptions_2 as ScrollOptions};
+
+declare type ShouldRunTestSuite = (
+ testSuiteInfo: TestSuiteInfo,
+) => Promise<boolean>;
+
+declare type TestRunComplete = (results: AggregatedResult) => void;
+
+declare type TestSuiteInfo = {
+ config: Config.ProjectConfig;
+ duration?: number;
+ testPath: string;
+};
+
+export declare type UpdateConfigCallback = (
+ config?: AllowedConfigOptions,
+) => void;
+
+export declare type UsageData = {
+ key: string;
+ prompt: string;
+};
+
+export declare interface WatchPlugin {
+ isInternal?: boolean;
+ apply?: (hooks: JestHookSubscriber) => void;
+ getUsageInfo?: (globalConfig: Config.GlobalConfig) => UsageData | null;
+ onKey?: (value: string) => void;
+ run?: (
+ globalConfig: Config.GlobalConfig,
+ updateConfigAndRun: UpdateConfigCallback,
+ ) => Promise<void | boolean>;
+}
+
+export declare interface WatchPluginClass {
+ new (options: {
+ config: Record<string, unknown>;
+ stdin: NodeJS.ReadStream;
+ stdout: NodeJS.WriteStream;
+ }): WatchPlugin;
+}
+
+export {};
diff --git i/packages/jest-watcher/build/lib/Prompt.d.ts w/packages/jest-watcher/build/lib/Prompt.d.ts
deleted file mode 100644
index 5a92116102..0000000000
--- i/packages/jest-watcher/build/lib/Prompt.d.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {ScrollOptions} from '../types';
-export default class Prompt {
- private _entering;
- private _value;
- private _onChange;
- private _onSuccess;
- private _onCancel;
- private _offset;
- private _promptLength;
- private _selection;
- constructor();
- private _onResize;
- enter(
- onChange: (pattern: string, options: ScrollOptions) => void,
- onSuccess: (pattern: string) => void,
- onCancel: () => void,
- ): void;
- setPromptLength(length: number): void;
- setPromptSelection(selected: string): void;
- put(key: string): void;
- abort(): void;
- isEntering(): boolean;
-}
diff --git i/packages/jest-watcher/build/lib/colorize.d.ts w/packages/jest-watcher/build/lib/colorize.d.ts
deleted file mode 100644
index 767f4eea23..0000000000
--- i/packages/jest-watcher/build/lib/colorize.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function colorize(
- str: string,
- start: number,
- end: number,
-): string;
diff --git i/packages/jest-watcher/build/lib/formatTestNameByPattern.d.ts w/packages/jest-watcher/build/lib/formatTestNameByPattern.d.ts
deleted file mode 100644
index c6196f5967..0000000000
--- i/packages/jest-watcher/build/lib/formatTestNameByPattern.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function formatTestNameByPattern(
- testName: string,
- pattern: string,
- width: number,
-): string;
diff --git i/packages/jest-watcher/build/lib/patternModeHelpers.d.ts w/packages/jest-watcher/build/lib/patternModeHelpers.d.ts
deleted file mode 100644
index 951d8b9557..0000000000
--- i/packages/jest-watcher/build/lib/patternModeHelpers.d.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-export declare const printPatternCaret: (
- pattern: string,
- pipe: NodeJS.WritableStream,
-) => void;
-export declare const printRestoredPatternCaret: (
- pattern: string,
- currentUsageRows: number,
- pipe: NodeJS.WritableStream,
-) => void;
diff --git i/packages/jest-watcher/build/lib/scroll.d.ts w/packages/jest-watcher/build/lib/scroll.d.ts
deleted file mode 100644
index eb4d020ef4..0000000000
--- i/packages/jest-watcher/build/lib/scroll.d.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {ScrollOptions} from '../types';
-export default function scroll(
- size: number,
- {offset, max}: ScrollOptions,
-): {
- end: number;
- index: number;
- start: number;
-};
diff --git i/packages/jest-watcher/build/types.d.ts w/packages/jest-watcher/build/types.d.ts
deleted file mode 100644
index 503d872ab2..0000000000
--- i/packages/jest-watcher/build/types.d.ts
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {AggregatedResult} from '@jest/test-result';
-import type {Config} from '@jest/types';
-declare type TestSuiteInfo = {
- config: Config.ProjectConfig;
- duration?: number;
- testPath: string;
-};
-export declare type JestHookExposedFS = {
- projects: Array<{
- config: Config.ProjectConfig;
- testPaths: Array<Config.Path>;
- }>;
-};
-export declare type FileChange = (fs: JestHookExposedFS) => void;
-export declare type ShouldRunTestSuite = (
- testSuiteInfo: TestSuiteInfo,
-) => Promise<boolean>;
-export declare type TestRunComplete = (results: AggregatedResult) => void;
-export declare type JestHookSubscriber = {
- onFileChange: (fn: FileChange) => void;
- onTestRunComplete: (fn: TestRunComplete) => void;
- shouldRunTestSuite: (fn: ShouldRunTestSuite) => void;
-};
-export declare type JestHookEmitter = {
- onFileChange: (fs: JestHookExposedFS) => void;
- onTestRunComplete: (results: AggregatedResult) => void;
- shouldRunTestSuite: (
- testSuiteInfo: TestSuiteInfo,
- ) => Promise<boolean> | boolean;
-};
-export declare type UsageData = {
- key: string;
- prompt: string;
-};
-export declare type AllowedConfigOptions = Partial<
- Pick<
- Config.GlobalConfig,
- | 'bail'
- | 'changedSince'
- | 'collectCoverage'
- | 'collectCoverageFrom'
- | 'collectCoverageOnlyFrom'
- | 'coverageDirectory'
- | 'coverageReporters'
- | 'findRelatedTests'
- | 'nonFlagArgs'
- | 'notify'
- | 'notifyMode'
- | 'onlyFailures'
- | 'reporters'
- | 'testNamePattern'
- | 'testPathPattern'
- | 'updateSnapshot'
- | 'verbose'
- > & {
- mode: 'watch' | 'watchAll';
- }
->;
-export declare type UpdateConfigCallback = (
- config?: AllowedConfigOptions,
-) => void;
-export interface WatchPlugin {
- isInternal?: boolean;
- apply?: (hooks: JestHookSubscriber) => void;
- getUsageInfo?: (globalConfig: Config.GlobalConfig) => UsageData | null;
- onKey?: (value: string) => void;
- run?: (
- globalConfig: Config.GlobalConfig,
- updateConfigAndRun: UpdateConfigCallback,
- ) => Promise<void | boolean>;
-}
-export interface WatchPluginClass {
- new (options: {
- config: Record<string, unknown>;
- stdin: NodeJS.ReadStream;
- stdout: NodeJS.WriteStream;
- }): WatchPlugin;
-}
-export declare type ScrollOptions = {
- offset: number;
- max: number;
-};
-export {};
diff --git i/packages/jest-worker/build/Farm.d.ts w/packages/jest-worker/build/Farm.d.ts
deleted file mode 100644
index 741c74a392..0000000000
--- i/packages/jest-worker/build/Farm.d.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import {FarmOptions, PromiseWithCustomMessage, WorkerCallback} from './types';
-export default class Farm {
- private _numOfWorkers;
- private _callback;
- private readonly _computeWorkerKey;
- private readonly _workerSchedulingPolicy;
- private readonly _cacheKeys;
- private readonly _locks;
- private _offset;
- private readonly _taskQueue;
- constructor(
- _numOfWorkers: number,
- _callback: WorkerCallback,
- options?: FarmOptions,
- );
- doWork(
- method: string,
- ...args: Array<unknown>
- ): PromiseWithCustomMessage<unknown>;
- private _process;
- private _push;
- private _getNextWorkerOffset;
- private _lock;
- private _unlock;
- private _isLocked;
-}
diff --git i/packages/jest-worker/build/FifoQueue.d.ts w/packages/jest-worker/build/FifoQueue.d.ts
deleted file mode 100644
index 1ace6938d5..0000000000
--- i/packages/jest-worker/build/FifoQueue.d.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {QueueChildMessage, TaskQueue} from './types';
-/**
- * First-in, First-out task queue that manages a dedicated pool
- * for each worker as well as a shared queue. The FIFO ordering is guaranteed
- * across the worker specific and shared queue.
- */
-export default class FifoQueue implements TaskQueue {
- private _workerQueues;
- private _sharedQueue;
- enqueue(task: QueueChildMessage, workerId?: number): void;
- dequeue(workerId: number): QueueChildMessage | null;
-}
diff --git i/packages/jest-worker/build/PriorityQueue.d.ts w/packages/jest-worker/build/PriorityQueue.d.ts
deleted file mode 100644
index 789ddcb9af..0000000000
--- i/packages/jest-worker/build/PriorityQueue.d.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {QueueChildMessage, TaskQueue} from './types';
-export declare type ComputeTaskPriorityCallback = (
- method: string,
- ...args: Array<unknown>
-) => number;
-declare type QueueItem = {
- task: QueueChildMessage;
- priority: number;
-};
-/**
- * Priority queue that processes tasks in natural ordering (lower priority first)
- * according to the priority computed by the function passed in the constructor.
- *
- * FIFO ordering isn't guaranteed for tasks with the same priority.
- *
- * Worker specific tasks with the same priority as a non-worker specific task
- * are always processed first.
- */
-export default class PriorityQueue implements TaskQueue {
- private _computePriority;
- private _queue;
- private _sharedQueue;
- constructor(_computePriority: ComputeTaskPriorityCallback);
- enqueue(task: QueueChildMessage, workerId?: number): void;
- _enqueue(task: QueueChildMessage, queue: MinHeap<QueueItem>): void;
- dequeue(workerId: number): QueueChildMessage | null;
- _getWorkerQueue(workerId: number): MinHeap<QueueItem>;
-}
-declare type HeapItem = {
- priority: number;
-};
-declare class MinHeap<TItem extends HeapItem> {
- private _heap;
- peek(): TItem | null;
- add(item: TItem): void;
- poll(): TItem | null;
-}
-export {};
diff --git i/packages/jest-worker/build/WorkerPool.d.ts w/packages/jest-worker/build/WorkerPool.d.ts
deleted file mode 100644
index 8a5fbd3218..0000000000
--- i/packages/jest-worker/build/WorkerPool.d.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import BaseWorkerPool from './base/BaseWorkerPool';
-import type {
- ChildMessage,
- OnCustomMessage,
- OnEnd,
- OnStart,
- WorkerInterface,
- WorkerOptions,
- WorkerPoolInterface,
-} from './types';
-declare class WorkerPool extends BaseWorkerPool implements WorkerPoolInterface {
- send(
- workerId: number,
- request: ChildMessage,
- onStart: OnStart,
- onEnd: OnEnd,
- onCustomMessage: OnCustomMessage,
- ): void;
- createWorker(workerOptions: WorkerOptions): WorkerInterface;
-}
-export default WorkerPool;
diff --git i/packages/jest-worker/build/base/BaseWorkerPool.d.ts w/packages/jest-worker/build/base/BaseWorkerPool.d.ts
deleted file mode 100644
index c217b754ee..0000000000
--- i/packages/jest-worker/build/base/BaseWorkerPool.d.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import {
- PoolExitResult,
- WorkerInterface,
- WorkerOptions,
- WorkerPoolOptions,
-} from '../types';
-export default class BaseWorkerPool {
- private readonly _stderr;
- private readonly _stdout;
- protected readonly _options: WorkerPoolOptions;
- private readonly _workers;
- constructor(workerPath: string, options: WorkerPoolOptions);
- getStderr(): NodeJS.ReadableStream;
- getStdout(): NodeJS.ReadableStream;
- getWorkers(): Array<WorkerInterface>;
- getWorkerById(workerId: number): WorkerInterface;
- createWorker(_workerOptions: WorkerOptions): WorkerInterface;
- end(): Promise<PoolExitResult>;
-}
diff --git i/packages/jest-worker/build/index.d.ts w/packages/jest-worker/build/index.d.ts
index 5cfd81d184..7b1bbaa9ed 100644
--- i/packages/jest-worker/build/index.d.ts
+++ w/packages/jest-worker/build/index.d.ts
@@ -5,16 +5,157 @@
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="node" />
-import type {
- FarmOptions,
- PoolExitResult,
- PromiseWithCustomMessage,
- TaskQueue,
-} from './types';
-export {default as PriorityQueue} from './PriorityQueue';
-export {default as FifoQueue} from './FifoQueue';
-export {default as messageParent} from './workers/messageParent';
-export type {PromiseWithCustomMessage, TaskQueue};
+
+import type {EventEmitter} from 'events';
+import type {ForkOptions} from 'child_process';
+import type {ResourceLimits} from 'worker_threads';
+
+declare const CHILD_MESSAGE_CALL: 1;
+
+declare const CHILD_MESSAGE_END: 2;
+
+declare const CHILD_MESSAGE_INITIALIZE: 0;
+
+declare type ChildMessage =
+ | ChildMessageInitialize
+ | ChildMessageCall
+ | ChildMessageEnd;
+
+declare type ChildMessageCall = [
+ typeof CHILD_MESSAGE_CALL,
+ boolean,
+ string,
+ Array<unknown>,
+];
+
+declare type ChildMessageEnd = [typeof CHILD_MESSAGE_END, boolean];
+
+declare type ChildMessageInitialize = [
+ typeof CHILD_MESSAGE_INITIALIZE,
+ boolean,
+ string,
+ // file
+ Array<unknown> | undefined,
+ // setupArgs
+ MessagePort_2 | undefined,
+];
+
+declare type ComputeTaskPriorityCallback = (
+ method: string,
+ ...args: Array<unknown>
+) => number;
+
+declare type FarmOptions = {
+ computeWorkerKey?: (method: string, ...args: Array<unknown>) => string | null;
+ enableWorkerThreads?: boolean;
+ exposedMethods?: ReadonlyArray<string>;
+ forkOptions?: ForkOptions;
+ maxRetries?: number;
+ numWorkers?: number;
+ resourceLimits?: ResourceLimits;
+ setupArgs?: Array<unknown>;
+ taskQueue?: TaskQueue;
+ WorkerPool?: new (
+ workerPath: string,
+ options?: WorkerPoolOptions,
+ ) => WorkerPoolInterface;
+ workerSchedulingPolicy?: WorkerSchedulingPolicy;
+};
+
+/**
+ * First-in, First-out task queue that manages a dedicated pool
+ * for each worker as well as a shared queue. The FIFO ordering is guaranteed
+ * across the worker specific and shared queue.
+ */
+export declare class FifoQueue implements TaskQueue {
+ private _workerQueues;
+ private _sharedQueue;
+ enqueue(task: QueueChildMessage, workerId?: number): void;
+ dequeue(workerId: number): QueueChildMessage | null;
+}
+
+declare type HeapItem = {
+ priority: number;
+};
+
+export declare function messageParent(
+ message: unknown,
+ parentProcess?: NodeJS.Process,
+): void;
+
+declare type MessagePort_2 = typeof EventEmitter & {
+ postMessage(message: unknown): void;
+};
+
+declare class MinHeap<TItem extends HeapItem> {
+ private _heap;
+ peek(): TItem | null;
+ add(item: TItem): void;
+ poll(): TItem | null;
+}
+
+declare type OnCustomMessage = (message: Array<unknown> | unknown) => void;
+
+declare type OnEnd = (err: Error | null, result: unknown) => void;
+
+declare type OnStart = (worker: WorkerInterface) => void;
+
+declare type PoolExitResult = {
+ forceExited: boolean;
+};
+
+/**
+ * Priority queue that processes tasks in natural ordering (lower priority first)
+ * according to the priority computed by the function passed in the constructor.
+ *
+ * FIFO ordering isn't guaranteed for tasks with the same priority.
+ *
+ * Worker specific tasks with the same priority as a non-worker specific task
+ * are always processed first.
+ */
+export declare class PriorityQueue implements TaskQueue {
+ private _computePriority;
+ private _queue;
+ private _sharedQueue;
+ constructor(_computePriority: ComputeTaskPriorityCallback);
+ enqueue(task: QueueChildMessage, workerId?: number): void;
+ _enqueue(task: QueueChildMessage, queue: MinHeap<QueueItem>): void;
+ dequeue(workerId: number): QueueChildMessage | null;
+ _getWorkerQueue(workerId: number): MinHeap<QueueItem>;
+}
+
+export declare interface PromiseWithCustomMessage<T> extends Promise<T> {
+ UNSTABLE_onCustomMessage?: (listener: OnCustomMessage) => () => void;
+}
+
+declare type QueueChildMessage = {
+ request: ChildMessageCall;
+ onStart: OnStart;
+ onEnd: OnEnd;
+ onCustomMessage: OnCustomMessage;
+};
+
+declare type QueueItem = {
+ task: QueueChildMessage;
+ priority: number;
+};
+
+export declare interface TaskQueue {
+ /**
+ * Enqueues the task in the queue for the specified worker or adds it to the
+ * queue shared by all workers
+ * @param task the task to queue
+ * @param workerId the id of the worker that should process this task or undefined
+ * if there's no preference.
+ */
+ enqueue(task: QueueChildMessage, workerId?: number): void;
+ /**
+ * Dequeues the next item from the queue for the specified worker
+ * @param workerId the id of the worker for which the next task should be retrieved
+ */
+ dequeue(workerId: number): QueueChildMessage | null;
+}
+
/**
* The Jest farm (publicly called "Worker") is a class that allows you to queue
* methods across multiple child processes, in order to parallelize work. This
@@ -40,7 +181,7 @@ export type {PromiseWithCustomMessage, TaskQueue};
* processed by the same worker. This is specially useful if your workers
* are caching results.
*/
-export declare class Worker {
+declare class Worker_2 {
private _ending;
private _farm;
private _options;
@@ -52,3 +193,58 @@ export declare class Worker {
getStdout(): NodeJS.ReadableStream;
end(): Promise<PoolExitResult>;
}
+export {Worker_2 as Worker};
+
+declare type WorkerCallback = (
+ workerId: number,
+ request: ChildMessage,
+ onStart: OnStart,
+ onEnd: OnEnd,
+ onCustomMessage: OnCustomMessage,
+) => void;
+
+declare interface WorkerInterface {
+ send(
+ request: ChildMessage,
+ onProcessStart: OnStart,
+ onProcessEnd: OnEnd,
+ onCustomMessage: OnCustomMessage,
+ ): void;
+ waitForExit(): Promise<void>;
+ forceExit(): void;
+ getWorkerId(): number;
+ getStderr(): NodeJS.ReadableStream | null;
+ getStdout(): NodeJS.ReadableStream | null;
+}
+
+declare type WorkerOptions_2 = {
+ forkOptions: ForkOptions;
+ resourceLimits: ResourceLimits;
+ setupArgs: Array<unknown>;
+ maxRetries: number;
+ workerId: number;
+ workerData?: unknown;
+ workerPath: string;
+};
+
+declare interface WorkerPoolInterface {
+ getStderr(): NodeJS.ReadableStream;
+ getStdout(): NodeJS.ReadableStream;
+ getWorkers(): Array<WorkerInterface>;
+ createWorker(options: WorkerOptions_2): WorkerInterface;
+ send: WorkerCallback;
+ end(): Promise<PoolExitResult>;
+}
+
+declare type WorkerPoolOptions = {
+ setupArgs: Array<unknown>;
+ forkOptions: ForkOptions;
+ resourceLimits: ResourceLimits;
+ maxRetries: number;
+ numWorkers: number;
+ enableWorkerThreads: boolean;
+};
+
+declare type WorkerSchedulingPolicy = 'round-robin' | 'in-order';
+
+export {};
diff --git i/packages/jest-worker/build/types.d.ts w/packages/jest-worker/build/types.d.ts
deleted file mode 100644
index 6df09bf1ff..0000000000
--- i/packages/jest-worker/build/types.d.ts
+++ /dev/null
@@ -1,160 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import type {ForkOptions} from 'child_process';
-import type {EventEmitter} from 'events';
-import type {ResourceLimits} from 'worker_threads';
-export declare type FunctionLike = (
- ...args: Array<unknown>
-) => unknown | Promise<unknown>;
-export declare const CHILD_MESSAGE_INITIALIZE: 0;
-export declare const CHILD_MESSAGE_CALL: 1;
-export declare const CHILD_MESSAGE_END: 2;
-export declare const PARENT_MESSAGE_OK: 0;
-export declare const PARENT_MESSAGE_CLIENT_ERROR: 1;
-export declare const PARENT_MESSAGE_SETUP_ERROR: 2;
-export declare const PARENT_MESSAGE_CUSTOM: 3;
-export declare type PARENT_MESSAGE_ERROR =
- | typeof PARENT_MESSAGE_CLIENT_ERROR
- | typeof PARENT_MESSAGE_SETUP_ERROR;
-export declare type WorkerCallback = (
- workerId: number,
- request: ChildMessage,
- onStart: OnStart,
- onEnd: OnEnd,
- onCustomMessage: OnCustomMessage,
-) => void;
-export interface WorkerPoolInterface {
- getStderr(): NodeJS.ReadableStream;
- getStdout(): NodeJS.ReadableStream;
- getWorkers(): Array<WorkerInterface>;
- createWorker(options: WorkerOptions): WorkerInterface;
- send: WorkerCallback;
- end(): Promise<PoolExitResult>;
-}
-export interface WorkerInterface {
- send(
- request: ChildMessage,
- onProcessStart: OnStart,
- onProcessEnd: OnEnd,
- onCustomMessage: OnCustomMessage,
- ): void;
- waitForExit(): Promise<void>;
- forceExit(): void;
- getWorkerId(): number;
- getStderr(): NodeJS.ReadableStream | null;
- getStdout(): NodeJS.ReadableStream | null;
-}
-export declare type PoolExitResult = {
- forceExited: boolean;
-};
-export interface PromiseWithCustomMessage<T> extends Promise<T> {
- UNSTABLE_onCustomMessage?: (listener: OnCustomMessage) => () => void;
-}
-export interface TaskQueue {
- /**
- * Enqueues the task in the queue for the specified worker or adds it to the
- * queue shared by all workers
- * @param task the task to queue
- * @param workerId the id of the worker that should process this task or undefined
- * if there's no preference.
- */
- enqueue(task: QueueChildMessage, workerId?: number): void;
- /**
- * Dequeues the next item from the queue for the specified worker
- * @param workerId the id of the worker for which the next task should be retrieved
- */
- dequeue(workerId: number): QueueChildMessage | null;
-}
-export declare type WorkerSchedulingPolicy = 'round-robin' | 'in-order';
-export declare type FarmOptions = {
- computeWorkerKey?: (method: string, ...args: Array<unknown>) => string | null;
- enableWorkerThreads?: boolean;
- exposedMethods?: ReadonlyArray<string>;
- forkOptions?: ForkOptions;
- maxRetries?: number;
- numWorkers?: number;
- resourceLimits?: ResourceLimits;
- setupArgs?: Array<unknown>;
- taskQueue?: TaskQueue;
- WorkerPool?: new (
- workerPath: string,
- options?: WorkerPoolOptions,
- ) => WorkerPoolInterface;
- workerSchedulingPolicy?: WorkerSchedulingPolicy;
-};
-export declare type WorkerPoolOptions = {
- setupArgs: Array<unknown>;
- forkOptions: ForkOptions;
- resourceLimits: ResourceLimits;
- maxRetries: number;
- numWorkers: number;
- enableWorkerThreads: boolean;
-};
-export declare type WorkerOptions = {
- forkOptions: ForkOptions;
- resourceLimits: ResourceLimits;
- setupArgs: Array<unknown>;
- maxRetries: number;
- workerId: number;
- workerData?: unknown;
- workerPath: string;
-};
-export declare type MessagePort = typeof EventEmitter & {
- postMessage(message: unknown): void;
-};
-export declare type MessageChannel = {
- port1: MessagePort;
- port2: MessagePort;
-};
-export declare type ChildMessageInitialize = [
- typeof CHILD_MESSAGE_INITIALIZE,
- boolean,
- string,
- // file
- Array<unknown> | undefined,
- // setupArgs
- MessagePort | undefined,
-];
-export declare type ChildMessageCall = [
- typeof CHILD_MESSAGE_CALL,
- boolean,
- string,
- Array<unknown>,
-];
-export declare type ChildMessageEnd = [typeof CHILD_MESSAGE_END, boolean];
-export declare type ChildMessage =
- | ChildMessageInitialize
- | ChildMessageCall
- | ChildMessageEnd;
-export declare type ParentMessageCustom = [
- typeof PARENT_MESSAGE_CUSTOM,
- unknown,
-];
-export declare type ParentMessageOk = [typeof PARENT_MESSAGE_OK, unknown];
-export declare type ParentMessageError = [
- PARENT_MESSAGE_ERROR,
- string,
- string,
- string,
- unknown,
-];
-export declare type ParentMessage =
- | ParentMessageOk
- | ParentMessageError
- | ParentMessageCustom;
-export declare type OnStart = (worker: WorkerInterface) => void;
-export declare type OnEnd = (err: Error | null, result: unknown) => void;
-export declare type OnCustomMessage = (
- message: Array<unknown> | unknown,
-) => void;
-export declare type QueueChildMessage = {
- request: ChildMessageCall;
- onStart: OnStart;
- onEnd: OnEnd;
- onCustomMessage: OnCustomMessage;
-};
diff --git i/packages/jest-worker/build/workers/ChildProcessWorker.d.ts w/packages/jest-worker/build/workers/ChildProcessWorker.d.ts
deleted file mode 100644
index 5b72c5089a..0000000000
--- i/packages/jest-worker/build/workers/ChildProcessWorker.d.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import {
- ChildMessage,
- OnCustomMessage,
- OnEnd,
- OnStart,
- WorkerInterface,
- WorkerOptions,
-} from '../types';
-/**
- * This class wraps the child process and provides a nice interface to
- * communicate with. It takes care of:
- *
- * - Re-spawning the process if it dies.
- * - Queues calls while the worker is busy.
- * - Re-sends the requests if the worker blew up.
- *
- * The reason for queueing them here (since childProcess.send also has an
- * internal queue) is because the worker could be doing asynchronous work, and
- * this would lead to the child process to read its receiving buffer and start a
- * second call. By queueing calls here, we don't send the next call to the
- * children until we receive the result of the previous one.
- *
- * As soon as a request starts to be processed by a worker, its "processed"
- * field is changed to "true", so that other workers which might encounter the
- * same call skip it.
- */
-export default class ChildProcessWorker implements WorkerInterface {
- private _child;
- private _options;
- private _request;
- private _retries;
- private _onProcessEnd;
- private _onCustomMessage;
- private _fakeStream;
- private _stdout;
- private _stderr;
- private _exitPromise;
- private _resolveExitPromise;
- constructor(options: WorkerOptions);
- initialize(): void;
- private _shutdown;
- private _onMessage;
- private _onExit;
- send(
- request: ChildMessage,
- onProcessStart: OnStart,
- onProcessEnd: OnEnd,
- onCustomMessage: OnCustomMessage,
- ): void;
- waitForExit(): Promise<void>;
- forceExit(): void;
- getWorkerId(): number;
- getStdout(): NodeJS.ReadableStream | null;
- getStderr(): NodeJS.ReadableStream | null;
- private _getFakeStream;
-}
diff --git i/packages/jest-worker/build/workers/NodeThreadsWorker.d.ts w/packages/jest-worker/build/workers/NodeThreadsWorker.d.ts
deleted file mode 100644
index e3029c1181..0000000000
--- i/packages/jest-worker/build/workers/NodeThreadsWorker.d.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-import {
- ChildMessage,
- OnCustomMessage,
- OnEnd,
- OnStart,
- WorkerInterface,
- WorkerOptions,
-} from '../types';
-export default class ExperimentalWorker implements WorkerInterface {
- private _worker;
- private _options;
- private _request;
- private _retries;
- private _onProcessEnd;
- private _onCustomMessage;
- private _fakeStream;
- private _stdout;
- private _stderr;
- private _exitPromise;
- private _resolveExitPromise;
- private _forceExited;
- constructor(options: WorkerOptions);
- initialize(): void;
- private _shutdown;
- private _onMessage;
- private _onExit;
- waitForExit(): Promise<void>;
- forceExit(): void;
- send(
- request: ChildMessage,
- onProcessStart: OnStart,
- onProcessEnd: OnEnd | null,
- onCustomMessage: OnCustomMessage,
- ): void;
- getWorkerId(): number;
- getStdout(): NodeJS.ReadableStream | null;
- getStderr(): NodeJS.ReadableStream | null;
- private _getFakeStream;
-}
diff --git i/packages/jest-worker/build/workers/messageParent.d.ts w/packages/jest-worker/build/workers/messageParent.d.ts
deleted file mode 100644
index 6987246150..0000000000
--- i/packages/jest-worker/build/workers/messageParent.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-/// <reference types="node" />
-export default function messageParent(
- message: unknown,
- parentProcess?: NodeJS.Process,
-): void;
diff --git i/packages/jest-worker/build/workers/processChild.d.ts w/packages/jest-worker/build/workers/processChild.d.ts
deleted file mode 100644
index fac0c7e359..0000000000
--- i/packages/jest-worker/build/workers/processChild.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export {};
diff --git i/packages/jest-worker/build/workers/threadChild.d.ts w/packages/jest-worker/build/workers/threadChild.d.ts
deleted file mode 100644
index fac0c7e359..0000000000
--- i/packages/jest-worker/build/workers/threadChild.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export {};
diff --git i/packages/jest/build/index.d.ts w/packages/jest/build/index.d.ts
index 169a0acf7b..010e792895 100644
--- i/packages/jest/build/index.d.ts
+++ w/packages/jest/build/index.d.ts
@@ -4,11 +4,23 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-export {
- SearchSource,
- TestWatcher,
- createTestScheduler,
- getVersion,
- runCLI,
-} from '@jest/core';
-export {run} from 'jest-cli';
+import {createTestScheduler} from '@jest/core';
+import {getVersion} from '@jest/core';
+import {run} from 'jest-cli';
+import {runCLI} from '@jest/core';
+import {SearchSource} from '@jest/core';
+import {TestWatcher} from '@jest/core';
+
+export {createTestScheduler};
+
+export {getVersion};
+
+export {run};
+
+export {runCLI};
+
+export {SearchSource};
+
+export {TestWatcher};
+
+export {};
diff --git i/packages/pretty-format/build/collections.d.ts w/packages/pretty-format/build/collections.d.ts
deleted file mode 100644
index 0260a938b9..0000000000
--- i/packages/pretty-format/build/collections.d.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-import type {Config, Printer, Refs} from './types';
-/**
- * Return entries (for example, of a map)
- * with spacing, indentation, and comma
- * without surrounding punctuation (for example, braces)
- */
-export declare function printIteratorEntries(
- iterator: Iterator<[unknown, unknown]>,
- config: Config,
- indentation: string,
- depth: number,
- refs: Refs,
- printer: Printer,
- separator?: string,
-): string;
-/**
- * Return values (for example, of a set)
- * with spacing, indentation, and comma
- * without surrounding punctuation (braces or brackets)
- */
-export declare function printIteratorValues(
- iterator: Iterator<unknown>,
- config: Config,
- indentation: string,
- depth: number,
- refs: Refs,
- printer: Printer,
-): string;
-/**
- * Return items (for example, of an array)
- * with spacing, indentation, and comma
- * without surrounding punctuation (for example, brackets)
- **/
-export declare function printListItems(
- list: ArrayLike<unknown>,
- config: Config,
- indentation: string,
- depth: number,
- refs: Refs,
- printer: Printer,
-): string;
-/**
- * Return properties of an object
- * with spacing, indentation, and comma
- * without surrounding punctuation (for example, braces)
- */
-export declare function printObjectProperties(
- val: Record<string, unknown>,
- config: Config,
- indentation: string,
- depth: number,
- refs: Refs,
- printer: Printer,
-): string;
diff --git i/packages/pretty-format/build/index.d.ts w/packages/pretty-format/build/index.d.ts
index e7420eac7b..afce9301c0 100644
--- i/packages/pretty-format/build/index.d.ts
+++ w/packages/pretty-format/build/index.d.ts
@@ -4,29 +4,114 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-import type {NewPlugin, Options, OptionsReceived} from './types';
-export type {
- Colors,
- CompareKeys,
- Config,
- Options,
- OptionsReceived,
- OldPlugin,
- NewPlugin,
- Plugin,
- Plugins,
- PrettyFormatOptions,
- Printer,
- Refs,
- Theme,
-} from './types';
+
+export declare type Colors = {
+ comment: {
+ close: string;
+ open: string;
+ };
+ content: {
+ close: string;
+ open: string;
+ };
+ prop: {
+ close: string;
+ open: string;
+ };
+ tag: {
+ close: string;
+ open: string;
+ };
+ value: {
+ close: string;
+ open: string;
+ };
+};
+
+export declare type CompareKeys =
+ | ((a: string, b: string) => number)
+ | undefined;
+
+export declare type Config = {
+ callToJSON: boolean;
+ compareKeys: CompareKeys;
+ colors: Colors;
+ escapeRegex: boolean;
+ escapeString: boolean;
+ indent: string;
+ maxDepth: number;
+ min: boolean;
+ plugins: Plugins;
+ printBasicPrototype: boolean;
+ printFunctionName: boolean;
+ spacingInner: string;
+ spacingOuter: string;
+};
+
export declare const DEFAULT_OPTIONS: Options;
+
/**
* Returns a presentation string of your `val` object
* @param val any potential JavaScript object
* @param options Custom settings
*/
-export declare function format(val: unknown, options?: OptionsReceived): string;
+declare function format(val: unknown, options?: OptionsReceived): string;
+export default format;
+export {format};
+
+declare type Indent = (arg0: string) => string;
+
+export declare type NewPlugin = {
+ serialize: (
+ val: any,
+ config: Config,
+ indentation: string,
+ depth: number,
+ refs: Refs,
+ printer: Printer,
+ ) => string;
+ test: Test;
+};
+
+export declare type OldPlugin = {
+ print: (
+ val: unknown,
+ print: Print,
+ indent: Indent,
+ options: PluginOptions,
+ colors: Colors,
+ ) => string;
+ test: Test;
+};
+
+export declare type Options = {
+ callToJSON: boolean;
+ compareKeys: CompareKeys;
+ escapeRegex: boolean;
+ escapeString: boolean;
+ highlight: boolean;
+ indent: number;
+ maxDepth: number;
+ min: boolean;
+ plugins: Plugins;
+ printBasicPrototype: boolean;
+ printFunctionName: boolean;
+ theme: Theme;
+};
+
+export declare type OptionsReceived = PrettyFormatOptions;
+
+declare type Plugin_2 = NewPlugin | OldPlugin;
+export {Plugin_2 as Plugin};
+
+declare type PluginOptions = {
+ edgeSpacing: string;
+ min: boolean;
+ spacing: string;
+};
+
+export declare type Plugins = Array<Plugin_2>;
+
export declare const plugins: {
AsymmetricMatcher: NewPlugin;
ConvertAnsi: NewPlugin;
@@ -36,4 +121,51 @@ export declare const plugins: {
ReactElement: NewPlugin;
ReactTestComponent: NewPlugin;
};
-export default format;
+
+export declare interface PrettyFormatOptions {
+ callToJSON?: boolean;
+ compareKeys?: CompareKeys;
+ escapeRegex?: boolean;
+ escapeString?: boolean;
+ highlight?: boolean;
+ indent?: number;
+ maxDepth?: number;
+ min?: boolean;
+ plugins?: Plugins;
+ printBasicPrototype?: boolean;
+ printFunctionName?: boolean;
+ theme?: ThemeReceived;
+}
+
+declare type Print = (arg0: unknown) => string;
+
+export declare type Printer = (
+ val: unknown,
+ config: Config,
+ indentation: string,
+ depth: number,
+ refs: Refs,
+ hasCalledToJSON?: boolean,
+) => string;
+
+export declare type Refs = Array<unknown>;
+
+declare type Test = (arg0: any) => boolean;
+
+export declare type Theme = {
+ comment: string;
+ content: string;
+ prop: string;
+ tag: string;
+ value: string;
+};
+
+declare type ThemeReceived = {
+ comment?: string;
+ content?: string;
+ prop?: string;
+ tag?: string;
+ value?: string;
+};
+
+export {};
diff --git i/packages/pretty-format/build/plugins/AsymmetricMatcher.d.ts w/packages/pretty-format/build/plugins/AsymmetricMatcher.d.ts
deleted file mode 100644
index fcb61a2d50..0000000000
--- i/packages/pretty-format/build/plugins/AsymmetricMatcher.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {NewPlugin} from '../types';
-export declare const serialize: NewPlugin['serialize'];
-export declare const test: NewPlugin['test'];
-declare const plugin: NewPlugin;
-export default plugin;
diff --git i/packages/pretty-format/build/plugins/ConvertAnsi.d.ts w/packages/pretty-format/build/plugins/ConvertAnsi.d.ts
deleted file mode 100644
index 3e12db09d3..0000000000
--- i/packages/pretty-format/build/plugins/ConvertAnsi.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {NewPlugin} from '../types';
-export declare const test: NewPlugin['test'];
-export declare const serialize: NewPlugin['serialize'];
-declare const plugin: NewPlugin;
-export default plugin;
diff --git i/packages/pretty-format/build/plugins/DOMCollection.d.ts w/packages/pretty-format/build/plugins/DOMCollection.d.ts
deleted file mode 100644
index 3e12db09d3..0000000000
--- i/packages/pretty-format/build/plugins/DOMCollection.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {NewPlugin} from '../types';
-export declare const test: NewPlugin['test'];
-export declare const serialize: NewPlugin['serialize'];
-declare const plugin: NewPlugin;
-export default plugin;
diff --git i/packages/pretty-format/build/plugins/DOMElement.d.ts w/packages/pretty-format/build/plugins/DOMElement.d.ts
deleted file mode 100644
index 3e12db09d3..0000000000
--- i/packages/pretty-format/build/plugins/DOMElement.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {NewPlugin} from '../types';
-export declare const test: NewPlugin['test'];
-export declare const serialize: NewPlugin['serialize'];
-declare const plugin: NewPlugin;
-export default plugin;
diff --git i/packages/pretty-format/build/plugins/Immutable.d.ts w/packages/pretty-format/build/plugins/Immutable.d.ts
deleted file mode 100644
index fcb61a2d50..0000000000
--- i/packages/pretty-format/build/plugins/Immutable.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {NewPlugin} from '../types';
-export declare const serialize: NewPlugin['serialize'];
-export declare const test: NewPlugin['test'];
-declare const plugin: NewPlugin;
-export default plugin;
diff --git i/packages/pretty-format/build/plugins/ReactElement.d.ts w/packages/pretty-format/build/plugins/ReactElement.d.ts
deleted file mode 100644
index fcb61a2d50..0000000000
--- i/packages/pretty-format/build/plugins/ReactElement.d.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {NewPlugin} from '../types';
-export declare const serialize: NewPlugin['serialize'];
-export declare const test: NewPlugin['test'];
-declare const plugin: NewPlugin;
-export default plugin;
diff --git i/packages/pretty-format/build/plugins/ReactTestComponent.d.ts w/packages/pretty-format/build/plugins/ReactTestComponent.d.ts
deleted file mode 100644
index 67e96d6c36..0000000000
--- i/packages/pretty-format/build/plugins/ReactTestComponent.d.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {NewPlugin} from '../types';
-export declare type ReactTestObject = {
- $$typeof: symbol;
- type: string;
- props?: Record<string, unknown>;
- children?: null | Array<ReactTestChild>;
-};
-declare type ReactTestChild = ReactTestObject | string | number;
-export declare const serialize: NewPlugin['serialize'];
-export declare const test: NewPlugin['test'];
-declare const plugin: NewPlugin;
-export default plugin;
diff --git i/packages/pretty-format/build/plugins/lib/escapeHTML.d.ts w/packages/pretty-format/build/plugins/lib/escapeHTML.d.ts
deleted file mode 100644
index aee0d3d063..0000000000
--- i/packages/pretty-format/build/plugins/lib/escapeHTML.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export default function escapeHTML(str: string): string;
diff --git i/packages/pretty-format/build/plugins/lib/markup.d.ts w/packages/pretty-format/build/plugins/lib/markup.d.ts
deleted file mode 100644
index 464f90f4e0..0000000000
--- i/packages/pretty-format/build/plugins/lib/markup.d.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config, Printer, Refs} from '../../types';
-export declare const printProps: (
- keys: Array<string>,
- props: Record<string, unknown>,
- config: Config,
- indentation: string,
- depth: number,
- refs: Refs,
- printer: Printer,
-) => string;
-export declare const printChildren: (
- children: Array<unknown>,
- config: Config,
- indentation: string,
- depth: number,
- refs: Refs,
- printer: Printer,
-) => string;
-export declare const printText: (text: string, config: Config) => string;
-export declare const printComment: (comment: string, config: Config) => string;
-export declare const printElement: (
- type: string,
- printedProps: string,
- printedChildren: string,
- config: Config,
- indentation: string,
-) => string;
-export declare const printElementAsLeaf: (
- type: string,
- config: Config,
-) => string;
diff --git i/packages/pretty-format/build/types.d.ts w/packages/pretty-format/build/types.d.ts
deleted file mode 100644
index f1ffb497d5..0000000000
--- i/packages/pretty-format/build/types.d.ts
+++ /dev/null
@@ -1,130 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare type Colors = {
- comment: {
- close: string;
- open: string;
- };
- content: {
- close: string;
- open: string;
- };
- prop: {
- close: string;
- open: string;
- };
- tag: {
- close: string;
- open: string;
- };
- value: {
- close: string;
- open: string;
- };
-};
-declare type Indent = (arg0: string) => string;
-export declare type Refs = Array<unknown>;
-declare type Print = (arg0: unknown) => string;
-export declare type Theme = {
- comment: string;
- content: string;
- prop: string;
- tag: string;
- value: string;
-};
-declare type ThemeReceived = {
- comment?: string;
- content?: string;
- prop?: string;
- tag?: string;
- value?: string;
-};
-export declare type CompareKeys =
- | ((a: string, b: string) => number)
- | undefined;
-export declare type Options = {
- callToJSON: boolean;
- compareKeys: CompareKeys;
- escapeRegex: boolean;
- escapeString: boolean;
- highlight: boolean;
- indent: number;
- maxDepth: number;
- min: boolean;
- plugins: Plugins;
- printBasicPrototype: boolean;
- printFunctionName: boolean;
- theme: Theme;
-};
-export interface PrettyFormatOptions {
- callToJSON?: boolean;
- compareKeys?: CompareKeys;
- escapeRegex?: boolean;
- escapeString?: boolean;
- highlight?: boolean;
- indent?: number;
- maxDepth?: number;
- min?: boolean;
- plugins?: Plugins;
- printBasicPrototype?: boolean;
- printFunctionName?: boolean;
- theme?: ThemeReceived;
-}
-export declare type OptionsReceived = PrettyFormatOptions;
-export declare type Config = {
- callToJSON: boolean;
- compareKeys: CompareKeys;
- colors: Colors;
- escapeRegex: boolean;
- escapeString: boolean;
- indent: string;
- maxDepth: number;
- min: boolean;
- plugins: Plugins;
- printBasicPrototype: boolean;
- printFunctionName: boolean;
- spacingInner: string;
- spacingOuter: string;
-};
-export declare type Printer = (
- val: unknown,
- config: Config,
- indentation: string,
- depth: number,
- refs: Refs,
- hasCalledToJSON?: boolean,
-) => string;
-declare type Test = (arg0: any) => boolean;
-export declare type NewPlugin = {
- serialize: (
- val: any,
- config: Config,
- indentation: string,
- depth: number,
- refs: Refs,
- printer: Printer,
- ) => string;
- test: Test;
-};
-declare type PluginOptions = {
- edgeSpacing: string;
- min: boolean;
- spacing: string;
-};
-export declare type OldPlugin = {
- print: (
- val: unknown,
- print: Print,
- indent: Indent,
- options: PluginOptions,
- colors: Colors,
- ) => string;
- test: Test;
-};
-export declare type Plugin = NewPlugin | OldPlugin;
-export declare type Plugins = Array<Plugin>;
-export {};
diff --git i/packages/test-utils/build/ConditionalTest.d.ts w/packages/test-utils/build/ConditionalTest.d.ts
deleted file mode 100644
index c6953be7e6..0000000000
--- i/packages/test-utils/build/ConditionalTest.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-export declare function isJestJasmineRun(): boolean;
-export declare function skipSuiteOnJasmine(): void;
-export declare function skipSuiteOnJestCircus(): void;
-export declare function onNodeVersions(
- versionRange: string,
- testBody: () => void,
-): void;
diff --git i/packages/test-utils/build/alignedAnsiStyleSerializer.d.ts w/packages/test-utils/build/alignedAnsiStyleSerializer.d.ts
deleted file mode 100644
index e57d0bf8fc..0000000000
--- i/packages/test-utils/build/alignedAnsiStyleSerializer.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {NewPlugin} from 'pretty-format';
-export declare const alignedAnsiStyleSerializer: NewPlugin;
diff --git i/packages/test-utils/build/config.d.ts w/packages/test-utils/build/config.d.ts
deleted file mode 100644
index ad53801966..0000000000
--- i/packages/test-utils/build/config.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-import type {Config} from '@jest/types';
-export declare const makeGlobalConfig: (
- overrides?: Partial<Config.GlobalConfig>,
-) => Config.GlobalConfig;
-export declare const makeProjectConfig: (
- overrides?: Partial<Config.ProjectConfig>,
-) => Config.ProjectConfig;
diff --git i/packages/test-utils/build/index.d.ts w/packages/test-utils/build/index.d.ts
index 1c7cab9864..a09c4c637d 100644
--- i/packages/test-utils/build/index.d.ts
+++ w/packages/test-utils/build/index.d.ts
@@ -4,11 +4,28 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-export {alignedAnsiStyleSerializer} from './alignedAnsiStyleSerializer';
-export {
- isJestJasmineRun,
- skipSuiteOnJasmine,
- skipSuiteOnJestCircus,
- onNodeVersions,
-} from './ConditionalTest';
-export {makeGlobalConfig, makeProjectConfig} from './config';
+import type {Config} from '@jest/types';
+import type {NewPlugin} from 'pretty-format';
+
+export declare const alignedAnsiStyleSerializer: NewPlugin;
+
+export declare function isJestJasmineRun(): boolean;
+
+export declare const makeGlobalConfig: (
+ overrides?: Partial<Config.GlobalConfig>,
+) => Config.GlobalConfig;
+
+export declare const makeProjectConfig: (
+ overrides?: Partial<Config.ProjectConfig>,
+) => Config.ProjectConfig;
+
+export declare function onNodeVersions(
+ versionRange: string,
+ testBody: () => void,
+): void;
+
+export declare function skipSuiteOnJasmine(): void;
+
+export declare function skipSuiteOnJestCircus(): void;
+
+export {};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment