diff --git a/tests/__tests__/stopwatch.js b/tests/__tests__/stopwatch.js index 5b3d8786..363f860d 100644 --- a/tests/__tests__/stopwatch.js +++ b/tests/__tests__/stopwatch.js @@ -1,7 +1,9 @@ import StopWatch from './components/StopWatch.vue' -import { render, wait, fireEvent } from '@testing-library/vue' +import { cleanup, render, wait, fireEvent } from '@testing-library/vue' import 'jest-dom/extend-expect' +afterEach(cleanup) + test('unmounts a component', async () => { jest.spyOn(console, 'error').mockImplementation(() => {}) diff --git a/tests/__tests__/vue-router.js b/tests/__tests__/vue-router.js index 8d64bd44..76fd0dee 100644 --- a/tests/__tests__/vue-router.js +++ b/tests/__tests__/vue-router.js @@ -4,7 +4,7 @@ import App from './components/Router/App.vue' import Home from './components/Router/Home.vue' import About from './components/Router/About.vue' -import { render, fireEvent } from '@testing-library/vue' +import { cleanup, render, fireEvent } from '@testing-library/vue' const routes = [ { path: '/', component: Home }, @@ -12,6 +12,8 @@ const routes = [ { path: '*', redirect: '/about' } ] +afterEach(cleanup) + test('full app rendering/navigating', async () => { const { queryByTestId } = render(App, { routes }) diff --git a/tests/__tests__/vuex.js b/tests/__tests__/vuex.js index 14011aee..5b799bd2 100644 --- a/tests/__tests__/vuex.js +++ b/tests/__tests__/vuex.js @@ -1,7 +1,9 @@ import 'jest-dom/extend-expect' import VuexTest from './components/VuexTest' -import { render, fireEvent } from '@testing-library/vue' +import { cleanup, render, fireEvent } from '@testing-library/vue' + +afterEach(cleanup) const store = { state: {