Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test runner getting stuck in RUN v2.1.8 #1044

Open
arajkovic22 opened this issue Dec 19, 2024 · 0 comments
Open

Test runner getting stuck in RUN v2.1.8 #1044

arajkovic22 opened this issue Dec 19, 2024 · 0 comments

Comments

@arajkovic22
Copy link

arajkovic22 commented Dec 19, 2024

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant