Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aminya opened this issue Jun 4, 2024 · 6 comments
Open

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

aminya opened this issue Jun 4, 2024 · 6 comments

Comments

@aminya
Copy link
Contributor

aminya commented Jun 4, 2024

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"
    
@NexRX
Copy link

NexRX commented Jul 15, 2024

Im not alone, yes!
I have a stackblitz here that reproduces it and it's fairly minimal, only adding one file ontop of the solidstart vitest template.
https://stackblitz.com/edit/solidjs-templates-6zmfus?file=package.json&view=editor

Did you ever manage to fix it?

@aminya
Copy link
Contributor Author

aminya commented Jul 15, 2024

No, I could not fix the issue, but I added a production in #158 as well. I talked to @ryansolid about this. He mentioned that @atk created the testing part of the plugin.

@atk
Copy link
Contributor

atk commented Jul 16, 2024

It is really hard to keep up with the constant changes, so I'm sorry, but I have no fast solution.

@aminya
Copy link
Contributor Author

aminya commented Jul 16, 2024

Does #158 help you debug the issue?

@NexRX
Copy link

NexRX commented Jul 17, 2024

I'm working around this with the experimental vitest feature 'browser mode' so no fast solutions needed personally :)

@jaroel
Copy link

jaroel commented Sep 16, 2024

I'm on MacOS and use PNPM. preserveSymlinks: true seems to fix the problem for me, YMMV.

import { defineConfig } from "vitest/config";
export default defineConfig({
  resolve: {
    preserveSymlinks: true,
  },
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants