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

New project created with jest and typescript fails to run unit tests #2571

Closed
phil-scott-78 opened this issue Sep 22, 2018 · 2 comments
Closed

Comments

@phil-scott-78
Copy link

phil-scott-78 commented Sep 22, 2018

Version

3.0.3

Reproduction link

https://github.com/phil-scott-78/vue-cli-jest-bug

Node and OS info

Node v8.11.2, npm 5.6, Windows 10

Steps to reproduce

  1. vue create project
  2. manual options
  3. choose at least typescript and unit testing
  4. class style component
  5. no babel
  6. jest for unit testing
  7. either config

then

npm run test:unit

What is expected?

successful unit test run

What is actually happening?

receive this error

    Cannot find module 'vue-property-decorator' from 'HelloWorld.vue'

      32 |
      33 | <script lang="ts">
    > 34 | import { Component, Prop, Vue } from 'vue-property-decorator';
         | ^
      35 |
      36 | @Component
      37 | export default class HelloWorld extends Vue {

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:221:17)
      at src/components/HelloWorld.vue:34:1
      at Object.<anonymous> (src/components/HelloWorld.vue:27:3)

Things work fine if you aren't using typescript, so I suspect ts-jest is at fault. But to be honest this is my first steps into using jest with typescript so I'm a bit in over my head with troubleshooting.

@nklayman
Copy link

I get the same error on Ubuntu 18.04, so it's not platform-specific.

@phil-scott-78
Copy link
Author

Did some more sleuthing this morning. Looked to be an issue with the version 7.1.0 of vue-property-decorator. Looks like @kaorun343 already pushed up a fix. Updating to version 7.1.1 and everything is happy.

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

2 participants