Skip unrelated required checks without losing their names (#2542)
* fix(ci): skip unrelated required checks cleanly Matrix jobs had to start no-op runners to preserve interpolated required-check names. Static named jobs let GitHub report genuine skipped conclusions while keeping those names stable. * fix(ci): gate changes to install patching script * fix(ci): route cross-package test contracts narrowly * fix(ci): keep routed contracts merge-blocking * fix(server): exclude nested test utilities from builds * fix(ci): cover app-owned native and browser domains * refactor(ci): align tests with runtime domains Own browser specs, desktop specs, and Electron-only app code by stable directories so PR routing does not depend on filename conventions. Keep desktop integration coverage inside the required desktop check. * fix(ci): keep routing and desktop suites isolated The routing regression must run before dependency installation, and desktop Vitest must not collect Playwright-owned specs. * fix(ci): isolate desktop e2e runtime * perf(test): isolate Playwright workers * perf(test): parallelize Playwright within specs * fix(test): keep Playwright file scheduling * fix(test): share dynamic Metro fixture * fix(test): preserve own-host restart fixtures * fix(ci): preserve routed contracts after rebase * Stabilize Playwright wheel-scroll assertions
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
interface OwnedResourceResult {
|
||||
project?: { projectId: string } | null;
|
||||
workspace?: { projectId: string } | null;
|
||||
}
|
||||
|
||||
interface ProjectClient {
|
||||
addProject?: (...args: unknown[]) => Promise<OwnedResourceResult>;
|
||||
close(): Promise<void>;
|
||||
createPaseoWorktree?: (...args: unknown[]) => Promise<OwnedResourceResult>;
|
||||
createWorkspace?: (...args: unknown[]) => Promise<OwnedResourceResult>;
|
||||
removeProject(projectId: string): Promise<unknown>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a test client own every project it creates. Closing the client removes
|
||||
* those projects first, which also terminates their workspaces and terminals.
|
||||
*/
|
||||
export function withProjectOwnership<Client extends object>(client: Client): Client {
|
||||
const target = client as Client & ProjectClient;
|
||||
const projectIds = new Set<string>();
|
||||
let closed = false;
|
||||
|
||||
async function trackProject(result: OwnedResourceResult) {
|
||||
const projectId = result.project?.projectId ?? result.workspace?.projectId;
|
||||
if (projectId) projectIds.add(projectId);
|
||||
return result;
|
||||
}
|
||||
|
||||
return new Proxy(client, {
|
||||
get(_target, property) {
|
||||
if (property === "addProject" && target.addProject) {
|
||||
const addProject = target.addProject.bind(target);
|
||||
return async (...args: unknown[]) => trackProject(await addProject(...args));
|
||||
}
|
||||
if (property === "createWorkspace" && target.createWorkspace) {
|
||||
const createWorkspace = target.createWorkspace.bind(target);
|
||||
return async (...args: unknown[]) => trackProject(await createWorkspace(...args));
|
||||
}
|
||||
if (property === "createPaseoWorktree" && target.createPaseoWorktree) {
|
||||
const createPaseoWorktree = target.createPaseoWorktree.bind(target);
|
||||
return async (...args: unknown[]) => trackProject(await createPaseoWorktree(...args));
|
||||
}
|
||||
if (property === "removeProject") {
|
||||
return async (projectId: string) => {
|
||||
const result = await target.removeProject(projectId);
|
||||
projectIds.delete(projectId);
|
||||
return result;
|
||||
};
|
||||
}
|
||||
if (property === "close") {
|
||||
return async () => {
|
||||
if (closed) return;
|
||||
closed = true;
|
||||
for (const projectId of projectIds) {
|
||||
await target.removeProject(projectId).catch(() => undefined);
|
||||
}
|
||||
await target.close();
|
||||
};
|
||||
}
|
||||
const value = Reflect.get(target, property, target);
|
||||
return typeof value === "function" ? value.bind(target) : value;
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user