Skip to content

How to use @vscode-elements/react-elements with Vitest (jsdom)? #19

@dankeboy36

Description

@dankeboy36

Hello, I’m trying to test a minimal React component that imports from @vscode-elements/react-elements using vitest ( and jsdom), but Vitest fails on a transitive import from @vscode-elements/elements:

Cannot find module '../includes/VscElement' imported from .../elements/dist/vscode-tree/vscode-tree.js

Repro: https://github.com/dankeboy36/vscode-react-elements-vitest-example

Is there a recommended Vitest/jsdom setup for these components?

I confirm that if I fully mock all VS Code elements, it works, but I prefer testing my app with the actual VS Code UI. Am I doing this wrong? Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions