You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've added '@nuxt/test-utils/module', in nuxt.config.ts file
Added a scripts entry: "test": "vitest --config ./vitest.config.js run", in package.json file
Also added a vitest.config.ts file with following content:
`import { defineVitestConfig } from '@nuxt/test-utils/config';
export default defineVitestConfig({
test: {
environment: 'nuxt',
environmentOptions: {
nuxt: {
mock: {
intersectionObserver: true,
indexedDb: true,
},
},
},
},
}); And also wrote a following test case:import { expect, describe, test } from 'vitest';
import SideNav from '~/components/SideNav.vue';
import { mountSuspended } from '@nuxt/test-utils/runtime';
describe('SideNav', () => {
test('mounts', async () => {
const component = await mountSuspended(SideNav);
expect(component.text()).toContain('Home');
});
});
`
Located on path: /home/arajkovic/workspace/work/portal/tests/components/SideNav.spec.ts (also tried pulling it out of components directory)
Tested component is located at : /home/arajkovic/workspace/work/portal/components/SideNav.SideNav.vue
Describe the bug
`arajkovic@RTRKA019-lin:~/workspace/work/portal$ pnpm test
nuxt-app@ test /home/arajkovic/workspace/work/portal
vitest --config ./vitest.config.js run
RUN v2.1.8 /home/arajkovic/workspace/work/portal
`
Execution is getting stuck here, no test is ever run.
Additional context
I've also tried adding plugins: [vue()] and changing test environment to happy-dom but in that case I get random errors which do not make sense (some page does not contain template or script tags even tho they do), example:
FAIL tests/components/SideNav.nuxt.spec.ts [ tests/components/SideNav.nuxt.spec.ts ]
SyntaxError: At least one or <script> is required in a single file component. /home/arajkovic/workspace/work/portal/pages/engineering.vue
Am I missing something or I've encountered some kind of a bug? I am stuck on this, seemingly basic, problem for 2 days now... Thanks in advance
Logs
The text was updated successfully, but these errors were encountered:
Environment
Working directory: /home/arajkovic/workspace/work/portal 1:45:56 PM
Nuxt project info: 1:45:56 PM
Reproduction
I've added '@nuxt/test-utils/module', in nuxt.config.ts file
Added a scripts entry: "test": "vitest --config ./vitest.config.js run", in package.json file
Also added a vitest.config.ts file with following content:
`import { defineVitestConfig } from '@nuxt/test-utils/config';
export default defineVitestConfig({
test: {
environment: 'nuxt',
environmentOptions: {
nuxt: {
mock: {
intersectionObserver: true,
indexedDb: true,
},
},
},
},
});
And also wrote a following test case:
import { expect, describe, test } from 'vitest';import SideNav from '~/components/SideNav.vue';
import { mountSuspended } from '@nuxt/test-utils/runtime';
describe('SideNav', () => {
test('mounts', async () => {
const component = await mountSuspended(SideNav);
expect(component.text()).toContain('Home');
});
});
`
Located on path: /home/arajkovic/workspace/work/portal/tests/components/SideNav.spec.ts (also tried pulling it out of components directory)
Tested component is located at : /home/arajkovic/workspace/work/portal/components/SideNav.SideNav.vue
Describe the bug
`arajkovic@RTRKA019-lin:~/workspace/work/portal$ pnpm test
RUN v2.1.8 /home/arajkovic/workspace/work/portal
`
Execution is getting stuck here, no test is ever run.
Additional context
I've also tried adding plugins: [vue()] and changing test environment to happy-dom but in that case I get random errors which do not make sense (some page does not contain template or script tags even tho they do), example:
FAIL tests/components/SideNav.nuxt.spec.ts [ tests/components/SideNav.nuxt.spec.ts ]
SyntaxError: At least one or <script> is required in a single file component. /home/arajkovic/workspace/work/portal/pages/engineering.vue
Am I missing something or I've encountered some kind of a bug? I am stuck on this, seemingly basic, problem for 2 days now... Thanks in advance
Logs
The text was updated successfully, but these errors were encountered: