Skip to content

Commit f11c366

Browse files
authored
chore: move TransformResult to types package (#9747)
1 parent c1bea10 commit f11c366

7 files changed

Lines changed: 21 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
### Chore & Maintenance
88

9+
- `[@jest/test-result]` Remove dependency on `@jest/transform`, which lead to a sprawling dependency tree ([#9747](https://github.com/facebook/jest/pull/9747))
910
- `[@jest/transform]` Expose type `TransformedSource` ([#9736](https://github.com/facebook/jest/pull/9736))
1011

1112
### Performance

packages/jest-test-result/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
},
1919
"dependencies": {
2020
"@jest/console": "^25.2.3",
21-
"@jest/transform": "^25.2.4",
2221
"@jest/types": "^25.2.3",
2322
"@types/istanbul-lib-coverage": "^2.0.0",
2423
"collect-v8-coverage": "^1.0.0"

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77

88
import type {CoverageMap, CoverageMapData} from 'istanbul-lib-coverage';
99
import type {ConsoleBuffer} from '@jest/console';
10-
import type {Config} from '@jest/types';
10+
import type {Config, TransformTypes} from '@jest/types';
1111
import type {V8Coverage} from 'collect-v8-coverage';
12-
import type {TransformResult} from '@jest/transform';
1312

1413
export type V8CoverageResult = Array<{
15-
codeTransformResult: TransformResult | undefined;
14+
codeTransformResult: TransformTypes.TransformResult | undefined;
1615
result: V8Coverage[number];
1716
}>;
1817

packages/jest-test-result/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
},
77
"references": [
88
{"path": "../jest-console"},
9-
{"path": "../jest-transform"},
109
{"path": "../jest-types"}
1110
]
1211
}

packages/jest-transform/src/types.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import type {RawSourceMap} from 'source-map';
9-
import type {Config} from '@jest/types';
9+
import type {Config, TransformTypes} from '@jest/types';
1010

1111
export type ShouldInstrumentOptions = Pick<
1212
Config.GlobalConfig,
@@ -36,12 +36,7 @@ export type TransformedSource =
3636
| {code: string; map?: FixedRawSourceMap | string | null}
3737
| string;
3838

39-
export type TransformResult = {
40-
code: string;
41-
originalCode: string;
42-
mapCoverage: boolean;
43-
sourceMapPath: string | null;
44-
};
39+
export type TransformResult = TransformTypes.TransformResult;
4540

4641
export type TransformOptions = {
4742
instrument: boolean;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
// this is here to make it possible to avoid huge dependency trees just for types
9+
export type TransformResult = {
10+
code: string;
11+
originalCode: string;
12+
mapCoverage: boolean;
13+
sourceMapPath: string | null;
14+
};

packages/jest-types/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
import type * as Circus from './Circus';
99
import type * as Config from './Config';
1010
import type * as Global from './Global';
11+
import type * as TransformTypes from './Transform';
1112

12-
export type {Circus, Config, Global};
13+
export type {Circus, Config, Global, TransformTypes};

0 commit comments

Comments
 (0)