Skip to content

Vue router configuration not working with mocha-chai #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
FCalabria opened this issue Jan 14, 2020 · 2 comments · Fixed by #127
Closed

Vue router configuration not working with mocha-chai #119

FCalabria opened this issue Jan 14, 2020 · 2 comments · Fixed by #127
Labels
bug Something isn't working released

Comments

@FCalabria
Copy link

FCalabria commented Jan 14, 2020

Describe the bug

When trying to use the router option in a mocha + chai project, it fails with TypeError: VueRouter is not a constructor

To Reproduce

Run unit tests:

https://github.com/FCalabria/testing-library-mocha

The same project with jest, works perfectly.

Related information:

  • @testing-library/vue version: 4.1.0
  • Vue version: 2.6.10

Changing the way to import the library fixes the bug, but breaks it for jest

const VueRouter = require('vue-router') // current code, works with jest
const VueRouter = require('vue-router').default // fix for mocha, breaks jest
@FCalabria FCalabria added the bug Something isn't working label Jan 14, 2020
afontcu pushed a commit that referenced this issue Mar 17, 2020
* 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
@afontcu
Copy link
Member

afontcu commented Mar 17, 2020

🎉 This issue has been resolved in version 5.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

afontcu pushed a commit that referenced this issue Mar 18, 2020
* 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
@afontcu
Copy link
Member

afontcu commented Mar 18, 2020

🎉 This issue has been resolved in version 5.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants