This repository was archived by the owner on Dec 26, 2018. It is now read-only.
This repository was archived by the owner on Dec 26, 2018. It is now read-only.
Looking for examples of unit testing vueify components #152
Closed
Description
Hi there,
I am trying to mock some dependencies for testing purposes. Usually I use proxyquireify for this purpose and that works well.
However when processing a .vue file containing template, style and the code itself the stubbing process does not seem to do anything.
Now, I am using several other plugins, babel, etc so I'm just wondering if anyone has gotten this to work.
I did find a tweet from Vue that mentioned this exact situation but the repo is now gone:
https://twitter.com/vuejs/status/680988998274269185
//in MyComponent.vue
<script>
import Dependency from 'some-dep';
console.log(Dependency); //shows original non-mocked version
export default {
data () {
return {
msg: 'Hello world!'
}
}
}
</script>
//in test file
const SomeDep= jasmine.createSpyObj('SomeDep', ['someMethod']);
testObj = proxyquire('MyComponent.vue', {
'some-dep': SomeDep
});
console.log(testObj) //shows component
Now in the test. the component itself seems to load just fine but with the actual dependencies. Maybe proxyquireify is not compatible with vueify? Would appreciate some guidance.
Metadata
Metadata
Assignees
Labels
No labels