From 0a37ca5aa70c28df8efb76a36f5db05a79e9fe6e Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Thu, 4 Dec 2025 20:06:41 +1000 Subject: [PATCH] test: mock react-syntax-highlighter to fix ESM compatibility in CodeBlock tests --- packages/ui/src/CodeBlock/CodeBlock.test.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/ui/src/CodeBlock/CodeBlock.test.tsx b/packages/ui/src/CodeBlock/CodeBlock.test.tsx index 913a8c0..632ca2c 100644 --- a/packages/ui/src/CodeBlock/CodeBlock.test.tsx +++ b/packages/ui/src/CodeBlock/CodeBlock.test.tsx @@ -2,6 +2,16 @@ import { render, screen, waitFor } from '@testing-library/react'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { CodeBlock } from './CodeBlock'; +// Mock react-syntax-highlighter to avoid ESM compatibility issues +vi.mock('react-syntax-highlighter', () => ({ + Prism: ({ children, ...props }: any) => {children}, +})); + +vi.mock('react-syntax-highlighter/dist/esm/styles/prism', () => ({ + prism: {}, + vscDarkPlus: {}, +})); + // Mock clipboard API const mockClipboard = { writeText: vi.fn(),