Akryum / Akryum/vue-observe-visibility

Add option to disable for tests

Ouverte
#254 0 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
1.6k
Forks
85
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.