chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import { resetProcessRegistryForTests } from "./bash-process-registry.js";
|
||||
import {
|
||||
createExecTool,
|
||||
createProcessTool,
|
||||
execTool,
|
||||
processTool,
|
||||
} from "./bash-tools.js";
|
||||
import { createExecTool, createProcessTool, execTool, processTool } from "./bash-tools.js";
|
||||
import { sanitizeBinaryOutput } from "./shell-utils.js";
|
||||
|
||||
const isWin = process.platform === "win32";
|
||||
@@ -15,10 +10,8 @@ const yieldDelayCmd = isWin ? "Start-Sleep -Milliseconds 200" : "sleep 0.2";
|
||||
const longDelayCmd = isWin ? "Start-Sleep -Seconds 2" : "sleep 2";
|
||||
// Both PowerShell and bash use ; for command separation
|
||||
const joinCommands = (commands: string[]) => commands.join("; ");
|
||||
const echoAfterDelay = (message: string) =>
|
||||
joinCommands([shortDelayCmd, `echo ${message}`]);
|
||||
const echoLines = (lines: string[]) =>
|
||||
joinCommands(lines.map((line) => `echo ${line}`));
|
||||
const echoAfterDelay = (message: string) => joinCommands([shortDelayCmd, `echo ${message}`]);
|
||||
const echoLines = (lines: string[]) => joinCommands(lines.map((line) => `echo ${line}`));
|
||||
const normalizeText = (value?: string) =>
|
||||
sanitizeBinaryOutput(value ?? "")
|
||||
.replace(/\r\n/g, "\n")
|
||||
@@ -74,8 +67,7 @@ describe("exec tool backgrounding", () => {
|
||||
|
||||
let status = "running";
|
||||
let output = "";
|
||||
const deadline =
|
||||
Date.now() + (process.platform === "win32" ? 8000 : 2000);
|
||||
const deadline = Date.now() + (process.platform === "win32" ? 8000 : 2000);
|
||||
|
||||
while (Date.now() < deadline && status === "running") {
|
||||
const poll = await processTool.execute("call2", {
|
||||
@@ -106,9 +98,7 @@ describe("exec tool backgrounding", () => {
|
||||
const sessionId = (result.details as { sessionId: string }).sessionId;
|
||||
|
||||
const list = await processTool.execute("call2", { action: "list" });
|
||||
const sessions = (
|
||||
list.details as { sessions: Array<{ sessionId: string }> }
|
||||
).sessions;
|
||||
const sessions = (list.details as { sessions: Array<{ sessionId: string }> }).sessions;
|
||||
expect(sessions.some((s) => s.sessionId === sessionId)).toBe(true);
|
||||
});
|
||||
|
||||
@@ -121,9 +111,8 @@ describe("exec tool backgrounding", () => {
|
||||
await sleep(25);
|
||||
|
||||
const list = await processTool.execute("call2", { action: "list" });
|
||||
const sessions = (
|
||||
list.details as { sessions: Array<{ sessionId: string; name?: string }> }
|
||||
).sessions;
|
||||
const sessions = (list.details as { sessions: Array<{ sessionId: string; name?: string }> })
|
||||
.sessions;
|
||||
const entry = sessions.find((s) => s.sessionId === sessionId);
|
||||
expect(entry?.name).toBe("echo hello");
|
||||
});
|
||||
@@ -239,9 +228,7 @@ describe("exec tool backgrounding", () => {
|
||||
const sessionB = (resultB.details as { sessionId: string }).sessionId;
|
||||
|
||||
const listA = await processA.execute("call3", { action: "list" });
|
||||
const sessionsA = (
|
||||
listA.details as { sessions: Array<{ sessionId: string }> }
|
||||
).sessions;
|
||||
const sessionsA = (listA.details as { sessions: Array<{ sessionId: string }> }).sessions;
|
||||
expect(sessionsA.some((s) => s.sessionId === sessionA)).toBe(true);
|
||||
expect(sessionsA.some((s) => s.sessionId === sessionB)).toBe(false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user