-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Unit Test plugin and TypeScript w/ TSX not working #3100
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
Comments
Ok, so it seems if I use What is the difference of using |
I would consider this a bug. In our webpack config, we use ts-loader and babel-loader after it, which compiles the JSX (Typescript can't compile JSX into Vue render functions) In jest, we can configure ts-jest to use Babel as well, but we haven't made this a default setting so far. This can be fixed though. For your project, have a look at the docs for ts-jest, there you find the option or set to make it use Babel (I'm on mobile right now so no code snippets) |
For now it seems using |
When using Typescript and Babel, ts-jest should use babel to transform result for correct JSX transforms close #3100
When using Typescript and Babel, ts-jest should use babel to transform result for correct JSX transforms close #3100
…belConfig (#3107) * fix(cli-plugin-unit-jest): use ts-jest babelConfig When using Typescript and Babel, ts-jest should use babel to transform result for correct JSX transforms close #3100 * refactor: write generator a bit differently. previous way could end up with ugly `global: undefined` when not using babel
I was getting the following error:
My babel:
My jest:
Adding |
Best open a new issue with a repoduction repo - it's likely a different issue, since this thread is around 3 yrs old @Maxim-Mazurok. |
Thanks for a motivating push, @lmiller1990 :) |
Uh oh!
There was an error while loading. Please reload this page.
Version
3.2.1
Reproduction link
https://github.com/lmiller1990/vue-cl-tsx-bug/pull/new/master
Environment info
Steps to reproduce
Clone above and
yarn test:unit
, or if you want your own:Scaffold app
Select unit tests, typescript and babel
Change HelloWorld.vue to HelloWorld.tsx and fill with the following:
Update
example.spec.ts
toimport { MyComponent } from '@/components/MyComponent
andshallowMount(MyComponent)...
Run the tests with
yarn test:unit
. I get:What is expected?
Runs the test fine
What is actually happening?
Does not appear to transpile the JSX/TSX
Maybe some work involving babel can fix this? I think all the official tools should work together. Maybe babel can do it.
The text was updated successfully, but these errors were encountered: