championswimmer / vuex-module-decorators

TypeScript/ES7 Decorators to create Vuex modules declaratively
https://championswimmer.in/vuex-module-decorators/
MIT License
1.8k stars 170 forks source link

✨ Allow getters to be reconfigured #420

Open alecgibson opened 1 year ago

alecgibson commented 1 year ago

Fixes https://github.com/championswimmer/vuex-module-decorators/issues/207

At the moment, getters cannot be stubbed in tests, because they're defined as unconfigurable.

This change adds a configurableGetters option to the Module options, which is false by default (keeps existing behaviour).

If this flag is set to true, we allow getters to be reconfigured, which lets us stub them.

alecgibson commented 1 year ago

NB: I've raised this against the vue2-vuex3 branch because that's the setup we're currently using. I think in theory this should work fine for v2. If this is a feature that will get merged, I'll also open a PR against master.