Skip to content

Vue router configuration not working with mocha-chai #119

Closed
@FCalabria

Description

@FCalabria

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions