Skip to content

Commit

Permalink
Update file-entry-cache to avoid the deprecated warning (#3903)
Browse files Browse the repository at this point in the history
  • Loading branch information
Teamop authored and hudochenkov committed Jan 18, 2019
1 parent fb7b8bf commit 127fef7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions lib/__tests__/standalone-cache.test.js
Expand Up @@ -10,6 +10,10 @@ const readFile = pify(fs.readFile);
const unlink = pify(fs.unlink);
const cpFile = require("cp-file");
const fileExists = require("file-exists-promise");
// As 'file-entry-cache' use 'flatted' to create the cache,
// need use this package to parse the content
// eslint-disable-next-line node/no-extraneous-require
const { parse } = require("flatted/cjs");

const cwd = process.cwd();
const invalidFile = path.join(fixturesPath, "empty-block.css");
Expand Down Expand Up @@ -61,7 +65,7 @@ describe("standalone cache", () => {
return readFile(expectedCacheFilePath, "utf8");
})
.then(fileContents => {
return JSON.parse(fileContents);
return parse(fileContents);
})
.then(cacheFile => {
// Ensure cache file contains only linted css file
Expand Down Expand Up @@ -93,7 +97,7 @@ describe("standalone cache", () => {
return readFile(expectedCacheFilePath, "utf8");
})
.then(fileContents => {
return JSON.parse(fileContents);
return parse(fileContents);
})
.then(cachedFiles => {
expect(typeof cachedFiles[validFile] === "object").toBe(true);
Expand Down Expand Up @@ -148,7 +152,7 @@ describe("standalone cache", () => {
return readFile(expectedCacheFilePath, "utf8");
})
.then(fileContents => {
return JSON.parse(fileContents);
return parse(fileContents);
})
.then(cachedFiles => {
expect(typeof cachedFiles[validFile] === "object").toBe(true);
Expand All @@ -165,7 +169,7 @@ describe("standalone cache", () => {
return readFile(expectedCacheFilePath, "utf8");
})
.then(fileContents => {
const cachedFiles = JSON.parse(fileContents);
const cachedFiles = parse(fileContents);

expect(typeof cachedFiles[validFile] === "object").toBe(true);
expect(typeof cachedFiles[newFileDest] === "undefined").toBe(true);
Expand Down Expand Up @@ -257,7 +261,7 @@ describe("standalone cache uses cacheLocation", () => {
return readFile(cacheLocationFile, "utf8");
})
.then(fileContents => {
return JSON.parse(fileContents);
return parse(fileContents);
})
.then(cacheFile => {
expect(typeof cacheFile[validFile] === "object").toBe(true);
Expand All @@ -280,7 +284,7 @@ describe("standalone cache uses cacheLocation", () => {
return readFile(expectedCacheFilePath, "utf8");
})
.then(fileContents => {
return JSON.parse(fileContents);
return parse(fileContents);
})
.then(cacheFile => {
expect(typeof cacheFile[validFile] === "object").toBe(true);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -45,7 +45,7 @@
"cosmiconfig": "^5.0.0",
"debug": "^4.0.0",
"execall": "^1.0.0",
"file-entry-cache": "^2.0.0",
"file-entry-cache": "^4.0.0",
"get-stdin": "^6.0.0",
"global-modules": "^2.0.0",
"globby": "^9.0.0",
Expand Down

0 comments on commit 127fef7

Please sign in to comment.