UNPKG

1.78 kBTypeScriptView Raw
1import type { SyncTransformer, TransformedSource } from '@jest/transform';
2import type { CompilerInstance, TsJestTransformerOptions, TsJestTransformOptions } from '../types';
3import { ConfigSet } from './config/config-set';
4export declare class TsJestTransformer implements SyncTransformer<TsJestTransformerOptions> {
5 private readonly tsJestConfig?;
6 private readonly _logger;
7 protected _compiler: CompilerInstance;
8 private _tsResolvedModulesCachePath;
9 private _transformCfgStr;
10 private _depGraphs;
11 private _watchMode;
12 constructor(tsJestConfig?: import("../types").TsJestGlobalOptions | undefined);
13 private _configsFor;
14 protected _createConfigSet(config: TsJestTransformOptions['config'] | undefined): ConfigSet;
15 protected _createCompiler(configSet: ConfigSet, cacheFS: Map<string, string>): void;
16 /**
17 * @public
18 */
19 process(sourceText: string, sourcePath: string, transformOptions: TsJestTransformOptions): TransformedSource;
20 processAsync(sourceText: string, sourcePath: string, transformOptions: TsJestTransformOptions): Promise<TransformedSource>;
21 private processWithTs;
22 private runTsJestHook;
23 /**
24 * Jest uses this to cache the compiled version of a file
25 *
26 * @see https://github.com/facebook/jest/blob/v23.5.0/packages/jest-runtime/src/script_transformer.js#L61-L90
27 *
28 * @public
29 */
30 getCacheKey(fileContent: string, filePath: string, transformOptions: TsJestTransformOptions): string;
31 getCacheKeyAsync(sourceText: string, sourcePath: string, transformOptions: TsJestTransformOptions): Promise<string>;
32 /**
33 * Subclasses extends `TsJestTransformer` can call this method to get resolved module disk cache
34 */
35 private _getFsCachedResolvedModules;
36}