1
mirror of https://github.com/jakejarvis/hoot.git synced 2025-10-18 20:14:25 -04:00

Update Vitest configuration to remove jsdom environment and add environment declarations to test files

This commit is contained in:
2025-10-12 00:02:03 -04:00
parent cc5140d08e
commit 224e079a7a
31 changed files with 27 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event"; import userEvent from "@testing-library/user-event";
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { CreateIssueButton } from "@/components/create-issue-button"; import { CreateIssueButton } from "@/components/create-issue-button";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";
import { DnsRecordList } from "@/components/domain/dns-record-list"; import { DnsRecordList } from "@/components/domain/dns-record-list";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";
import { DomainReportView } from "@/components/domain/domain-report-view"; import { DomainReportView } from "@/components/domain/domain-report-view";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event"; import userEvent from "@testing-library/user-event";
import { beforeEach, describe, expect, it, vi } from "vitest"; import { beforeEach, describe, expect, it, vi } from "vitest";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event"; import userEvent from "@testing-library/user-event";
import { createElement } from "react"; import { createElement } from "react";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event"; import userEvent from "@testing-library/user-event";
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";
import { exportDomainData } from "./export-data"; import { exportDomainData } from "./export-data";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import { createElement } from "react"; import { createElement } from "react";
import type { Mock } from "vitest"; import type { Mock } from "vitest";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen, waitFor } from "@testing-library/react"; import { render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event"; import userEvent from "@testing-library/user-event";
import { beforeEach, describe, expect, it, vi } from "vitest"; import { beforeEach, describe, expect, it, vi } from "vitest";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event"; import userEvent from "@testing-library/user-event";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";
import { ProviderValue } from "./provider-value"; import { ProviderValue } from "./provider-value";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen, waitFor } from "@testing-library/react"; import { render, screen, waitFor } from "@testing-library/react";
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { RelativeExpiry } from "./relative-expiry"; import { RelativeExpiry } from "./relative-expiry";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { fireEvent, render, screen } from "@testing-library/react"; import { fireEvent, render, screen } from "@testing-library/react";
import type { Mock } from "vitest"; import type { Mock } from "vitest";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import { createElement } from "react"; import { createElement } from "react";
import type { Mock } from "vitest"; import type { Mock } from "vitest";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";
import { CertificatesSection, equalHostname } from "./certificates-section"; import { CertificatesSection, equalHostname } from "./certificates-section";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";
import { DnsRecordsSection } from "./dns-records-section"; import { DnsRecordsSection } from "./dns-records-section";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";
import { HeadersSection } from "./headers-section"; import { HeadersSection } from "./headers-section";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";
import { HostingEmailSection } from "./hosting-email-section"; import { HostingEmailSection } from "./hosting-email-section";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";
import { formatRegistrant, RegistrationSection } from "./registration-section"; import { formatRegistrant, RegistrationSection } from "./registration-section";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event"; import userEvent from "@testing-library/user-event";
import { createElement } from "react"; import { createElement } from "react";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import { createElement } from "react"; import { createElement } from "react";
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment jsdom */
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";
import { TtlBadge } from "./ttl-badge"; import { TtlBadge } from "./ttl-badge";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment node */
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { isValidDomain, normalizeDomainInput } from "./domain"; import { isValidDomain, normalizeDomainInput } from "./domain";

View File

@@ -1,3 +1,4 @@
/* @vitest-environment node */
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { formatDate, formatTtl } from "./format"; import { formatDate, formatTtl } from "./format";

View File

@@ -1,5 +1,4 @@
/* @vitest-environment node */ /* @vitest-environment node */
import sharp from "sharp"; import sharp from "sharp";
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { import {

View File

@@ -1,3 +1,4 @@
/* @vitest-environment node */
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { import {
detectCertificateAuthority, detectCertificateAuthority,

View File

@@ -1,3 +1,4 @@
/* @vitest-environment node */
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { import {
parseHtmlMeta, parseHtmlMeta,

View File

@@ -1,5 +1,4 @@
/* @vitest-environment node */ /* @vitest-environment node */
import type * as tls from "node:tls"; import type * as tls from "node:tls";
// Hoisted mock for node:tls to avoid ESM spy limitations // Hoisted mock for node:tls to avoid ESM spy limitations

View File

@@ -1,5 +1,4 @@
/* @vitest-environment node */ /* @vitest-environment node */
import type { Mock } from "vitest"; import type { Mock } from "vitest";
import { afterEach, describe, expect, it, vi } from "vitest"; import { afterEach, describe, expect, it, vi } from "vitest";
import { detectHosting } from "./hosting"; import { detectHosting } from "./hosting";

View File

@@ -5,7 +5,6 @@ import { coverageConfigDefaults, defineConfig } from "vitest/config";
export default defineConfig({ export default defineConfig({
plugins: [tsconfigPaths(), react()], plugins: [tsconfigPaths(), react()],
test: { test: {
environment: "jsdom",
setupFiles: ["./vitest.setup.ts"], setupFiles: ["./vitest.setup.ts"],
css: true, css: true,
globals: true, globals: true,