File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,12 @@ export async function prepareFilesystem(
9494 lfs [ key ] . native = fs [ key ] . native
9595 }
9696 }
97+
98+ // 'promises' is not initially linked within the 'linkfs'
99+ // package, and is needed by underlying Gatsby code (the
100+ // @graphql -tools/code-file-loader)
101+ lfs . promises = link ( fs . promises , rewrites )
102+
97103 // Gatsby uses this instead of fs if present
98104 // eslint-disable-next-line no-underscore-dangle
99105 global . _fsWrapper = lfs
Original file line number Diff line number Diff line change @@ -62,6 +62,20 @@ describe('prepareFilesystem', () => {
6262 delete process . env . GATSBY_EXCLUDE_DATASTORE_FROM_BUNDLE
6363 } , TEST_TIMEOUT )
6464
65+ it (
66+ 'links fs.promises to ensure it is available on global._fsWrapper' ,
67+ async ( ) => {
68+ await moveGatsbyDir ( )
69+
70+ const cacheDir = resolve ( '.cache' )
71+ await templateUtils . prepareFilesystem ( cacheDir , chance . url ( ) )
72+
73+ // eslint-disable-next-line no-underscore-dangle
74+ expect ( global . _fsWrapper . promises ) . toBeDefined ( )
75+ } ,
76+ TEST_TIMEOUT ,
77+ )
78+
6579 it (
6680 'downloads file from the CDN when GATSBY_EXCLUDE_DATASTORE_FROM_BUNDLE is enabled' ,
6781 async ( ) => {
You can’t perform that action at this time.
0 commit comments