Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions web/src/components/AuthForm.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @vitest-environment jsdom

import { cleanup, fireEvent, render, screen, within } from "@testing-library/react";
import { fireEvent, render, screen, within } from "@testing-library/react";
import type { ButtonHTMLAttributes, InputHTMLAttributes, ReactNode } from "react";
import { afterEach, describe, expect, it, vi } from "vitest";
import { describe, expect, it, vi } from "vitest";
import { AuthForm } from "@/components/AuthForm";
import type { AuthConfig } from "@/lib/api";
import { translate } from "@/lib/i18n";
Expand Down Expand Up @@ -85,7 +85,6 @@ const providers: AuthConfig["identity_providers"] = [
}
];

afterEach(cleanup);
const t = (key: string, values?: Record<string, string | number>) =>
translate("en", key, values);

Expand Down
6 changes: 2 additions & 4 deletions web/src/components/ProviderBrandMark.test.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// @vitest-environment jsdom

import { cleanup, render } from "@testing-library/react";
import { afterEach, describe, expect, it } from "vitest";
import { render } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import {
ProviderBrandMark,
type ProviderBrand
} from "@/components/ProviderBrandMark";

afterEach(cleanup);

describe("ProviderBrandMark", () => {
it("maps each repository brand to its explicit official asset", () => {
const brands: ProviderBrand[] = [
Expand Down
6 changes: 2 additions & 4 deletions web/src/components/ui.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// @vitest-environment jsdom

import { cleanup, render } from "@testing-library/react";
import { afterEach, describe, expect, it } from "vitest";
import { render } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { UiButton } from "@/components/ui";

afterEach(cleanup);

describe("UiButton", () => {
it("serializes boolean ARIA state for the custom-element host", () => {
const { container, rerender } = render(<UiButton aria-pressed disabled />);
Expand Down
2 changes: 0 additions & 2 deletions web/src/pages/ProfilePage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import {
cleanup,
fireEvent,
render,
screen,
Expand Down Expand Up @@ -146,7 +145,6 @@ function renderProfile() {
}

afterEach(() => {
cleanup();
vi.clearAllMocks();
});

Expand Down
3 changes: 1 addition & 2 deletions web/src/pages/ProjectsPage.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @vitest-environment jsdom

import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import { fireEvent, render, screen } from "@testing-library/react";
import type {
ButtonHTMLAttributes,
InputHTMLAttributes,
Expand Down Expand Up @@ -145,7 +145,6 @@ function renderPage(projects: Project[] = []) {
}

afterEach(() => {
cleanup();
vi.clearAllMocks();
});

Expand Down
6 changes: 2 additions & 4 deletions web/src/pages/projects/PptxImportDialog.test.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// @vitest-environment jsdom

import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import type {
ButtonHTMLAttributes,
ComponentProps,
InputHTMLAttributes,
ReactNode,
SelectHTMLAttributes
} from "react";
import { afterEach, describe, expect, it, vi } from "vitest";
import { describe, expect, it, vi } from "vitest";
import type { ProcessingInputProfileSelector } from "@/lib/api";
import type { Translator } from "@/lib/i18n";
import { PptxImportDialog } from "@/pages/projects/PptxImportDialog";
Expand Down Expand Up @@ -74,8 +74,6 @@ const selector: ProcessingInputProfileSelector = {
]
};

afterEach(() => cleanup());

function renderDialog(
overrides: Partial<ComponentProps<typeof PptxImportDialog>> = {}
) {
Expand Down
5 changes: 1 addition & 4 deletions web/src/pages/workspace/components/RevisionsPanel.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @vitest-environment jsdom

import {
cleanup,
fireEvent,
render,
screen,
Expand All @@ -13,7 +12,7 @@ import type {
InputHTMLAttributes,
ReactNode
} from "react";
import { afterEach, describe, expect, it, vi } from "vitest";
import { describe, expect, it, vi } from "vitest";
import type { Translator } from "@/lib/i18n";
import { RevisionsPanel } from "@/pages/workspace/components/RevisionsPanel";

Expand Down Expand Up @@ -73,8 +72,6 @@ vi.mock("@/components/HistoryPanel", () => ({

const t: Translator = (key) => key;

afterEach(() => cleanup());

function renderPanel(
overrides: Partial<ComponentProps<typeof RevisionsPanel>> = {}
) {
Expand Down
1 change: 1 addition & 0 deletions web/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default defineConfig({
},
test: {
execArgv: ["--no-experimental-webstorage"],
setupFiles: ["./vitest.setup.ts"],
include: ["src/**/*.test.ts", "src/**/*.test.tsx"],
exclude: ["tests/e2e/**", "node_modules/**"]
}
Expand Down
4 changes: 4 additions & 0 deletions web/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { cleanup } from "@testing-library/react";
import { afterEach } from "vitest";

afterEach(cleanup);