<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> ## Current Behavior <!-- This is the behavior we have today --> When generating a vue application with routing and testing, the test setup is incorrect and fails ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> The test setup for vue applications with routing should work OOTB ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #19921
This commit is contained in:
parent
e9bf1a2acb
commit
381e5cd494
@ -121,8 +121,9 @@ import { mount } from '@vue/test-utils';
|
|||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
|
|
||||||
describe('App', () => {
|
describe('App', () => {
|
||||||
it('renders properly', () => {
|
it('renders properly', async () => {
|
||||||
const wrapper = mount(App, {});
|
const wrapper = mount(App, {});
|
||||||
|
|
||||||
expect(wrapper.text()).toContain('Welcome test 👋');
|
expect(wrapper.text()).toContain('Welcome test 👋');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,12 +1,17 @@
|
|||||||
<% if ( unitTestRunner === 'vitest' ) { %>
|
<% if ( unitTestRunner === 'vitest' ) { %>
|
||||||
import { describe, it, expect } from 'vitest'
|
import { describe, it, expect } from 'vitest'
|
||||||
|
<% } %><% if( routing ) { %>
|
||||||
|
import router from '../router';
|
||||||
<% } %>
|
<% } %>
|
||||||
import { mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
|
|
||||||
describe('App', () => {
|
describe('App', () => {
|
||||||
it('renders properly', () => {
|
it('renders properly', async () => {
|
||||||
const wrapper = mount(App, {})
|
const wrapper = mount(App, <% if( routing ) { %>{ global: { plugins: [router] }}<% } else { %>{}<% } %>)
|
||||||
|
<% if( routing ) { %>
|
||||||
|
await router.isReady();
|
||||||
|
<% } %>
|
||||||
expect(wrapper.text()).toContain('Welcome <%= title %> 👋')
|
expect(wrapper.text()).toContain('Welcome <%= title %> 👋')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@ -4,6 +4,6 @@ import NxWelcome from '../app/NxWelcome.vue'
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main>
|
<main>
|
||||||
<NxWelcome />
|
<NxWelcome title="<%= title %>" />
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user