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(
94
94
lfs [ key ] . native = fs [ key ] . native
95
95
}
96
96
}
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
+
97
103
// Gatsby uses this instead of fs if present
98
104
// eslint-disable-next-line no-underscore-dangle
99
105
global . _fsWrapper = lfs
Original file line number Diff line number Diff line change @@ -62,6 +62,20 @@ describe('prepareFilesystem', () => {
62
62
delete process . env . GATSBY_EXCLUDE_DATASTORE_FROM_BUNDLE
63
63
} , TEST_TIMEOUT )
64
64
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
+
65
79
it (
66
80
'downloads file from the CDN when GATSBY_EXCLUDE_DATASTORE_FROM_BUNDLE is enabled' ,
67
81
async ( ) => {
You can’t perform that action at this time.
0 commit comments