ts-jest-resolver
Version:
A resolver for `jest` that uses same strategy as TS when resolving files with JavaScript extension (".js").
23 lines • 1.07 kB
TypeScript
import type { ResolverOptions } from 'jest-resolve';
export type Path = string;
export type { ResolverOptions };
/**
* A resolver for `jest` that uses same strategy as TS when resolving files with
* JavaScript extension (".js"). Otherwise it just uses default resolver.
*
* When receives a path with JavaScript extension (".js" or ".jsx"):
* 1. It tries to resolve to a path with ".tsx".
* 2. If no file was found, it tries to resolve to a path with ".ts".
* 3. If no file was found, it resolves to original path (with ".js" or ".jsx").
*
* When receives a path with ES modules extension (".mjs"):
* 1. It tries to resolve to a path with ".mts".
* 2. If no file was found, it resolves to original path (with ".mjs").
*
* When receives a path with CommonJS modules extension (".cjs"):
* 1. It tries to resolve to a path with ".cts".
* 2. If no file was found, it resolves to original path (with ".cjs").
*/
declare function resolverForTSJest(path: Path, options: ResolverOptions): Path;
export default resolverForTSJest;
//# sourceMappingURL=index.d.ts.map