Skip to content

Commit 79283e6

Browse files
author
ikepu-tp
committed
Update: config
1 parent 56451df commit 79283e6

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/lib/config.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jest.mock("node:fs/promises", () => {
5555
writeFile: jest.fn((filePath: string, text: string) => {
5656
setFile(filePath, text);
5757
}),
58-
mkdir: jest.fn(() => {}),
58+
mkdir: jest.fn(() => { }),
5959
};
6060
});
6161
jest.mock("node:fs", () => {
@@ -224,6 +224,8 @@ describe("config", () => {
224224
beforeEach(() => {
225225
const userConfigData = {
226226
includePrivate: true,
227+
address: "localhost",
228+
family: "IPv4",
227229
port: 9999,
228230
};
229231
resetFiles();
@@ -234,6 +236,8 @@ describe("config", () => {
234236
const userConfig = await config.getUserConfig();
235237
expect(userConfig).toStrictEqual({
236238
includePrivate: true,
239+
address: "localhost",
240+
family: "IPv4",
237241
port: 9999,
238242
});
239243
});
@@ -248,6 +252,8 @@ describe("config", () => {
248252
const userConfig = await config.getUserConfig();
249253
expect(userConfig).toStrictEqual({
250254
includePrivate: false,
255+
address: "localhost",
256+
family: "IPv4",
251257
port: 8888,
252258
});
253259
});

src/lib/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ interface Options {
1414

1515
type UserConfig = {
1616
includePrivate: boolean;
17+
address: string;
18+
family: string;
1719
port: number;
1820
};
1921

@@ -107,6 +109,8 @@ class Config {
107109
async getUserConfig() {
108110
const defaultConfig = {
109111
includePrivate: false,
112+
address: "localhost",
113+
family: "IPv4",
110114
port: 8888,
111115
} as UserConfig;
112116

0 commit comments

Comments
 (0)