Skip to content

Commit 6e80372

Browse files
committed
fix typescript-client 2
1 parent 7f516f0 commit 6e80372

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

typescript-client/client.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)