fix(setup): configure an empty Hermes config.yaml (#1983)
* fix(setup): treat an empty Hermes config.yaml as a new document YAML parses an empty file to null, so Hermes configuration was checked as an object before the shared empty-file rule and rejected. Setup then failed its readback gate for a zero-byte config.yaml, although a missing file is configured and the Hermes serializer already writes a fresh document for empty original text. Apply the empty-file rule before the Hermes YAML parse, as #1117 did for JSON clients. * test(setup): configure an empty Hermes config.yaml Configure zero-byte and newline-only config.yaml files through the real filesystem workflow, then read the registration back as aligned.
This commit is contained in:
@@ -185,4 +185,28 @@ mcp_servers:
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it.each(["", "\n"])(
|
||||
"configures an empty config.yaml %j as a new document",
|
||||
async (original) => {
|
||||
const { home, client } = await hermesClient();
|
||||
await writeFile(client.configPath, original);
|
||||
expect(
|
||||
(await configureClientConfiguration(client, {}, command)).status,
|
||||
).toBe("configured");
|
||||
expect(parseYaml(await readFile(client.configPath, "utf8"))).toEqual({
|
||||
mcp_servers: {
|
||||
rea: { command: command[0], args: command.slice(1), enabled: true },
|
||||
},
|
||||
});
|
||||
expect(
|
||||
(
|
||||
await readClientRegistrationStatuses(home, undefined, {
|
||||
platform: process.platform,
|
||||
environment: {},
|
||||
})
|
||||
).find(({ client: name }) => name === "hermes"),
|
||||
).toMatchObject({ state: "aligned", command });
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user