Skip to content

Commit

Permalink
chore: move TransformResult to types package
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Apr 2, 2020
1 parent c1bea10 commit 9671837
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

### Chore & Maintenance

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

### Performance
Expand Down
1 change: 0 additions & 1 deletion packages/jest-test-result/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
},
"dependencies": {
"@jest/console": "^25.2.3",
"@jest/transform": "^25.2.4",
"@jest/types": "^25.2.3",
"@types/istanbul-lib-coverage": "^2.0.0",
"collect-v8-coverage": "^1.0.0"
Expand Down
5 changes: 2 additions & 3 deletions packages/jest-test-result/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@

import type {CoverageMap, CoverageMapData} from 'istanbul-lib-coverage';
import type {ConsoleBuffer} from '@jest/console';
import type {Config} from '@jest/types';
import type {Config, TransformTypes} from '@jest/types';
import type {V8Coverage} from 'collect-v8-coverage';
import type {TransformResult} from '@jest/transform';

export type V8CoverageResult = Array<{
codeTransformResult: TransformResult | undefined;
codeTransformResult: TransformTypes.TransformResult | undefined;
result: V8Coverage[number];
}>;

Expand Down
1 change: 0 additions & 1 deletion packages/jest-test-result/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
},
"references": [
{"path": "../jest-console"},
{"path": "../jest-transform"},
{"path": "../jest-types"}
]
}
9 changes: 2 additions & 7 deletions packages/jest-transform/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

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

export type ShouldInstrumentOptions = Pick<
Config.GlobalConfig,
Expand Down Expand Up @@ -36,12 +36,7 @@ export type TransformedSource =
| {code: string; map?: FixedRawSourceMap | string | null}
| string;

export type TransformResult = {
code: string;
originalCode: string;
mapCoverage: boolean;
sourceMapPath: string | null;
};
export type TransformResult = TransformTypes.TransformResult;

export type TransformOptions = {
instrument: boolean;
Expand Down
14 changes: 14 additions & 0 deletions packages/jest-types/src/Transform.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

// this is here to make it possible to avoid huge dependency trees just for types
export type TransformResult = {
code: string;
originalCode: string;
mapCoverage: boolean;
sourceMapPath: string | null;
};
3 changes: 2 additions & 1 deletion packages/jest-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
import type * as Circus from './Circus';
import type * as Config from './Config';
import type * as Global from './Global';
import type * as TransformTypes from './Transform';

export type {Circus, Config, Global};
export type {Circus, Config, Global, TransformTypes};

0 comments on commit 9671837

Please sign in to comment.