Fork Horse repository, listed by its owner. Publisher snapshot.
packages/forkhorse-dashboard/test/roles.ts
Snapshot at 34e3175
1import { createRequire } from "node:module";
2
3// The frozen root toolchain already declares vite-plus -> @vitest/browser-preview ->
4// @testing-library/dom (10.4.1 in pnpm-lock.yaml). Keep this DOM-only dependency
5// here: no production import, extra install, machine path or imitation name algorithm.
6const rootRequire = createRequire(new URL("../../../package.json", import.meta.url));
7const toolchainRequire = createRequire(rootRequire.resolve("vite-plus"));
8const previewRequire = createRequire(toolchainRequire.resolve("@vitest/browser-preview"));
9const testingLibraryEntry = previewRequire.resolve("@testing-library/dom");
10const testingLibraryRequire = createRequire(testingLibraryEntry);
11export const { getByRole, queryByRole, getAllByRole } = testingLibraryRequire(testingLibraryEntry) as {
12 getByRole(container: HTMLElement, role: string, options: { name: string | RegExp; hidden?: boolean }): HTMLElement;
13 queryByRole(container: HTMLElement, role: string, options: { name: string | RegExp; hidden?: boolean }): HTMLElement | null;
14 getAllByRole(container: HTMLElement, role: string, options: { name: string | RegExp; hidden?: boolean }): HTMLElement[];
15};
16export const { computeAccessibleName, computeAccessibleDescription } = testingLibraryRequire("dom-accessibility-api") as {
17 computeAccessibleName(element: Element): string;
18 computeAccessibleDescription(element: Element): string;
19};
20