Skip to content

Blockquote Plugin required when setup with Vitest #370

@anderson290

Description

@anderson290

Describe the bug
When running Vitest with SunEditor, tests failed due to a blockquote-related error originating from the SunEditor core.
The issue happened because SunEditor relies on browser-specific DOM APIs not available in the Node.js environment used by Vitest.
Since blockquote is part of the editor’s default plugins, Vitest couldn’t resolve it without mocking or providing a DOM-like environment.
This problem didn’t occur before because the tests weren’t importing the SunEditor modules directly in that way.

(I will post a screenshot and step by step as soon as I can)

Related repository

To Reproduce
Steps to reproduce the behavior:

  • Create a default Vite with Vitest react project
  • Setup a Suneditor React component and try to run npm run test with vitest while importing on a react page for example.

Expected behavior

  • Should be able to work fine with Vitests if I define plugins that I want.

Additional context
Let me know if I can help reproducing it

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions