diff --git a/packages/vue/src/generators/application/__snapshots__/application.spec.ts.snap b/packages/vue/src/generators/application/__snapshots__/application.spec.ts.snap index 78d7d6ae315ac..789f80bc7f3a7 100644 --- a/packages/vue/src/generators/application/__snapshots__/application.spec.ts.snap +++ b/packages/vue/src/generators/application/__snapshots__/application.spec.ts.snap @@ -121,8 +121,9 @@ import { mount } from '@vue/test-utils'; import App from './App.vue'; describe('App', () => { - it('renders properly', () => { + it('renders properly', async () => { const wrapper = mount(App, {}); + expect(wrapper.text()).toContain('Welcome test 👋'); }); }); diff --git a/packages/vue/src/generators/application/files/common/src/app/App.spec.ts.template b/packages/vue/src/generators/application/files/common/src/app/App.spec.ts.template index e146c1f6ef254..e8b016b534175 100644 --- a/packages/vue/src/generators/application/files/common/src/app/App.spec.ts.template +++ b/packages/vue/src/generators/application/files/common/src/app/App.spec.ts.template @@ -1,12 +1,17 @@ <% if ( unitTestRunner === 'vitest' ) { %> import { describe, it, expect } from 'vitest' +<% } %><% if( routing ) { %> +import router from '../router'; <% } %> import { mount } from '@vue/test-utils' import App from './App.vue'; describe('App', () => { - it('renders properly', () => { - const wrapper = mount(App, {}) + it('renders properly', async () => { + const wrapper = mount(App, <% if( routing ) { %>{ global: { plugins: [router] }}<% } else { %>{}<% } %>) + <% if( routing ) { %> + await router.isReady(); + <% } %> expect(wrapper.text()).toContain('Welcome <%= title %> 👋') }) }); diff --git a/packages/vue/src/generators/application/files/routing/src/views/HomeView.vue.template b/packages/vue/src/generators/application/files/routing/src/views/HomeView.vue.template index 07cab06db9077..9f9f06545e1ea 100644 --- a/packages/vue/src/generators/application/files/routing/src/views/HomeView.vue.template +++ b/packages/vue/src/generators/application/files/routing/src/views/HomeView.vue.template @@ -4,6 +4,6 @@ import NxWelcome from '../app/NxWelcome.vue'