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

Add option to disable for tests #254

Open
gabaum10 opened this issue Mar 21, 2022 · 0 comments
Open

Add option to disable for tests #254

gabaum10 opened this issue Mar 21, 2022 · 0 comments

Comments

@gabaum10
Copy link

I have a setup where I'm using Jest and vue-test-utils to mount and test my components. Some of the inner components use the v-observe-visibility directive. However, it breaks/slows down considerably the tests. It looks like it really doesn't like being run in testing virtual DOM. I got around this by adding:

Vue.prototype.isTest = process.env.JEST_WORKER_ID !== undefined

in my startup config. And then a

v-observe-visibility="isTest ? false : onRulesVisible" i

nside my components. However, this feels very clunky. It'd be nice if there were a hook we could access to disable the directive when running tests. I'll admit, I haven't taken a look at the inner workings of the directive. I can't be the only one who has run into this problem.

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

1 participant