From d3da7270e992b4fa8528f45b0e7fcf74bfa754bf Mon Sep 17 00:00:00 2001 From: lukasz Date: Fri, 9 Mar 2018 14:42:51 +0100 Subject: [PATCH] refactor: small optimization in checking for component with error during mount --- packages/test-utils/src/mount.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/test-utils/src/mount.js b/packages/test-utils/src/mount.js index fcc51c7c0..3853c8e6f 100644 --- a/packages/test-utils/src/mount.js +++ b/packages/test-utils/src/mount.js @@ -29,10 +29,10 @@ export default function mount (component: Component, options: Options = {}): Vue vm.$mount() } - const componentsWithError = findAllVueComponentsFromVm(vm).filter(c => c._error) + const componentWithError = findAllVueComponentsFromVm(vm).find(c => c._error) - if (componentsWithError.length > 0) { - throw (componentsWithError[0]._error) + if (componentWithError) { + throw (componentWithError._error) } return new VueWrapper(vm, { attachedToDocument: !!options.attachToDocument })