From ddd2a57a024378fa2574395f8a996670652a4c1d Mon Sep 17 00:00:00 2001 From: Sebastian Ulbel Date: Thu, 2 Jan 2020 18:46:51 +0100 Subject: [PATCH 1/2] fix: wait for the next tick according to https://vue-test-utils.vuejs.org/guides/#using-nexttick we have to wait for the next tick for this test to pass --- .../testing-single-file-components-with-mocha-webpack.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/guides/testing-single-file-components-with-mocha-webpack.md b/docs/guides/testing-single-file-components-with-mocha-webpack.md index ad2777972..9f29ebeda 100644 --- a/docs/guides/testing-single-file-components-with-mocha-webpack.md +++ b/docs/guides/testing-single-file-components-with-mocha-webpack.md @@ -148,13 +148,15 @@ Create a file in `src` named `Counter.vue`: And create a test file named `test/Counter.spec.js` with the following code: ```js +import Vue from 'vue'; import { shallowMount } from '@vue/test-utils' import Counter from '../src/Counter.vue' describe('Counter.vue', () => { - it('increments count when button is clicked', () => { + it('increments count when button is clicked', async () => { const wrapper = shallowMount(Counter) wrapper.find('button').trigger('click') + await Vue.nextTick() expect(wrapper.find('div').text()).toMatch('1') }) }) From edac70b8a1fa13a3b339fb3b2b541f6f2b3cdfcf Mon Sep 17 00:00:00 2001 From: SUITS Date: Fri, 3 Jan 2020 11:57:28 +0100 Subject: [PATCH 2/2] refactor: run prettier --- .../guides/testing-single-file-components-with-mocha-webpack.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/testing-single-file-components-with-mocha-webpack.md b/docs/guides/testing-single-file-components-with-mocha-webpack.md index 9f29ebeda..cee57d924 100644 --- a/docs/guides/testing-single-file-components-with-mocha-webpack.md +++ b/docs/guides/testing-single-file-components-with-mocha-webpack.md @@ -148,7 +148,7 @@ Create a file in `src` named `Counter.vue`: And create a test file named `test/Counter.spec.js` with the following code: ```js -import Vue from 'vue'; +import Vue from 'vue' import { shallowMount } from '@vue/test-utils' import Counter from '../src/Counter.vue'