-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Mocha tests for React (jsx) aren't parsed as jsx
if test filename has .js
extension
#6834
Comments
Use @swc/ore instead |
This can't be fixed without a repro |
@yairEO Remove https://github.com/yairEO/swc-js-extension-fails-with-jsx-content/blob/8b9df6322aa5ef3a5220cd62f565d72e9a3e1e93/.swcrc#L3 |
@kdy1 - no, it's not that. Makes no sense it is related, and also just tried and it makes no difference.. |
Thanks for the help, but how is it possible
I've just verified |
I don't know well about mocha |
I've just verified Without it it cannot compile any tests, not even If you remove it from the I don't think this is a Mocha-related issue, because the same setup with Babel works well, for With Babel:
With SWC:
|
Any news? I really really want to switch the company's huge codebase from Babel to SWC :) Babel is super-slow in our case with too many files |
This comment has been minimized.
This comment has been minimized.
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Repo - https://github.com/yairEO/swc-js-extension-fails-with-jsx-content
Describe the bug
Hi, I am trying to convert a large project from Mocha + babel to Mocha + SWC, but get errors if the test file extension ends with
.js
and not.jsx
. I have hundreds of files like this.Renaming one of them makes SWC compile it correctly, but I really prefer keeping the tests files with the
.js
extension.the project is based on React v16, so every component and its test file has the
React
import:I would assume SWC would be smart enough to automatically know the content of the file is JSX...
Input code
No response
Config
Expected behavior
Should transpile JSX for
.js
files automaticallyActual behavior
No response
Version
1.5.5
Additional context
Am using these packages:
Running the tests with this
.mocharc
:The text was updated successfully, but these errors were encountered: