Skip to content

Commit

Permalink
feat(@jest/test-result, @jest/types)!: replace Bytes and `Milliseco…
Browse files Browse the repository at this point in the history
…nds` types with `number` (#13155)
  • Loading branch information
mrazauskas authored Aug 20, 2022
1 parent 4def94b commit 3bef02e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 14 deletions.
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

0 comments on commit 3bef02e

Please sign in to comment.