feat(jest): mirror jest repo config definitions

This commit is contained in:
Martin Hochel
2018-06-11 23:14:27 +02:00
parent b3e178b990
commit 19ec811c7a
2 changed files with 162 additions and 5 deletions
+159 -3
View File
@@ -796,7 +796,164 @@ declare namespace jest {
type SnapshotUpdateState = 'all' | 'new' | 'none';
// https://facebook.github.io/jest/docs/en/cli.html#options
interface DefaultOptions {
automock: boolean;
bail: boolean;
browser: boolean;
cache: boolean;
cacheDirectory: Path;
changedFilesWithAncestor: boolean;
clearMocks: boolean;
collectCoverage: boolean;
collectCoverageFrom: Maybe<string[]>;
coverageDirectory: Maybe<string>;
coveragePathIgnorePatterns: string[];
coverageReporters: string[];
coverageThreshold: Maybe<{global: {[key: string]: number}}>;
errorOnDeprecated: boolean;
expand: boolean;
filter: Maybe<Path>;
forceCoverageMatch: Glob[];
globals: ConfigGlobals;
globalSetup: Maybe<string>;
globalTeardown: Maybe<string>;
haste: HasteConfig;
detectLeaks: boolean;
detectOpenHandles: boolean;
moduleDirectories: string[];
moduleFileExtensions: string[];
moduleNameMapper: {[key: string]: string};
modulePathIgnorePatterns: string[];
noStackTrace: boolean;
notify: boolean;
notifyMode: string;
preset: Maybe<string>;
projects: Maybe<Array<string | ProjectConfig>>;
resetMocks: boolean;
resetModules: boolean;
resolver: Maybe<Path>;
restoreMocks: boolean;
rootDir: Maybe<Path>;
roots: Maybe<Path[]>;
runner: string;
runTestsByPath: boolean;
setupFiles: Path[];
setupTestFrameworkScriptFile: Maybe<Path>;
skipFilter: boolean;
snapshotSerializers: Path[];
testEnvironment: string;
testEnvironmentOptions: object;
testFailureExitCode: string | number;
testLocationInResults: boolean;
testMatch: Glob[];
testPathIgnorePatterns: string[];
testRegex: string;
testResultsProcessor: Maybe<string>;
testRunner: Maybe<string>;
testURL: string;
timers: 'real' | 'fake';
transform: Maybe<{[key: string]: string}>;
transformIgnorePatterns: Glob[];
watchPathIgnorePatterns: string[];
useStderr: boolean;
verbose: Maybe<boolean>;
watch: boolean;
watchman: boolean;
}
interface InitialOptions {
automock?: boolean;
bail?: boolean;
browser?: boolean;
cache?: boolean;
cacheDirectory?: Path;
clearMocks?: boolean;
changedFilesWithAncestor?: boolean;
changedSince?: string;
collectCoverage?: boolean;
collectCoverageFrom?: Glob[];
collectCoverageOnlyFrom?: {[key: string]: boolean};
coverageDirectory?: string;
coveragePathIgnorePatterns?: string[];
coverageReporters?: string[];
coverageThreshold?: {global: {[key: string]: number}};
detectLeaks?: boolean;
detectOpenHandles?: boolean;
displayName?: string;
expand?: boolean;
filter?: Path;
findRelatedTests?: boolean;
forceCoverageMatch?: Glob[];
forceExit?: boolean;
json?: boolean;
globals?: ConfigGlobals;
globalSetup?: Maybe<string>;
globalTeardown?: Maybe<string>;
haste?: HasteConfig;
reporters?: Array<ReporterConfig | string>;
logHeapUsage?: boolean;
lastCommit?: boolean;
listTests?: boolean;
mapCoverage?: boolean;
moduleDirectories?: string[];
moduleFileExtensions?: string[];
moduleLoader?: Path;
moduleNameMapper?: {[key: string]: string};
modulePathIgnorePatterns?: string[];
modulePaths?: string[];
name?: string;
noStackTrace?: boolean;
notify?: boolean;
notifyMode?: string;
onlyChanged?: boolean;
outputFile?: Path;
passWithNoTests?: boolean;
preprocessorIgnorePatterns?: Glob[];
preset?: Maybe<string>;
projects?: Glob[];
replname?: Maybe<string>;
resetMocks?: boolean;
resetModules?: boolean;
resolver?: Maybe<Path>;
restoreMocks?: boolean;
rootDir?: Path;
roots?: Path[];
runner?: string;
runTestsByPath?: boolean;
scriptPreprocessor?: string;
setupFiles?: Path[];
setupTestFrameworkScriptFile?: Path;
silent?: boolean;
skipFilter?: boolean;
skipNodeResolution?: boolean;
snapshotSerializers?: Path[];
errorOnDeprecated?: boolean;
testEnvironment?: string;
testEnvironmentOptions?: object;
testFailureExitCode?: string | number;
testLocationInResults?: boolean;
testMatch?: Glob[];
testNamePattern?: string;
testPathDirs?: Path[];
testPathIgnorePatterns?: string[];
testRegex?: string;
testResultsProcessor?: Maybe<string>;
testRunner?: string;
testURL?: string;
timers?: 'real' | 'fake';
transform?: {[key: string]: string};
transformIgnorePatterns?: Glob[];
watchPathIgnorePatterns?: string[];
unmockedModulePathPatterns?: string[];
updateSnapshot?: boolean;
useStderr?: boolean;
verbose?: Maybe<boolean>;
watch?: boolean;
watchAll?: boolean;
watchman?: boolean;
watchPlugins?: string[];
}
interface GlobalConfig {
bail: boolean;
collectCoverage: boolean;
@@ -826,7 +983,6 @@ declare namespace jest {
watchman: boolean;
}
// https://facebook.github.io/jest/docs/en/configuration.html#options
interface ProjectConfig {
automock: boolean;
browser: boolean;
@@ -866,7 +1022,7 @@ declare namespace jest {
testRunner: string;
testURL: string;
timers: 'real' | 'fake';
transform: {[regexpGlob: string]: string};
transform: Array<[string, Path]>;
transformIgnorePatterns: Glob[];
unmockedModulePathPatterns: Maybe<string[]>;
watchPathIgnorePatterns: string[];
+3 -2
View File
@@ -734,10 +734,11 @@ test('moduleName 2', () => {
// Jest config
{
interface JestConfigModule {defaults: jest.DefaultOptions; }
// tslint:disable-next-line:no-var-requires
const {defaults} = require('jest-config') as {defaults: jest.ProjectConfig};
const {defaults} = require('jest-config') as JestConfigModule;
const config: Partial<jest.ProjectConfig> = {
const config: jest.InitialOptions = {
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest'
},