Skip to content

Commit 3bbb2a9

Browse files
lusarzeddyerburgh
authored andcommitted
refactor: small optimization in checking for component with error during mount (#462)
1 parent df2f621 commit 3bbb2a9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/test-utils/src/mount.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ export default function mount (component: Component, options: Options = {}): Vue
2929
vm.$mount()
3030
}
3131

32-
const componentsWithError = findAllVueComponentsFromVm(vm).filter(c => c._error)
32+
const componentWithError = findAllVueComponentsFromVm(vm).find(c => c._error)
3333

34-
if (componentsWithError.length > 0) {
35-
throw (componentsWithError[0]._error)
34+
if (componentWithError) {
35+
throw (componentWithError._error)
3636
}
3737

3838
return new VueWrapper(vm, { attachedToDocument: !!options.attachToDocument })

0 commit comments

Comments
 (0)