# Testing Library

Simple and complete DOM testing utilities that encourage good testing practices.

Channels
Chat
# All channels
# General
# General Help
# Angular Help
# Cypress Help
# DOM Help
# React Help
# Svelte Help
# TestCafe Help
# Vue Help
Team

### mocking directives

October 31, 2019 at 5:04pm

# mocking directives

October 31, 2019 at 5:04pm
My component is using directives and I get `Failed to resolve directive`. I added `directives: { tooltip: jest.fn() },` to the options of the render function, but I still get this error.

November 1, 2019 at 9:53am
Hi! First thing that comes to my mind is that you could use the third parameter of `render` method, which returns the local Vue instance, to register your directive:
`import myDirective from 'somewhere'const { getByText } = render(Component, {}, vue => {  vue.directive('setText',  myDirective)})`
If that works, would you like to provide an example test in Vue Testing Library repository? We don't have an example of testing a component with directives, and I feel it would be a great addition.
Hope it helps!

November 3, 2019 at 4:52pm
Thanks a lot, I'll make that PR tomorrow

November 4, 2019 at 6:57am
done! :D