mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 06:42:44 +00:00
chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -15,9 +15,7 @@ describe("ports helpers", () => {
|
||||
const server = net.createServer();
|
||||
await new Promise((resolve) => server.listen(0, resolve));
|
||||
const port = (server.address() as net.AddressInfo).port;
|
||||
await expect(ensurePortAvailable(port)).rejects.toBeInstanceOf(
|
||||
PortInUseError,
|
||||
);
|
||||
await expect(ensurePortAvailable(port)).rejects.toBeInstanceOf(PortInUseError);
|
||||
server.close();
|
||||
});
|
||||
|
||||
@@ -27,22 +25,14 @@ describe("ports helpers", () => {
|
||||
log: vi.fn(),
|
||||
exit: vi.fn() as unknown as (code: number) => never,
|
||||
};
|
||||
await handlePortError(
|
||||
{ code: "EADDRINUSE" },
|
||||
1234,
|
||||
"context",
|
||||
runtime,
|
||||
).catch(() => {});
|
||||
await handlePortError({ code: "EADDRINUSE" }, 1234, "context", runtime).catch(() => {});
|
||||
expect(runtime.error).toHaveBeenCalled();
|
||||
expect(runtime.exit).toHaveBeenCalledWith(1);
|
||||
});
|
||||
|
||||
it("classifies ssh and gateway listeners", () => {
|
||||
expect(
|
||||
classifyPortListener(
|
||||
{ commandLine: "ssh -N -L 18789:127.0.0.1:18789 user@host" },
|
||||
18789,
|
||||
),
|
||||
classifyPortListener({ commandLine: "ssh -N -L 18789:127.0.0.1:18789 user@host" }, 18789),
|
||||
).toBe("ssh");
|
||||
expect(
|
||||
classifyPortListener(
|
||||
@@ -59,10 +49,7 @@ describe("ports helpers", () => {
|
||||
port: 18789,
|
||||
status: "busy" as const,
|
||||
listeners: [{ pid: 123, commandLine: "ssh -N -L 18789:127.0.0.1:18789" }],
|
||||
hints: buildPortHints(
|
||||
[{ pid: 123, commandLine: "ssh -N -L 18789:127.0.0.1:18789" }],
|
||||
18789,
|
||||
),
|
||||
hints: buildPortHints([{ pid: 123, commandLine: "ssh -N -L 18789:127.0.0.1:18789" }], 18789),
|
||||
};
|
||||
const lines = formatPortDiagnostics(diagnostics);
|
||||
expect(lines[0]).toContain("Port 18789 is already in use");
|
||||
|
||||
Reference in New Issue
Block a user