Skip to content

Commit

Permalink
Fix: CircularJSON dependency warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Teamop committed Jan 24, 2019
1 parent faf3c4e commit b849e06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -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",
Expand Down
14 changes: 9 additions & 5 deletions tests/lib/cli-engine.js
Expand Up @@ -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
//------------------------------------------------------------------------------
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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");

Expand All @@ -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");
});
Expand Down Expand Up @@ -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");

Expand Down

0 comments on commit b849e06

Please sign in to comment.