diff --git a/lib/__tests__/standalone-cache.test.js b/lib/__tests__/standalone-cache.test.js index 36607b53ce..c743f41d30 100644 --- a/lib/__tests__/standalone-cache.test.js +++ b/lib/__tests__/standalone-cache.test.js @@ -8,16 +8,16 @@ const fsExtra = require("fs-promise") const fileExists = require("file-exists-promise") const cwd = process.cwd() -const invalidFile = path.normalize(`${fixturesPath}/empty-block.css`) -const validFile = path.normalize(`${fixturesPath}/cache/valid.css`) -const newFileDest = path.normalize(`${fixturesPath}/cache/newFile.css`) +const invalidFile = path.join(fixturesPath, "empty-block.css") +const validFile = path.join(fixturesPath, "cache", "valid.css") +const newFileDest = path.join(fixturesPath, "cache", "newFile.css") // Config object is getting mutated internally. // Return new object of the same structure to // make sure config doesn't change between runs. function getConfig() { return { - files: `${fixturesPath}/cache/*.css`, + files: path.join(fixturesPath, "cache", "*.css"), config: { rules: { "block-no-empty": true, "color-no-invalid-hex": true }, }, @@ -26,7 +26,7 @@ function getConfig() { } describe("standalone cache", () => { - const expectedCacheFilePath = `${cwd}/.stylelintcache` + const expectedCacheFilePath = path.join(cwd, ".stylelintcache") beforeEach(() => { // Initial run to warm up the cache @@ -121,9 +121,9 @@ describe("standalone cache", () => { }) }) describe("standalone cache uses cacheLocation", () => { - const cacheLocationFile = `${fixturesPath}/cache/.cachefile` - const cacheLocationDir = `${fixturesPath}/cache/` - const expectedCacheFilePath = `${cacheLocationDir}/.stylelintcache_${hash(cwd)}` + const cacheLocationFile = path.join(fixturesPath, "cache", ".cachefile") + const cacheLocationDir = path.join(fixturesPath, "cache") + const expectedCacheFilePath = path.join(cacheLocationDir, `.stylelintcache_${hash(cwd)}`) afterEach(() => { // clean up after each test return Promise.all([ diff --git a/lib/standalone.js b/lib/standalone.js index 18409c1c1c..cca5b3c4e4 100644 --- a/lib/standalone.js +++ b/lib/standalone.js @@ -108,8 +108,7 @@ module.exports = function (options/*: Object */)/*: Promise { const absoluteFilepath = (!path.isAbsolute(filePath)) ? path.join(process.cwd(), filePath) - : filePath - + : path.normalize(filePath) return absoluteFilepath })