Skip to content

fix(#119): allow vue-router creation through routes param from both jest and mocha #127

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

Merged
merged 2 commits into from
Mar 17, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add test to check vue-router require for mocha users
  • Loading branch information
agualis committed Mar 17, 2020
commit 47168efba57979c347b25c3baaf2dc304871297e
16 changes: 16 additions & 0 deletions src/__tests__/vue-router-mocha.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import '@testing-library/jest-dom'
import {render} from '@testing-library/vue'

import About from './components/Router/About.vue'

const routes = []
test('uses require("vue-router").default when require("vue-router") is undefined (useful for mocha users)', () => {
// Test for fix https://github.com/testing-library/vue-testing-library/issues/119
jest.mock('vue-router', () => {
return undefined
})

expect(() => render(About, {routes})).toThrowError(
new TypeError("Cannot read property 'default' of undefined"),
)
})