Skip to content

Commit

Permalink
Added comment explaining use of JSON.stringify() to generate cache keys.
Browse files Browse the repository at this point in the history
tvald committed Aug 3, 2017
1 parent a7fc1ae commit 7d9aea9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -138,6 +138,8 @@ export function getTSConfig(globals, collectCoverage: boolean = false) {

// check cache before resolving configuration
// NB: config is a string unless taken from __TS_CONFIG__, which should be immutable (and is deprecated anyways)
// NB: We use JSON.stringify() to create a consistent, unique signature. Although it lacks a uniform
// shape, this is simpler and faster than using the crypto package to generate a hash signature.
const tsConfigCacheKey = JSON.stringify([skipBabel, collectCoverage, isReferencedExternalFile ? config : undefined]);
if (tsConfigCacheKey in tsConfigCache) {
return tsConfigCache[tsConfigCacheKey];

0 comments on commit 7d9aea9

Please sign in to comment.