diff --git a/package.json b/package.json index ba41709..7d1b273 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "prepare": "husky install", "prettier": "prettier --write src/**/*.{ts,tsx}", "lint": "eslint \"{src,tests,examples}**/*.{ts,tsx}\"", - "test": "vitest --globals --environment happy-dom -w false --coverage", + "test": "vitest --globals --dom -w false --coverage", "storybook": "storybook dev -p 6006", "build-storybook": "storybook build" }, diff --git a/tests/usePopperTooltip.spec.tsx b/tests/usePopperTooltip.spec.tsx index 54249b4..e2556ca 100644 --- a/tests/usePopperTooltip.spec.tsx +++ b/tests/usePopperTooltip.spec.tsx @@ -146,22 +146,18 @@ describe('trigger option', () => { // Nothing after hover user.hover(screen.getByText(TriggerText)); - vi.runAllTimers(); expect(screen.queryByText(TooltipText)).not.toBeInTheDocument(); // Nothing after click user.click(screen.getByText(TriggerText)); - vi.runAllTimers(); expect(screen.queryByText(TooltipText)).not.toBeInTheDocument(); // Nothing after right-click fireEvent.contextMenu(screen.getByText(TriggerText)); - vi.runAllTimers(); expect(screen.queryByText(TooltipText)).not.toBeInTheDocument(); // Nothing after focus fireEvent.focus(screen.getByText(TriggerText)); - vi.runAllTimers(); expect(screen.queryByText(TooltipText)).not.toBeInTheDocument(); }); }); @@ -262,7 +258,6 @@ describe('visible option controls the state and', () => { // The state is controlled, click doesn't change it user.click(screen.getByText(TriggerText)); - vi.runAllTimers(); expect(screen.queryByText(TooltipText)).not.toBeInTheDocument(); }); @@ -272,7 +267,6 @@ describe('visible option controls the state and', () => { // The state is controlled, click doesn't change it user.click(screen.getByText(TriggerText)); - vi.runAllTimers(); expect(await screen.findByText(TooltipText)).toBeInTheDocument(); }); }); diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..c65c4cb --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,9 @@ +import {defineConfig} from 'vitest/config'; + +export default defineConfig({ + test: { + coverage: { + include: ['src/**/*.ts'], + }, + }, +});