Total Complexity | 6 |
Complexity/F | 1.5 |
Lines of Code | 38 |
Function Count | 4 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | import BaseVue from 'vue' |
||
2 | import VueSyncersFeathers from '../../../src' |
||
3 | |||
4 | // If a vue error happens log extra info on the error |
||
5 | BaseVue.config.errorHandler = function (err, vm) { |
||
6 | const t = Object.getPrototypeOf(vm).constructor.test |
||
7 | console.log('Test: ', t._test.title) |
||
8 | console.error(err) |
||
9 | } |
||
10 | |||
11 | export function addVueWithPlugin(t, options) { |
||
12 | const Vue = t.context.Vue = BaseVue.extend() |
||
13 | |||
14 | // Because we're installing onto extended vue instance copy global methods to new instance |
||
15 | Vue.version = BaseVue.version |
||
16 | Vue.util = BaseVue.util |
||
17 | Vue.set = BaseVue.set |
||
18 | Vue.delete = BaseVue.delete |
||
19 | Vue.nextTick = BaseVue.nextTick |
||
20 | Vue.config = BaseVue.config // Not cloned |
||
21 | Vue.test = t |
||
22 | // To reference the right Vue instance |
||
23 | Vue.mixin = function (mixin) { |
||
24 | Vue.options = Vue.util.mergeOptions(Vue.options, mixin) |
||
25 | } |
||
26 | |||
27 | BaseVue.use.call(Vue, {install: VueSyncersFeathers.install}, options) |
||
28 | } |
||
29 | |||
30 | export function vueCleanup(t) { |
||
31 | if (t.context.instance) { |
||
32 | t.context.instance.$destroy() |
||
33 | delete t.context.instance |
||
34 | } |
||
35 | if (t.context.Vue) { |
||
36 | delete t.context.Vue |
||
37 | } |
||
38 | } |
||
39 |