Skip to content

Commit 3bef02e

Browse files
authoredAug 20, 2022
feat(@jest/test-result, @jest/types)!: replace Bytes and Milliseconds types with number (#13155)
1 parent 4def94b commit 3bef02e

File tree

5 files changed

+8
-14
lines changed

5 files changed

+8
-14
lines changed
 

‎CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- `[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))
1111
- `[jest-mock]` [**BREAKING**] Change the default `jest.mocked` helper’s behavior to deep mocked ([#13125](https://github.com/facebook/jest/pull/13125))
1212
- `[jest-snapshot]` [**BREAKING**] Let `babel` find config when updating inline snapshots ([#13150](https://github.com/facebook/jest/pull/13150))
13+
- `[@jest/test-result, @jest/types]` [**BREAKING**] Replace `Bytes` and `Milliseconds` types with `number` ([#13155](https://github.com/facebook/jest/pull/13155))
1314
- `[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))
1415
- `[pretty-format]` [**BREAKING**] Remove `ConvertAnsi` plugin in favour of `jest-serializer-ansi-escapes` ([#13040](https://github.com/facebook/jest/pull/13040))
1516

‎packages/jest-jasmine2/src/jasmine/Spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3131
/* eslint-disable sort-keys, local/prefer-spread-eventually, local/prefer-rest-params-eventually, @typescript-eslint/no-empty-function */
3232

3333
import {AssertionError} from 'assert';
34-
import type {FailedAssertion, Milliseconds, Status} from '@jest/test-result';
34+
import type {FailedAssertion, Status} from '@jest/test-result';
3535
import type {Circus} from '@jest/types';
3636
import {convertDescriptorToString} from 'jest-util';
3737
import ExpectationFailed from '../ExpectationFailed';
@@ -63,7 +63,7 @@ export type SpecResult = {
6363
id: string;
6464
description: string;
6565
fullName: string;
66-
duration?: Milliseconds;
66+
duration?: number;
6767
failedExpectations: Array<FailedAssertion>;
6868
testPath: string;
6969
passedExpectations: Array<ReturnType<typeof expectationResultFactory>>;

‎packages/jest-test-result/src/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export type {
1818
AssertionResult,
1919
FailedAssertion,
2020
FormattedTestResults,
21-
Milliseconds,
2221
RuntimeTransformResult,
2322
SerializableError,
2423
SnapshotSummary,

‎packages/jest-test-result/src/types.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ export type AssertionLocation = {
4242

4343
export type Status = AssertionResult['status'];
4444

45-
export type Bytes = number;
46-
47-
export type Milliseconds = TestResult.Milliseconds;
48-
4945
export type AssertionResult = TestResult.AssertionResult;
5046

5147
export type FormattedAssertionResult = Pick<
@@ -96,17 +92,17 @@ export type TestResult = {
9692
displayName?: Config.DisplayName;
9793
failureMessage?: string | null;
9894
leaks: boolean;
99-
memoryUsage?: Bytes;
95+
memoryUsage?: number;
10096
numFailingTests: number;
10197
numPassingTests: number;
10298
numPendingTests: number;
10399
numTodoTests: number;
104100
openHandles: Array<Error>;
105101
perfStats: {
106-
end: Milliseconds;
107-
runtime: Milliseconds;
102+
end: number;
103+
runtime: number;
108104
slow: boolean;
109-
start: Milliseconds;
105+
start: number;
110106
};
111107
skipped: boolean;
112108
snapshot: {

‎packages/jest-types/src/TestResult.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
export type Milliseconds = number;
9-
108
type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled';
119

1210
type Callsite = {
@@ -17,7 +15,7 @@ type Callsite = {
1715
// this is here to make it possible to avoid huge dependency trees just for types
1816
export type AssertionResult = {
1917
ancestorTitles: Array<string>;
20-
duration?: Milliseconds | null;
18+
duration?: number | null;
2119
failureDetails: Array<unknown>;
2220
failureMessages: Array<string>;
2321
fullName: string;

0 commit comments

Comments
 (0)
Please sign in to comment.