diff --git a/tests/unit/about.spec.js b/tests/unit/about.spec.js index dad7e009..8177ac5d 100644 --- a/tests/unit/about.spec.js +++ b/tests/unit/about.spec.js @@ -1,5 +1,6 @@ import { shallowMount } from '@vue/test-utils' import About from '@/components/Pages/About.vue' +require('./boilerplate.js') describe('About.vue', () => { it('renders some text', () => { diff --git a/tests/unit/boilerplate.js b/tests/unit/boilerplate.js new file mode 100644 index 00000000..8af23246 --- /dev/null +++ b/tests/unit/boilerplate.js @@ -0,0 +1,18 @@ +// Necessary boilerplate to prevent errors and warnings with newer versions of jest + +// See: https://stackoverflow.com/a/60731669 +import Vuetify from 'vuetify' +import Vue from 'vue' +Vue.use(Vuetify) + +// See: https://stackoverflow.com/a/59904516 + +// jest and afterEach defined as globals to keep eslint happy +/* global jest, afterEach */ +const assignMock = jest.fn() +delete window.location +window.location = { assign: assignMock } + +afterEach(() => { + assignMock.mockClear() +})