Vitest fails with TypeError: Unknown file extension ".jsx"

Open
#157 18 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
typescript, vite

Research direction

Start with the Solid testing guide linked in the report and the documented Vitest configuration, then reproduce the failure involving the .jsx file under node_modules/@corvu/utils. Done means the documented setup can run the reported TSX component test without the unknown file extension error.

Written by the indexing model from the issue text.

Description

I am trying to test a component using Vitest, but following the documentation fails with this error
https://docs.solidjs.com/guides/testing#adding-testing-packages

TypeError: Unknown file extension ".jsx" for /media/aminya/Linux/GitHub/test/test/node_modules/.pnpm/@corvu+utils@0.2.0_solid-js@1.8.17/node_modules/@corvu/utils/dist/reactivity/index.jsx

My test file is a tsx file. It seems Vitest has trouble loading the .jsx file. My config is the same as the doc.


        "@solidjs/testing-library": "^0.8.8",
        "@testing-library/jest-dom": "^6.4.5",
        "@testing-library/user-event": "^14.5.2",
        "@vitest/coverage-v8": "^1.6.0",
        "@vitest/ui": "^1.6.0",
        "solid-devtools": "^0.30.1",
        "typescript": "^5.4.5",
        "vite": "^5.2.12",
        "vite-plugin-solid": "^2.10.2",
        "vitest": "^1.6.0"
    
Dominant language
TypeScript
Stars
520
Forks
70
Avg merge
23h 35m
Merged PRs (30d)
39

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from solidjs/solid-vite-plugin

All issues in solidjs/solid-vite-plugin

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.