From a8de326aaeedb3a0287f2841a594460027fdc70d Mon Sep 17 00:00:00 2001 From: Tony Valderrama Date: Tue, 1 Aug 2017 18:12:56 -0700 Subject: [PATCH] Cache tsconfig when generating per-file cache key. --- src/preprocessor.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/preprocessor.ts b/src/preprocessor.ts index 083dcced98..28fe8a4dad 100644 --- a/src/preprocessor.ts +++ b/src/preprocessor.ts @@ -78,6 +78,7 @@ export function process( return src; } +let tsConfig = undefined; export function getCacheKey( fileData: string, filePath: Path, @@ -85,7 +86,9 @@ export function getCacheKey( options: TransformOptions = { instrument: false }): string { const jestConfig: JestConfig = JSON.parse(configStr); - const tsConfig = getTSConfig(jestConfig.globals, options.instrument); + if (!tsConfig) { + tsConfig = getTSConfig(jestConfig.globals, options.instrument); + } return crypto.createHash('md5') .update(JSON.stringify(tsConfig), 'utf8')