1.0.0-beta.14
https://jsfiddle.net/50wL7mdz/323724/
Create a Vue project
Add a filter (like mine or a different one)
Test project with Jest and vue-test-utils
Test should run without any errors
Test are running, but throwing errors:
"[Vue warn]: Failed to resolve filter: si"
I have also tried importing Vue to the test spec file and setting up the filter there, but that didn't seem to help.
I can't reproduce this.
For me, registering a filter before mounting works as expected:
Vue.filter('aFilter', () => 'foo')
test('updates computed properties', () => {
const wrapper = shallow(App)
expect(wrapper.text()).toContain('foo')
})
OK, following this example and testing on a brand new build cleared things up. I must have made a mistake on my side. Thank you very much and sorry for the false report.
If you're using Nuxt or are using modular filter imports you can do this.
import "~/plugins/filters";
Most helpful comment
I can't reproduce this.
For me, registering a filter before mounting works as expected: