From d628f36b6122e629553d388a9c4953fc5cb2e1ab Mon Sep 17 00:00:00 2001 From: Alberto Gualis Date: Wed, 18 Mar 2020 12:06:30 +0100 Subject: [PATCH] fix(mocha): fix vue-router creation using mocha (#128) * fix(#119): allow routes vue-router creation through routes param from both jest and mocha * add test to check vue-router require for mocha users * fix Vue Router require to be compatible with CommonJS * delete deprecated test --- src/vue-testing-library.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vue-testing-library.js b/src/vue-testing-library.js index 3aa4041d..52993f78 100644 --- a/src/vue-testing-library.js +++ b/src/vue-testing-library.js @@ -36,7 +36,8 @@ function render( } if (routes) { - const VueRouter = require('vue-router') || require('vue-router').default + const requiredRouter = require('vue-router') + const VueRouter = requiredRouter.default || requiredRouter localVue.use(VueRouter) router = new VueRouter({ routes,