File tree Expand file tree Collapse file tree 1 file changed +13
-16
lines changed
Expand file tree Collapse file tree 1 file changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -995,20 +995,9 @@ async function getMockedApi(): Promise<MockedApi | undefined> {
995995 return undefined ;
996996 }
997997
998- const path = getEnv ( "WM_MOCKED_API_FILE" ) ;
999- if ( ! path ) {
1000- console . warn (
1001- "No mocked API file path provided at env variable WM_MOCKED_API_FILE. Using empty mocked API."
1002- ) ;
1003- mockedApi = {
1004- variables : { } ,
1005- resources : { } ,
1006- } ;
1007- return mockedApi ;
1008- }
1009998 try {
1010999 const fs = await import ( "node:fs/promises" ) ;
1011- const file = await fs . readFile ( path , "utf-8" ) ;
1000+ const file = await fs . readFile ( mockedPath , "utf-8" ) ;
10121001 try {
10131002 mockedApi = JSON . parse ( file ) as MockedApi ;
10141003 if ( ! mockedApi . variables ) {
@@ -1019,12 +1008,20 @@ async function getMockedApi(): Promise<MockedApi | undefined> {
10191008 }
10201009 return mockedApi ;
10211010 } catch {
1022- console . warn ( "Error parsing mocked API file at path" , path ) ;
1023- return undefined ;
1011+ console . warn ( "Error parsing mocked API file at path" , mockedPath ) ;
10241012 }
10251013 } catch {
1026- console . warn ( "Error reading mocked API file at path" , path ) ;
1027- return undefined ;
1014+ console . warn ( "Error reading mocked API file at path" , mockedPath ) ;
1015+ }
1016+ if ( ! mockedApi ) {
1017+ console . warn (
1018+ "No mocked API file path provided at env variable WM_MOCKED_API_FILE. Using empty mocked API."
1019+ ) ;
1020+ mockedApi = {
1021+ variables : { } ,
1022+ resources : { } ,
1023+ } ;
1024+ return mockedApi ;
10281025 }
10291026}
10301027
You can’t perform that action at this time.
0 commit comments