Skip to content

fix: Include tests without .nuxt. extension #1311

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

Merged
merged 9 commits into from
Jun 20, 2025

Conversation

lutejka
Copy link
Contributor

@lutejka lutejka commented Jun 2, 2025

Include tests without .nuxt. extension, by creating a workspace for the default environment

🔗 Linked issue

Resolves #1296

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Moving environmentMatchGlobs to define a workspace for the nuxt environment resulted in Vitest only running tests within that specific nuxt workspace, excluding tests from the parent/default configuration (from which the workspace inherits). Creating an additional workspace for the default, non-Nuxt environment ensured all tests were included again.

Siteproxy
@lutejka lutejka requested a review from danielroe as a code owner June 2, 2025 09:25
Copy link

pkg-pr-new bot commented Jun 2, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/test-utils@1311

commit: 82cf3a8

@lutejka lutejka force-pushed the include-test-without-nuxt-ext branch from 3eedc39 to 41f0759 Compare June 2, 2025 11:36
Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks great! might it be possible to add a simple fixture to the examples/ directory so we avoid this regression happening again?

@lutejka lutejka force-pushed the include-test-without-nuxt-ext branch from a9addc8 to 0ef0a76 Compare June 12, 2025 08:09
@lutejka lutejka force-pushed the include-test-without-nuxt-ext branch from 01bf9e8 to 4713700 Compare June 16, 2025 17:36
@lutejka
Copy link
Contributor Author

lutejka commented Jun 16, 2025

this looks great! might it be possible to add a simple fixture to the examples/ directory so we avoid this regression happening again?

Good idea! Adding the test showed, that the fix will not apply when the tests run as part of the test server. (pnpm test:dev) The reason for this is probably the same why we need to add environmentMatchGlobs...

Unfortunately, I could not get it running, even when adding the workspaces for this case. Any idea why?

@danielroe
Copy link
Member

I think we could merge this fix as-is (as it is a very significant issue) and add a todo to fix tests run from the dev server in future. Anthony & I already discussed potentially disabling that feature in future.

@lutejka lutejka force-pushed the include-test-without-nuxt-ext branch from 4713700 to 1acfa43 Compare June 18, 2025 17:47
lutejka and others added 4 commits June 18, 2025 19:48

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was signed with the committer’s verified signature.
danielroe Daniel Roe

Verified

This commit was signed with the committer’s verified signature.
danielroe Daniel Roe
@danielroe
Copy link
Member

thank you ❤️

@danielroe danielroe merged commit 9f3ec04 into nuxt:main Jun 20, 2025
6 checks passed
@github-actions github-actions bot mentioned this pull request Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update from 3.18 to 3.19 changed default configuration, causing tests without .nuxt. to not be included
2 participants