diff --git a/package.json b/package.json index 373c51776b4b..d18ee9bac3b3 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "espree": "^5.0.0", "esquery": "^1.0.1", "esutils": "^2.0.2", - "file-entry-cache": "^2.0.0", + "file-entry-cache": "^4.0.0", "functional-red-black-tree": "^1.0.1", "glob": "^7.1.2", "globals": "^11.7.0", diff --git a/tests/lib/cli-engine.js b/tests/lib/cli-engine.js index fd961cb63537..6b8c15a12747 100644 --- a/tests/lib/cli-engine.js +++ b/tests/lib/cli-engine.js @@ -21,6 +21,10 @@ const assert = require("chai").assert, const proxyquire = require("proxyquire").noCallThru().noPreserveCache(); +// Need use 'flatted' to parse the cache content as the 'file-entry-cache' use it to create cache +// eslint-disable-next-line node/no-extraneous-require +const flatted = require("flatted"); + //------------------------------------------------------------------------------ // Tests //------------------------------------------------------------------------------ @@ -2375,7 +2379,7 @@ describe("CLIEngine", () => { assert.isTrue(shell.test("-f", cacheFile), "the cache for eslint was created"); - const cache = JSON.parse(fs.readFileSync(cacheFile)); + const cache = flatted.parse(fs.readFileSync(cacheFile)); assert.isTrue(typeof cache[goodFile] === "object", "the entry for the good file is in the cache"); @@ -2412,7 +2416,7 @@ describe("CLIEngine", () => { engine.executeOnFiles([badFile, goodFile, toBeDeletedFile]); - let cache = JSON.parse(fs.readFileSync(cacheFile)); + let cache = flatted.parse(fs.readFileSync(cacheFile)); assert.isTrue(typeof cache[toBeDeletedFile] === "object", "the entry for the file to be deleted is in the cache"); @@ -2456,7 +2460,7 @@ describe("CLIEngine", () => { engine.executeOnFiles([badFile, goodFile, testFile2]); - let cache = JSON.parse(fs.readFileSync(cacheFile)); + let cache = flatted.parse(fs.readFileSync(cacheFile)); assert.isTrue(typeof cache[testFile2] === "object", "the entry for the test-file2 is in the cache"); @@ -2467,7 +2471,7 @@ describe("CLIEngine", () => { */ engine.executeOnFiles([badFile, goodFile]); - cache = JSON.parse(fs.readFileSync(cacheFile)); + cache = flatted.parse(fs.readFileSync(cacheFile)); assert.isTrue(typeof cache[testFile2] === "object", "the entry for the test-file2 is in the cache"); }); @@ -2590,7 +2594,7 @@ describe("CLIEngine", () => { assert.isTrue(shell.test("-f", customCacheFile), "the cache for eslint was created"); - const cache = JSON.parse(fs.readFileSync(customCacheFile)); + const cache = flatted.parse(fs.readFileSync(customCacheFile)); assert.isTrue(typeof cache[goodFile] === "object", "the entry for the good file is in the cache");