chore: Enable more lint rules, disable some that trigger a lot. Will clean up later.

This commit is contained in:
cpojer
2026-01-31 16:03:28 +09:00
parent 481f696a87
commit 15792b153f
292 changed files with 643 additions and 699 deletions

View File

@@ -286,11 +286,11 @@ describe("browser control server", () => {
async () => {
const base = await startServerAndBase();
const select = (await postJson(`${base}/act`, {
const select = await postJson(`${base}/act`, {
kind: "select",
ref: "5",
values: ["a", "b"],
})) as { ok: boolean };
});
expect(select.ok).toBe(true);
expect(pwMocks.selectOptionViaPlaywright).toHaveBeenCalledWith({
cdpUrl: cdpBaseUrl,
@@ -299,10 +299,10 @@ describe("browser control server", () => {
values: ["a", "b"],
});
const fill = (await postJson(`${base}/act`, {
const fill = await postJson(`${base}/act`, {
kind: "fill",
fields: [{ ref: "6", type: "textbox", value: "hello" }],
})) as { ok: boolean };
});
expect(fill.ok).toBe(true);
expect(pwMocks.fillFormViaPlaywright).toHaveBeenCalledWith({
cdpUrl: cdpBaseUrl,
@@ -310,11 +310,11 @@ describe("browser control server", () => {
fields: [{ ref: "6", type: "textbox", value: "hello" }],
});
const resize = (await postJson(`${base}/act`, {
const resize = await postJson(`${base}/act`, {
kind: "resize",
width: 800,
height: 600,
})) as { ok: boolean };
});
expect(resize.ok).toBe(true);
expect(pwMocks.resizeViewportViaPlaywright).toHaveBeenCalledWith({
cdpUrl: cdpBaseUrl,
@@ -323,10 +323,10 @@ describe("browser control server", () => {
height: 600,
});
const wait = (await postJson(`${base}/act`, {
const wait = await postJson(`${base}/act`, {
kind: "wait",
timeMs: 5,
})) as { ok: boolean };
});
expect(wait.ok).toBe(true);
expect(pwMocks.waitForViaPlaywright).toHaveBeenCalledWith({
cdpUrl: cdpBaseUrl,
@@ -336,10 +336,10 @@ describe("browser control server", () => {
textGone: undefined,
});
const evalRes = (await postJson(`${base}/act`, {
const evalRes = await postJson(`${base}/act`, {
kind: "evaluate",
fn: "() => 1",
})) as { ok: boolean; result?: unknown };
});
expect(evalRes.ok).toBe(true);
expect(evalRes.result).toBe("ok");
expect(pwMocks.evaluateViaPlaywright).toHaveBeenCalledWith({
@@ -358,17 +358,17 @@ describe("browser control server", () => {
cfgEvaluateEnabled = false;
const base = await startServerAndBase();
const waitRes = (await postJson(`${base}/act`, {
const waitRes = await postJson(`${base}/act`, {
kind: "wait",
fn: "() => window.ready === true",
})) as { error?: string };
});
expect(waitRes.error).toContain("browser.evaluateEnabled=false");
expect(pwMocks.waitForViaPlaywright).not.toHaveBeenCalled();
const res = (await postJson(`${base}/act`, {
const res = await postJson(`${base}/act`, {
kind: "evaluate",
fn: "() => 1",
})) as { error?: string };
});
expect(res.error).toContain("browser.evaluateEnabled=false");
expect(pwMocks.evaluateViaPlaywright).not.toHaveBeenCalled();
@@ -441,17 +441,14 @@ describe("browser control server", () => {
expect(consoleRes.ok).toBe(true);
expect(Array.isArray(consoleRes.messages)).toBe(true);
const pdf = (await postJson(`${base}/pdf`, {})) as {
ok: boolean;
path?: string;
};
const pdf = await postJson(`${base}/pdf`, {});
expect(pdf.ok).toBe(true);
expect(typeof pdf.path).toBe("string");
const shot = (await postJson(`${base}/screenshot`, {
const shot = await postJson(`${base}/screenshot`, {
element: "body",
type: "jpeg",
})) as { ok: boolean; path?: string };
});
expect(shot.ok).toBe(true);
expect(typeof shot.path).toBe("string");
});