vuejs/vue-test-utils-jest-example

MessageComponent.props() causes issue.

roymath-zz opened this issue · 2 comments

The tests fail when doing a clean install and test.. the following changes seem to fix the issue (borrowed from the vue-test-utils-mocha-webpack-example)

modified   test/MessageToggle.spec.js
@@ -8,8 +8,8 @@ describe('MessageToggle.vue', () => {
     const button = wrapper.find('#toggle-message')
     button.trigger('click')
     const MessageComponent = wrapper.find(Message)
-    expect(MessageComponent.props()).toEqual({msg: 'message'})
+    expect(MessageComponent.hasProp('msg', 'message')).toBe(true)
     button.trigger('click')
-    expect(MessageComponent.props()).toEqual({msg: 'toggled message'})
+    expect(MessageComponent.hasProp('msg', 'toggled message')).toBe(true)

Thanks for the issue 🙂

The problem was the package-lock was using beta.1 which didn't have the props method, I've bumped the version to beta.8

Much appreciated.. love jest for vue testing (and it even renders nicely in an emacs term buffer)