Add workaround for Vue test utils setProps
see https://github.com/vuejs/vue-test-utils/issues/631#issuecomment-421108344
This commit is contained in:
parent
965dbbd24c
commit
a71d02bb16
1 changed files with 10 additions and 0 deletions
|
@ -21,6 +21,16 @@ Vue.config.productionTip = false;
|
||||||
|
|
||||||
let hasVueWarnings = false;
|
let hasVueWarnings = false;
|
||||||
Vue.config.warnHandler = (msg, vm, trace) => {
|
Vue.config.warnHandler = (msg, vm, trace) => {
|
||||||
|
// The following workaround is necessary, so we are able to use setProps from Vue test utils
|
||||||
|
// see https://github.com/vuejs/vue-test-utils/issues/631#issuecomment-421108344
|
||||||
|
const currentStack = new Error('').stack;
|
||||||
|
const isInVueTestUtils = currentStack
|
||||||
|
.split('\n')
|
||||||
|
.some(line => line.startsWith(' at VueWrapper.setProps ('));
|
||||||
|
if (isInVueTestUtils) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
hasVueWarnings = true;
|
hasVueWarnings = true;
|
||||||
fail(`${msg}${trace}`);
|
fail(`${msg}${trace}`);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue