Skip to content

Commit

Permalink
Cleanup some type annotations.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpojer committed Jun 15, 2016
1 parent 75ede19 commit 3c1d1b6
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 20 deletions.
16 changes: 8 additions & 8 deletions packages/jest-cli/src/reporters/DefaultTestReporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
*/
'use strict';

import type {AggregatedResult, TestResult} from '../../../../types/TestResult';
import type {Config} from '../../../../types/Config';
import type {Process} from '../../../../interfaces/Process';
import type {AggregatedResult, TestResult} from 'types/TestResult';
import type {Config} from 'types/Config';
import type {Process} from 'types/Process';

const chalk = require('chalk');
const formatFailureMessage = require('jest-util').formatFailureMessage;
Expand Down Expand Up @@ -62,8 +62,8 @@ class DefaultTestReporter {
this._process = customProcess || process;
}

log(str: string) {
this._process.stdout.write(str + '\n');
log(message: string) {
this._process.stdout.write(message + '\n');
}

onRunStart(config: Config, results: AggregatedResult) {
Expand All @@ -77,7 +77,7 @@ class DefaultTestReporter {
onTestResult(
config: Config,
testResult: TestResult,
results: AggregatedResult
results: AggregatedResult,
) {
this._clearWaitingOn();

Expand Down Expand Up @@ -146,7 +146,7 @@ class DefaultTestReporter {
return true;
}

const snapshots: SnapshotSummary = this._getSnapshotSummary(aggregatedResults);
const snapshots = this._getSnapshotSummary(aggregatedResults);
const snapshotFailure = !!(!snapshots.didUpdate && (
snapshots.unchecked ||
snapshots.unmatched ||
Expand Down Expand Up @@ -186,7 +186,7 @@ class DefaultTestReporter {
return snapshotFailure ? false : aggregatedResults.success;
}

_getSnapshotSummary(aggregatedResults: AggregatedResult) {
_getSnapshotSummary(aggregatedResults: AggregatedResult): SnapshotSummary {
let added = 0;
let filesAdded = 0;
let filesRemoved = aggregatedResults.snapshotFilesRemoved;
Expand Down
10 changes: 7 additions & 3 deletions packages/jest-cli/src/reporters/IstanbulTestReporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ const reporter = new istanbul.Reporter();

const FAIL_COLOR = chalk.bold.red;

import type {Config} from '../../../../types/Config';
import type {AggregatedResult, TestResult} from '../../../../types/TestResult';
import type {Config} from 'types/Config';
import type {AggregatedResult, TestResult} from 'types/TestResult';

class IstanbulTestReporter extends DefaultTestReporter {
onTestResult(config: Config, testResult: TestResult, aggregatedResults: AggregatedResult) {
onTestResult(
config: Config,
testResult: TestResult,
aggregatedResults: AggregatedResult,
) {
super.onTestResult(config, testResult, aggregatedResults);

if (config.collectCoverage && testResult.coverage) {
Expand Down
12 changes: 6 additions & 6 deletions packages/jest-cli/src/reporters/VerboseLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ import type {
AssertionResult,
Suite,
TestResult,
} from '../../../../types/TestResult';
import type {Process} from '../../../../interfaces/Process';
} from 'types/TestResult';
import type {Process} from 'types/Process';

const chalk = require('chalk');

class VerboseLogger {
_process: Process;

constructor(customProcess?: ?Process) {
this._process = customProcess || process;
}

static groupTestsBySuites(testResults: Array<AssertionResult>) {
const root: Suite = {
suites: [],
Expand Down Expand Up @@ -49,10 +53,6 @@ class VerboseLogger {
return root.suites;
};

constructor(customProcess: Process) {
this._process = customProcess || process;
}

logTestResults(testResults: Array<AssertionResult>) {
VerboseLogger.groupTestsBySuites(testResults).forEach(suite =>
this._logSuite(suite, 0)
Expand Down
4 changes: 3 additions & 1 deletion packages/jest-snapshot/src/SnapshotFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export type MatchResult = {
pass: boolean,
};

type SnapshotData = {[key: string]: string};

type SaveStatus = {
deleted: boolean,
saved: boolean,
Expand All @@ -47,7 +49,7 @@ const fileExists = (filePath: Path): boolean => {

class SnapshotFile {

_content: {[key: string]: any};
_content: SnapshotData;
_dirty: boolean;
_filename: Path;
_uncheckedKeys: Set;
Expand Down
4 changes: 2 additions & 2 deletions types/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export type Config = {
coverageReporters: Array<string>,
coverageThreshold: {
global: {
[key: string]: number
}
[key: string]: number,
},
},
globals: ConfigGlobals,
haste: HasteConfig,
Expand Down
File renamed without changes.

0 comments on commit 3c1d1b6

Please sign in to comment.