fix(test): add @vitest-environment happy-dom to React UI test files
6 test files across 4 packages (auth-ui, dashboard-components, dashboard-shell, react-auth) failed with 'document is not defined' when run from the monorepo root because the root vitest config uses environment: 'node'. The package-local configs set happy-dom but are ignored when vitest is invoked from root. Fix: Add per-file '// @vitest-environment happy-dom' annotations, which is the recommended vitest pattern for mixed-environment monorepos. This ensures tests work regardless of which config is loaded. Recovers 148 tests across 6 files.
This commit is contained in:
parent
22780b0e7e
commit
9471d4c56f
@ -1,3 +1,4 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||
import { render, screen, fireEvent, cleanup } from '@testing-library/react';
|
||||
import { LoginForm } from '../LoginForm.js';
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||
import { render, screen, fireEvent, cleanup } from '@testing-library/react';
|
||||
import { RegisterForm } from '../RegisterForm.js';
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import { LoadingSpinner } from './LoadingSpinner.js';
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { render, screen, fireEvent, cleanup } from '@testing-library/react';
|
||||
import { DashboardShell } from '../DashboardShell.js';
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||
import { render, screen, act, cleanup } from '@testing-library/react';
|
||||
import { createAuthProvider } from '../index.js';
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||
import { render, screen, act, cleanup } from '@testing-library/react';
|
||||
import { createAuthProvider } from '../index.js';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user