Skip to content

Commit

Permalink
Merge pull request #408 from kulshekhar/caching-cleanup
Browse files Browse the repository at this point in the history
Disable internal caching
  • Loading branch information
kulshekhar committed Jan 5, 2018
2 parents c610c13 + 84996d0 commit 31315fe
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-jest",
"version": "22.0.0",
"version": "22.0.1",
"main": "index.js",
"types": "./dist/index.d.ts",
"description": "A preprocessor with sourcemap support to help use Typescript with Jest",
Expand Down
1 change: 1 addition & 0 deletions src/jest-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@ export interface TsJestConfig {
useBabelrc?: boolean;
babelConfig?: BabelTransformOpts;
tsConfigFile?: string;
enableInternalCache?: boolean;
}
14 changes: 12 additions & 2 deletions src/preprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ export function process(
fileName: filePath,
});

const tsJestConfig = getTSJestConfig(jestConfig.globals);

const postHook = getPostProcessHook(
compilerOptions,
jestConfig,
getTSJestConfig(jestConfig.globals),
tsJestConfig,
);

const outputText = postHook(
Expand All @@ -58,7 +60,15 @@ export function process(

const modified = injectSourcemapHook(outputText);

cacheFile(jestConfig, filePath, modified);
if (tsJestConfig.enableInternalCache === true) {
// This config is undocumented.
// This has been made configurable for now to ensure that
// if this breaks something for existing users, there's a quick fix
// in place.
// If this doesn't cause a problem, this if block will be removed
// in a future version
cacheFile(jestConfig, filePath, modified);
}

return modified;
}
Expand Down

0 comments on commit 31315fe

Please sign in to comment.