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

Closed
arajkovic22 opened this issue Dec 19, 2024 · 2 comments
Closed

Test runner getting stuck in RUN v2.1.8 #1044

arajkovic22 opened this issue Dec 19, 2024 · 2 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

Copy link
Contributor

Would you be able to provide a reproduction? 🙏

More info

Why do I need to provide a reproduction?

Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.

What will happen?

If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritise it based on its severity and how many people we think it might affect.

If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.

How can I create a reproduction?

We have a couple of templates for starting with a minimal reproduction:

👉 https://stackblitz.com/github/nuxt/test-utils/tree/main/examples/app-vitest
👉 https://stackblitz.com/github/nuxt/test-utils/tree/main/examples/app-jest
👉 https://stackblitz.com/github/nuxt/test-utils/tree/main/examples/module

A public GitHub repository is also perfect. 👌

Please ensure that the reproduction is as minimal as possible. See more details in our guide.

You might also find these other articles interesting and/or helpful:

Copy link
Contributor

github-actions bot commented Jan 2, 2025

This issue was closed because it was open for 7 days without a reproduction.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 2, 2025
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

2 participants