Skip to content

Commit 008266e

Browse files
AlexsJonesclaude
andcommitted
fix: resolve all Cypress TypeScript errors
- Add missing `export {}` to 7 spec files to prevent global scope variable redeclaration conflicts (NS, INSTANCE, apiHeaders) - Fix Cypress.Commands.overwrite visit signature for Cypress 15+ - Fix waitForDeleted return type mismatch (Chainable<Response> vs void) - Fix HTMLBodyElement cast in runs-filter-and-sort - Add skipLibCheck to cypress/tsconfig.json for Cypress internal stubs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3a163dc commit 008266e

10 files changed

Lines changed: 39 additions & 20 deletions

web/cypress/e2e/instance-create-adhoc.cy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,5 @@ describe("Ad-hoc Instance — Create and Run", () => {
101101
});
102102
});
103103
});
104+
105+
export {};

web/cypress/e2e/instance-create-llama-server.cy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,5 @@ describe("Create Instance — llama-server", () => {
6666
cy.contains(INSTANCE, { timeout: 20000 }).should("be.visible");
6767
});
6868
});
69+
70+
export {};

web/cypress/e2e/instance-create-lmstudio.cy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,5 @@ describe("Create Instance — LM Studio", () => {
6767
cy.contains(INSTANCE, { timeout: 20000 }).should("be.visible");
6868
});
6969
});
70+
71+
export {};

web/cypress/e2e/instance-create-unsloth.cy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,5 @@ describe("Create Instance — Unsloth", () => {
6767
cy.contains(INSTANCE, { timeout: 20000 }).should("be.visible");
6868
});
6969
});
70+
71+
export {};

web/cypress/e2e/instance-multi-run-lmstudio.cy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,5 @@ describe("Ad-hoc Instance — Multiple Runs and Delete", () => {
120120
cy.contains(INSTANCE, { timeout: 20000 }).should("not.exist");
121121
});
122122
});
123+
124+
export {};

web/cypress/e2e/personapack-research-team-workflow.cy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,5 @@ describe("Research Team — default pack with relationships", () => {
192192
});
193193
});
194194
});
195+
196+
export {};

web/cypress/e2e/personapack-workflow-canvas.cy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,3 +245,5 @@ spec:
245245
});
246246
});
247247
});
248+
249+
export {};

web/cypress/e2e/runs-filter-and-sort.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe("Runs list — filter and sort", () => {
3939
cy.get("body").then(($body) => {
4040
const $inputs = $body.find("input[type='search'], input[type='text']");
4141
const $search = $inputs.filter((_, el) => {
42-
const ph = (el as HTMLInputElement).placeholder || "";
42+
const ph = (el as unknown as HTMLInputElement).placeholder || "";
4343
return /search|filter/i.test(ph);
4444
});
4545
if ($search.length > 0) {

web/cypress/support/e2e.ts

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@
33
// ── Auth: inject API token via visit callback ───────────────────────────────
44
// Overrides cy.visit to inject the token into localStorage before the app
55
// reads it. Token is read from CYPRESS_API_TOKEN env var.
6-
Cypress.Commands.overwrite("visit", (originalFn, url, options) => {
7-
const token = Cypress.env("API_TOKEN");
8-
if (!token) return originalFn(url, options);
9-
10-
const opts = { ...options } as Cypress.VisitObject;
11-
const originalOnBeforeLoad = opts.onBeforeLoad;
12-
opts.onBeforeLoad = (win) => {
13-
win.localStorage.setItem("sympozium_token", token);
14-
win.localStorage.setItem("sympozium_namespace", "default");
15-
if (originalOnBeforeLoad) originalOnBeforeLoad(win);
16-
};
17-
return originalFn(url, opts);
18-
});
6+
Cypress.Commands.overwrite(
7+
"visit",
8+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
9+
(originalFn: any, url: string | Partial<Cypress.VisitOptions>, options?: Partial<Cypress.VisitOptions>) => {
10+
const token = Cypress.env("API_TOKEN");
11+
if (!token) return originalFn(url, options);
12+
13+
const opts: Partial<Cypress.VisitOptions> = { ...options };
14+
const originalOnBeforeLoad = opts.onBeforeLoad;
15+
opts.onBeforeLoad = (win: Cypress.AUTWindow) => {
16+
win.localStorage.setItem("sympozium_token", token);
17+
win.localStorage.setItem("sympozium_namespace", "default");
18+
if (originalOnBeforeLoad) originalOnBeforeLoad(win);
19+
};
20+
return originalFn(url, opts);
21+
},
22+
);
1923

2024
// ── Custom commands ─────────────────────────────────────────────────────────
2125
declare global {
@@ -200,24 +204,24 @@ Cypress.Commands.add(
200204
Cypress.Commands.add("waitForDeleted", (path: string, timeoutMs = 30000) => {
201205
const started = Date.now();
202206
const poll = (): Cypress.Chainable<void> => {
203-
return cy
207+
return (cy
204208
.request({
205209
url: path,
206210
headers: authHeaders(),
207211
failOnStatusCode: false,
208212
})
209-
.then((resp) => {
213+
.then((resp): void => {
210214
if (resp.status === 404) {
211-
return cy.wrap(undefined);
215+
return;
212216
}
213217
if (Date.now() - started > timeoutMs) {
214218
throw new Error(
215219
`waitForDeleted(${path}) timed out; last status=${resp.status}`,
216220
);
217221
}
218222
cy.wait(1000, { log: false });
219-
return poll();
220-
});
223+
poll();
224+
}) as unknown as Cypress.Chainable<void>);
221225
};
222226
return poll();
223227
});

web/cypress/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"compilerOptions": {
33
"target": "ES2020",
44
"lib": ["ES2020", "DOM", "DOM.Iterable"],
5-
"types": ["cypress"]
5+
"types": ["cypress"],
6+
"skipLibCheck": true
67
},
78
"include": ["**/*.ts"]
89
}

0 commit comments

Comments
 (0)