Skip to content

Commit

Permalink
Fix crash around ignoredDirs/ignoredFiles in result-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
jfmengels committed May 4, 2024
1 parent b3f6d15 commit 20bd897
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lib/elm-app-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const app = elmModule.Elm.Elm.Review.Main.init({

const loadCachePromise = ResultCache.load(
workerData.flags,
workerData.flags.ignoredDirs,
workerData.flags.ignoredFiles,
workerData.flags.resultCacheFolder
);

Expand Down
7 changes: 6 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ async function runElmReview() {
Runner.initializeApp(options, elmModulePath, reviewElmJson, appHash)
),

ResultCache.load(options, options.resultCachePath(appHash))
ResultCache.load(
options,
options.ignoredDirs(),
options.ignoredFiles(),
options.resultCachePath(appHash)
)
]);

const success = await Runner.runReview(options, app);
Expand Down
8 changes: 5 additions & 3 deletions lib/result-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ const promisesToResolve = new Map();
/**
* Load cache results.
* @param {Options} options
* @param {string[]} ignoredDirs
* @param {string[]} ignoredFiles
* @param {Path} cacheFolder
* @returns {Promise<void>}
*/
async function load(options, cacheFolder) {
async function load(options, ignoredDirs, ignoredFiles, cacheFolder) {
// TODO Make caching work for all of these
if (
options.debug ||
options.directoriesToAnalyze.length > 0 ||
options.ignoredDirs().length > 0 ||
options.ignoredFiles().length > 0
ignoredDirs.length > 0 ||
ignoredFiles.length > 0
) {
// TODO Breaking change: When we drop support for Node.js v10, use `globalThis` everywhere instead of `global`
global.loadResultFromCache = () => null;
Expand Down

0 comments on commit 20bd897

Please sign in to comment.