Skip to content

Commit

Permalink
feat(presets): add typing for presets entry point (#2341)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl authored Feb 9, 2021
1 parent f4f5d32 commit e12b004
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ e2e/__workdir_synlink__/
e2e/__external-repos__/
coverage/
docs/
presets/index.d.ts
*.config.js
.eslintrc.js
8 changes: 8 additions & 0 deletions presets/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { TsJestPresets } from '../dist/types'

declare const _default: {
defaults: TsJestPresets;
jsWithTs: TsJestPresets;
jsWithBabel: TsJestPresets;
};
export = _default;
2 changes: 1 addition & 1 deletion src/cli/helpers/presets.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TsJestPresets } from '../../presets/create-jest-preset'
import type { TsJestPresets } from '../../types'

/** @internal */
export const enum JestPresetNames {
Expand Down
3 changes: 1 addition & 2 deletions src/presets/create-jest-preset.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type { Config } from '@jest/types'

import type { TsJestPresets } from '../types'
import { rootLogger } from '../utils/logger'

const logger = rootLogger.child({ namespace: 'jest-preset' })

export type TsJestPresets = Pick<Config.InitialOptions, 'moduleFileExtensions' | 'transform' | 'testMatch'>

interface CreateJestPresetOptions {
allowJs?: boolean
}
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ export interface InitialOptionsTsJest extends Config.InitialOptions {
globals?: GlobalConfigTsJest
}

export type TsJestPresets = Pick<Config.InitialOptions, 'moduleFileExtensions' | 'transform' | 'testMatch'>

interface TsJestConfig$tsConfig$file {
kind: 'file'
value: string | undefined
Expand Down

0 comments on commit e12b004

Please sign in to comment.