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

Update file-entry-cache to avoid the deprecated warning #3903

Merged
merged 1 commit into from
Jan 18, 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
16 changes: 10 additions & 6 deletions lib/__tests__/standalone-cache.test.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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