Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade: CircularJSON dependency warning #11314

Merged
merged 1 commit into from Feb 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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": "^5.0.1",
"functional-red-black-tree": "^1.0.1",
"glob": "^7.1.2",
"globals": "^11.7.0",
Expand Down
31 changes: 19 additions & 12 deletions tests/lib/cli-engine.js
Expand Up @@ -21,6 +21,8 @@ const assert = require("chai").assert,

const proxyquire = require("proxyquire").noCallThru().noPreserveCache();

const fCache = require("file-entry-cache");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------
Expand Down Expand Up @@ -2375,11 +2377,12 @@ describe("CLIEngine", () => {

assert.isTrue(shell.test("-f", cacheFile), "the cache for eslint was created");

const cache = JSON.parse(fs.readFileSync(cacheFile));
const fileCache = fCache.createFromFile(cacheFile);
const { cache } = fileCache;

assert.isTrue(typeof cache[goodFile] === "object", "the entry for the good file is in the cache");
assert.isTrue(typeof cache.getKey(goodFile) === "object", "the entry for the good file is in the cache");

assert.isTrue(typeof cache[badFile] === "object", "the entry for the bad file is in the cache");
assert.isTrue(typeof cache.getKey(badFile) === "object", "the entry for the bad file is in the cache");

const cachedResult = engine.executeOnFiles([badFile, goodFile]);

Expand Down Expand Up @@ -2412,9 +2415,10 @@ describe("CLIEngine", () => {

engine.executeOnFiles([badFile, goodFile, toBeDeletedFile]);

let cache = JSON.parse(fs.readFileSync(cacheFile));
const fileCache = fCache.createFromFile(cacheFile);
let { cache } = fileCache;

assert.isTrue(typeof cache[toBeDeletedFile] === "object", "the entry for the file to be deleted is in the cache");
assert.isTrue(typeof cache.getKey(toBeDeletedFile) === "object", "the entry for the file to be deleted is in the cache");

// delete the file from the file system
fs.unlinkSync(toBeDeletedFile);
Expand Down Expand Up @@ -2456,9 +2460,10 @@ describe("CLIEngine", () => {

engine.executeOnFiles([badFile, goodFile, testFile2]);

let cache = JSON.parse(fs.readFileSync(cacheFile));
let fileCache = fCache.createFromFile(cacheFile);
let { cache } = fileCache;

assert.isTrue(typeof cache[testFile2] === "object", "the entry for the test-file2 is in the cache");
assert.isTrue(typeof cache.getKey(testFile2) === "object", "the entry for the test-file2 is in the cache");

/*
* we pass a different set of files minus test-file2
Expand All @@ -2467,9 +2472,10 @@ describe("CLIEngine", () => {
*/
engine.executeOnFiles([badFile, goodFile]);

cache = JSON.parse(fs.readFileSync(cacheFile));
fileCache = fCache.createFromFile(cacheFile);
cache = fileCache.cache;

assert.isTrue(typeof cache[testFile2] === "object", "the entry for the test-file2 is in the cache");
assert.isTrue(typeof cache.getKey(testFile2) === "object", "the entry for the test-file2 is in the cache");
});

it("should not delete cache when executing on text", () => {
Expand Down Expand Up @@ -2590,11 +2596,12 @@ describe("CLIEngine", () => {

assert.isTrue(shell.test("-f", customCacheFile), "the cache for eslint was created");

const cache = JSON.parse(fs.readFileSync(customCacheFile));
const fileCache = fCache.createFromFile(customCacheFile);
const { cache } = fileCache;

assert.isTrue(typeof cache[goodFile] === "object", "the entry for the good file is in the cache");
assert.isTrue(typeof cache.getKey(goodFile) === "object", "the entry for the good file is in the cache");

assert.isTrue(typeof cache[badFile] === "object", "the entry for the bad file is in the cache");
assert.isTrue(typeof cache.getKey(badFile) === "object", "the entry for the bad file is in the cache");

const cachedResult = engine.executeOnFiles([badFile, goodFile]);

Expand Down