summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Tang <dennis@dennistang.net>2018-05-08 14:55:49 +0000
committerDennis Tang <dennis@dennistang.net>2018-05-08 14:55:49 +0000
commit7e0af6cfc9d9d0272f3b29f128a37863bd6e6324 (patch)
tree997c795d1d747256131b20cc98684dee204aab6c
parent6fd75502d6afed374bf34f193b44eac57bf5ba33 (diff)
downloadgitlab-ce-7e0af6cfc9d9d0272f3b29f128a37863bd6e6324.tar.gz
add rewire gotcha about testing vuex actions/getters
-rw-r--r--doc/development/fe_guide/vuex.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/development/fe_guide/vuex.md b/doc/development/fe_guide/vuex.md
index d6305bc4dec..29d5e446e20 100644
--- a/doc/development/fe_guide/vuex.md
+++ b/doc/development/fe_guide/vuex.md
@@ -352,6 +352,18 @@ describe('component', () => {
});
```
+#### Testing Vuex actions and getters
+Because we're currently using `babel-plugin-rewire`, you may encounter the following error when testing your Vuex actions and getters:
+`[vuex] actions should be function or object with "handler" function`
+
+To prevent this error from happening, you need to export an empty function:
+```
+// /stores/getters.js or /stores/actions.js
+
+// prevent babel-plugin-rewire from generating an invalid default during karma tests
+export default () => {};
+```
+
[vuex-docs]: https://vuex.vuejs.org
[vuex-structure]: https://vuex.vuejs.org/en/structure.html
[vuex-mutations]: https://vuex.vuejs.org/en/mutations.html