Skip to content

Commit

Permalink
chore: migrate jest-util to TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Feb 9, 2019
1 parent dc35500 commit c1cffb5
Show file tree
Hide file tree
Showing 42 changed files with 887 additions and 688 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -21,6 +21,7 @@
- `[jest-serializer]`: Migrate to TypeScript ([#7841](https://github.com/facebook/jest/pull/7841))
- `[jest-message-util]`: Migrate to TypeScript ([#7834](https://github.com/facebook/jest/pull/7834))
- `[@jest/types]`: New package to handle shared types ([#7834](https://github.com/facebook/jest/pull/7834))
- `[jest-util]`: Migrate to TypeScript

### Performance

Expand Down
11 changes: 5 additions & 6 deletions packages/jest-message-util/src/index.ts
Expand Up @@ -14,7 +14,6 @@ import slash from 'slash';
import {codeFrameColumns} from '@babel/code-frame';
import StackUtils from 'stack-utils';

type Glob = Config.Glob;
type Path = Config.Path;
type AssertionResult = TestResult.AssertionResult;
type SerializableError = TestResult.SerializableError;
Expand All @@ -33,12 +32,12 @@ try {
// node internals in the browser though, so no issue.
}

type StackTraceConfig = {
rootDir: string;
testMatch: Array<Glob>;
};
export type StackTraceConfig = Pick<
Config.ProjectConfig,
'rootDir' | 'testMatch'
>;

type StackTraceOptions = {
export type StackTraceOptions = {
noStackTrace: boolean;
};

Expand Down
Expand Up @@ -3,11 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

import type {Global} from 'types/Global';

export default (global: Global, key: string, value: any) =>
(global[key] = value);
export type SourceMapRegistry = {[key: string]: string};
9 changes: 5 additions & 4 deletions packages/jest-types/src/TestResult.ts
Expand Up @@ -123,6 +123,7 @@ export type AssertionResult = {
};

export type FormattedAssertionResult = {
ancestorTitles: Array<string>;
failureMessages: Array<string> | null;
fullName: string;
location: Callsite | null | undefined;
Expand Down Expand Up @@ -150,7 +151,7 @@ export type AggregatedResultWithoutCoverage = {
};

export type AggregatedResult = AggregatedResultWithoutCoverage & {
coverageMap?: CoverageMap | null | undefined;
coverageMap?: CoverageMap | null;
};

export type Suite = {
Expand All @@ -160,10 +161,10 @@ export type Suite = {
};

export type TestResult = {
console: ConsoleBuffer | null | undefined;
console?: ConsoleBuffer | null;
coverage?: RawCoverage;
displayName: string | null | undefined;
failureMessage: string | null | undefined;
displayName?: string | null;
failureMessage?: string | null;
leaks: boolean;
memoryUsage?: Bytes;
numFailingTests: number;
Expand Down
3 changes: 2 additions & 1 deletion packages/jest-types/src/index.ts
Expand Up @@ -7,6 +7,7 @@

import * as Config from './Config';
import * as Console from './Console';
import * as SourceMaps from './SourceMaps';
import * as TestResult from './TestResult';

export {Config, Console, TestResult};
export {Config, Console, SourceMaps, TestResult};
8 changes: 6 additions & 2 deletions packages/jest-util/package.json
Expand Up @@ -9,21 +9,25 @@
"license": "MIT",
"main": "build/index.js",
"dependencies": {
"@jest/types": "^24.1.0",
"@types/node": "*",
"callsites": "^3.0.0",
"chalk": "^2.0.1",
"graceful-fs": "^4.1.15",
"is-ci": "^2.0.0",
"jest-message-util": "^24.0.0",
"jest-mock": "^24.0.0",
"mkdirp": "^0.5.1",
"readable-stream": "^3.1.1",
"slash": "^2.0.0",
"source-map": "^0.6.0"
},
"devDependencies": {
"@types/callsites": "^2.0.0",
"@types/graceful-fs": "^4.1.2",
"@types/is-ci": "^1.0.10",
"@types/mkdirp": "^0.5.2",
"jest-mock": "^24.0.0"
"@types/readable-stream": "^2.3.0",
"@types/slash": "^2.0.0"
},
"engines": {
"node": ">= 6"
Expand Down
167 changes: 0 additions & 167 deletions packages/jest-util/src/BufferedConsole.js

This file was deleted.

0 comments on commit c1cffb5

Please sign in to comment.