Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(@jest/test-result, @jest/types)!: replace Bytes and Milliseconds types with number #13155

Merged
merged 3 commits into from
Aug 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- `[jest-mock]` [**BREAKING**] Refactor `Mocked*` utility types. `MaybeMockedDeep` and `MaybeMocked` became `Mocked` and `MockedShallow` respectively; only deep mocked variants of `MockedClass`, `MockedFunction` and `MockedObject` are exported ([#13123](https://github.com/facebook/jest/pull/13123), [#13124](https://github.com/facebook/jest/pull/13124))
- `[jest-mock]` [**BREAKING**] Change the default `jest.mocked` helper’s behavior to deep mocked ([#13125](https://github.com/facebook/jest/pull/13125))
- `[jest-snapshot]` [**BREAKING**] Let `babel` find config when updating inline snapshots ([#13150](https://github.com/facebook/jest/pull/13150))
- `[@jest/test-result, @jest/types]` [**BREAKING**] Replace `Bytes` and `Milliseconds` types with `number` ([#13155](https://github.com/facebook/jest/pull/13155))
- `[jest-worker]` Adds `workerIdleMemoryLimit` option which is used as a check for worker memory leaks >= Node 16.11.0 and recycles child workers as required ([#13056](https://github.com/facebook/jest/pull/13056), [#13105](https://github.com/facebook/jest/pull/13105), [#13106](https://github.com/facebook/jest/pull/13106), [#13107](https://github.com/facebook/jest/pull/13107))
- `[pretty-format]` [**BREAKING**] Remove `ConvertAnsi` plugin in favour of `jest-serializer-ansi-escapes` ([#13040](https://github.com/facebook/jest/pull/13040))

Expand Down
4 changes: 2 additions & 2 deletions packages/jest-jasmine2/src/jasmine/Spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/* eslint-disable sort-keys, local/prefer-spread-eventually, local/prefer-rest-params-eventually, @typescript-eslint/no-empty-function */

import {AssertionError} from 'assert';
import type {FailedAssertion, Milliseconds, Status} from '@jest/test-result';
import type {FailedAssertion, Status} from '@jest/test-result';
import type {Circus} from '@jest/types';
import {convertDescriptorToString} from 'jest-util';
import ExpectationFailed from '../ExpectationFailed';
Expand Down Expand Up @@ -63,7 +63,7 @@ export type SpecResult = {
id: string;
description: string;
fullName: string;
duration?: Milliseconds;
duration?: number;
failedExpectations: Array<FailedAssertion>;
testPath: string;
passedExpectations: Array<ReturnType<typeof expectationResultFactory>>;
Expand Down
1 change: 0 additions & 1 deletion packages/jest-test-result/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export type {
AssertionResult,
FailedAssertion,
FormattedTestResults,
Milliseconds,
RuntimeTransformResult,
SerializableError,
SnapshotSummary,
Expand Down
12 changes: 4 additions & 8 deletions packages/jest-test-result/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ export type AssertionLocation = {

export type Status = AssertionResult['status'];

export type Bytes = number;

export type Milliseconds = TestResult.Milliseconds;

export type AssertionResult = TestResult.AssertionResult;

export type FormattedAssertionResult = Pick<
Expand Down Expand Up @@ -96,17 +92,17 @@ export type TestResult = {
displayName?: Config.DisplayName;
failureMessage?: string | null;
leaks: boolean;
memoryUsage?: Bytes;
memoryUsage?: number;
numFailingTests: number;
numPassingTests: number;
numPendingTests: number;
numTodoTests: number;
openHandles: Array<Error>;
perfStats: {
end: Milliseconds;
runtime: Milliseconds;
end: number;
runtime: number;
slow: boolean;
start: Milliseconds;
start: number;
};
skipped: boolean;
snapshot: {
Expand Down
4 changes: 1 addition & 3 deletions packages/jest-types/src/TestResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

export type Milliseconds = number;

type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled';

type Callsite = {
Expand All @@ -17,7 +15,7 @@ type Callsite = {
// this is here to make it possible to avoid huge dependency trees just for types
export type AssertionResult = {
ancestorTitles: Array<string>;
duration?: Milliseconds | null;
duration?: number | null;
failureDetails: Array<unknown>;
failureMessages: Array<string>;
fullName: string;
Expand Down