Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate jest-runtime to TypeScript #7964

Merged
merged 16 commits into from
Feb 25, 2019
Prev Previous commit
Next Next commit
don't keep separate argv config file
  • Loading branch information
SimenB committed Feb 25, 2019
commit 5ea519b7f363512a68927ccf0483d7c4b00d422e
4 changes: 2 additions & 2 deletions packages/jest-runtime/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import path from 'path';
import chalk from 'chalk';
import {sync as realpath} from 'realpath-native';
import yargs from 'yargs';
import {Argv} from '@jest/types';
import {Config} from '@jest/types';
import {JestEnvironment} from '@jest/environment';
import {Console, setGlobal} from 'jest-util';
// @ts-ignore: Not migrated to TS
Expand All @@ -21,7 +21,7 @@ import {VERSION} from '../version';
import {Context} from '../types';
import * as args from './args';

export function run(cliArgv?: Argv.Argv, cliInfo?: Array<string>) {
export function run(cliArgv?: Config.Argv, cliInfo?: Array<string>) {
const realFs = require('fs');
const fs = require('graceful-fs');
fs.gracefulify(realFs);
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import path from 'path';
import {Argv, Config, SourceMaps} from '@jest/types';
import {Config, SourceMaps} from '@jest/types';
import {
Jest,
JestEnvironment,
Expand Down Expand Up @@ -264,7 +264,7 @@ class Runtime {
});
}

static runCLI(args?: Argv.Argv, info?: Array<string>) {
static runCLI(args?: Config.Argv, info?: Array<string>) {
return cliRun(args, info);
}

Expand Down
98 changes: 0 additions & 98 deletions packages/jest-types/src/Argv.ts

This file was deleted.

93 changes: 93 additions & 0 deletions packages/jest-types/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

import {Arguments} from 'yargs';

export type Path = string;

export type Glob = string;
Expand Down Expand Up @@ -355,3 +357,94 @@ export type ProjectConfig = {
watchPathIgnorePatterns: Array<string>;
unmockedModulePathPatterns: Array<string> | null | undefined;
};

export type Argv = Arguments<{
all: boolean;
automock: boolean;
bail: boolean | number;
browser: boolean;
cache: boolean;
cacheDirectory: string;
changedFilesWithAncestor: boolean;
changedSince: string;
ci: boolean;
clearCache: boolean;
clearMocks: boolean;
collectCoverage: boolean;
collectCoverageFrom: Array<string>;
collectCoverageOnlyFrom: Array<string>;
config: string;
coverage: boolean;
coverageDirectory: string;
coveragePathIgnorePatterns: Array<string>;
coverageReporters: Array<string>;
coverageThreshold: string;
debug: boolean;
env: string;
expand: boolean;
findRelatedTests: boolean;
forceExit: boolean;
globals: string;
globalSetup: string | null | undefined;
globalTeardown: string | null | undefined;
h: boolean;
haste: string;
help: boolean;
init: boolean;
json: boolean;
lastCommit: boolean;
logHeapUsage: boolean;
maxWorkers: number;
moduleDirectories: Array<string>;
moduleFileExtensions: Array<string>;
moduleLoader: string;
moduleNameMapper: string;
modulePathIgnorePatterns: Array<string>;
modulePaths: Array<string>;
name: string;
noSCM: boolean;
noStackTrace: boolean;
notify: boolean;
notifyMode: string;
onlyChanged: boolean;
outputFile: string;
preset: string | null | undefined;
projects: Array<string>;
prettierPath: string | null | undefined;
replname: string | null | undefined;
resetMocks: boolean;
resetModules: boolean;
resolver: string | null | undefined;
restoreMocks: boolean;
rootDir: string;
roots: Array<string>;
runInBand: boolean;
setupFiles: Array<string>;
setupFilesAfterEnv: Array<string>;
showConfig: boolean;
silent: boolean;
snapshotSerializers: Array<string>;
testEnvironment: string;
testFailureExitCode: string | null | undefined;
testMatch: Array<string>;
testNamePattern: string;
testPathIgnorePatterns: Array<string>;
testPathPattern: Array<string>;
testRegex: string | Array<string>;
testResultsProcessor: string | null | undefined;
testRunner: string;
testURL: string;
timers: 'real' | 'fake';
transform: string;
transformIgnorePatterns: Array<string>;
unmockedModulePathPatterns: Array<string> | null | undefined;
updateSnapshot: boolean;
useStderr: boolean;
verbose: boolean | null | undefined;
version: boolean;
watch: boolean;
watchAll: boolean;
watchman: boolean;
watchPathIgnorePatterns: Array<string>;
}>;

3 changes: 1 addition & 2 deletions packages/jest-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
* LICENSE file in the root directory of this source tree.
*/

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

export {Argv, Config, Console, Matchers, SourceMaps, TestResult, Global};
export {Config, Console, Matchers, SourceMaps, TestResult, Global};