Skip to content

Commit

Permalink
somehow fix windows tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieudutour committed Mar 12, 2019
1 parent 1142dc3 commit 09f6aa5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ jest.mock(`../../../redux/`, () => {

jest.mock(`../../../utils/cache`, () => {
return {
cachePath: filePath =>
require(`path`).join(`my`, `gatsby`, `project`, `.cache`, filePath),
cachePath: () => `my/gatsby/project/.cache`,
}
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const writePages = async () => {
return Promise.resolve()
}

const cacheDirectory = cachePath()

lastHash = newHash

// Get list of components, and json files.
Expand Down Expand Up @@ -102,12 +104,13 @@ const preferDefault = m => m && m.default || m
.join(`,\n`)}
}\n\n`

asyncRequires += `exports.data = () => import(/* webpackChunkName: "pages-manifest" */ "${cachePath(
asyncRequires += `exports.data = () => import(/* webpackChunkName: "pages-manifest" */ "${joinPath(
cacheDirectory,
`data.json`
)}")\n\n`

const writeAndMove = (file, data) => {
const destination = cachePath(file)
const destination = joinPath(cacheDirectory, file)
const tmp = `${destination}.${Date.now()}`
return fs
.writeFile(tmp, data)
Expand Down

0 comments on commit 09f6aa5

Please sign in to comment.