diff --git a/package.json b/package.json index 4ea83b9f68..3dffac7591 100644 --- a/package.json +++ b/package.json @@ -34,14 +34,14 @@ "@babel/core": "^7.7.4", "@babel/preset-env": "^7.7.4", "@nuxtjs/eslint-config": "^2.0.0", - "@vue/server-test-utils": "^1.0.0-beta.29", - "@vue/test-utils": "^1.0.0-beta.29", + "@vue/server-test-utils": "^1.0.0-beta.30", + "@vue/test-utils": "^1.0.0-beta.30", "babel-eslint": "^10.0.3", "babel-jest": "^24.9.0", "codecov": "^3.6.1", "consola": "^2.11.0", "cross-spawn": "^7.0.1", - "eslint": "6.7.1", + "eslint": "6.7.2", "eslint-multiplexer": "^2.0.0", "esm": "^3.2.25", "execa": "^3.4.0", @@ -63,15 +63,15 @@ "puppeteer-core": "^2.0.0", "request": "^2.88.0", "rimraf": "^3.0.0", - "rollup": "^1.27.5", + "rollup": "^1.27.8", "rollup-plugin-alias": "^2.2.0", "rollup-plugin-commonjs": "^10.1.0", "rollup-plugin-json": "^4.0.0", - "rollup-plugin-license": "^0.12.1", + "rollup-plugin-license": "^0.13.0", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-replace": "^2.2.0", "sass-loader": "^8.0.0", - "sort-package-json": "^1.24.0", + "sort-package-json": "^1.30.0", "vue-jest": "^4.0.0-beta.2" } } diff --git a/packages/vue-app/test/nuxt-loading.test.js b/packages/vue-app/test/nuxt-loading.test.js index 27ea8e1b4e..db6d8f6f53 100644 --- a/packages/vue-app/test/nuxt-loading.test.js +++ b/packages/vue-app/test/nuxt-loading.test.js @@ -20,21 +20,22 @@ describe('nuxt-loading', () => { afterEach(() => jest.clearAllTimers()) - test('removed when not loading', () => { - const str = renderToString(Component) + test('removed when not loading', async () => { + const str = await renderToString(Component) expect(str).toBe('') }) - test('added when loading', () => { - const wrapper = mount(Component, { localVue }) - + test('added when loading', async () => { + const wrapper = mount(Component) wrapper.setData({ throttle: 0 }) wrapper.vm.start() + await vmTick(wrapper.vm) + expect(wrapper.html()).toBe('
') }) - test('percentage changed after 1s', () => { + test('percentage changed after 1s', async () => { const wrapper = mount(Component, { localVue }) wrapper.setData({ duration: 1000, @@ -44,6 +45,7 @@ describe('nuxt-loading', () => { wrapper.vm.start() jest.advanceTimersByTime(250) + await vmTick(wrapper.vm) const html = wrapper.html() expect(html).not.toBe('') @@ -61,6 +63,8 @@ describe('nuxt-loading', () => { wrapper.vm.start() wrapper.vm.finish() + await vmTick(wrapper.vm) + let html = wrapper.html() expect(html).toBe('') expect(wrapper.vm.get()).toBe(100) @@ -69,21 +73,23 @@ describe('nuxt-loading', () => { await vmTick(wrapper.vm) html = wrapper.html() - expect(html).toBeUndefined() + expect(html).toBe('') expect(wrapper.vm.get()).toBe(0) }) - test('can fail', () => { + test('can fail', async () => { const wrapper = mount(Component, { localVue }) wrapper.vm.set(50) wrapper.vm.fail() + await vmTick(wrapper.vm) + const html = wrapper.html() expect(html).toBe('') }) - test('not shown until throttle', () => { + test('not shown until throttle', async () => { const wrapper = mount(Component, { localVue }) wrapper.setData({ @@ -92,19 +98,26 @@ describe('nuxt-loading', () => { }) wrapper.vm.start() + + await vmTick(wrapper.vm) + jest.advanceTimersByTime(250) + await vmTick(wrapper.vm) + let html = wrapper.html() - expect(html).toBeUndefined() + expect(html).toBe('') jest.advanceTimersByTime(1000) + await vmTick(wrapper.vm) + html = wrapper.html() expect(html).not.toBe('') expect(html).toContain('