Skip to content

test: change example/workspace to use glob based projects setup#1585

Open
yamachi4416 wants to merge 10 commits intonuxt:mainfrom
yamachi4416:support-parallel-test-project-setup
Open

test: change example/workspace to use glob based projects setup#1585
yamachi4416 wants to merge 10 commits intonuxt:mainfrom
yamachi4416:support-parallel-test-project-setup

Conversation

@yamachi4416
Copy link
Copy Markdown
Collaborator

@yamachi4416 yamachi4416 commented Feb 15, 2026

🔗 Linked issue

the reproduction tests are confirmed to pass following the nuxt update. (nuxt/kit: v4.4.2 and v3.21.2)

resolves #1583

❓ 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

  • avoided concurrent nuxt starts to prevent configuration retrieval failures
  • repurposed examples/app-vitest-workspace for workspace tests, as the advised setup is covered in examples/app-vitest

Reproduction

issue 1583
run pnpm update nuxt@4.4.2 -r and pnpm update @nuxt/kit -r then pnpm test

image

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Feb 15, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nuxt/test-utils/@nuxt/test-utils@1585
npm i https://pkg.pr.new/nuxt/test-utils/vitest-environment-nuxt@1585

commit: 7541a0c

@yamachi4416 yamachi4416 force-pushed the support-parallel-test-project-setup branch from cfd69bf to b4e637b Compare February 15, 2026 14:12
@yamachi4416 yamachi4416 marked this pull request as ready for review February 15, 2026 14:20
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7740fce1-8c6d-4ee8-a745-634a0d3232d2

📥 Commits

Reviewing files that changed from the base of the PR and between d8d2f03 and 7541a0c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • examples/app-vitest-workspace/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • examples/app-vitest-workspace/package.json

📝 Walkthrough

Walkthrough

Adds a Vitest workspace example with two Nuxt apps (app1, app2). Each app gains Nuxt/Vitest config files, app-local tsconfig project references, and multiple test suites (nuxt/unit patterns). The root workspace vitest config was replaced with a glob-based projects loader and the workspace tsconfig.json was removed. Several new test files were added under each app and one root test file was deleted. package.json scripts were changed to run pnpm dev:prepare on postinstall and a devDependency @nuxt/ui was added.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the primary change: converting the example workspace to use glob-based project setup for Vitest.
Description check ✅ Passed The description explains the changes, references issue #1583, and provides reproduction steps showing the fix works with updated Nuxt versions.
Linked Issues check ✅ Passed The PR addresses issue #1583 by refactoring the example workspace to use glob-based projects setup, which resolves intermittent import failures through improved project configuration isolation.
Out of Scope Changes check ✅ Passed All changes are scoped to the example workspace directory and directly address the workspace test configuration requirements from issue #1583.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@yamachi4416 yamachi4416 force-pushed the support-parallel-test-project-setup branch from b4e637b to f002d54 Compare February 22, 2026 02:13
src/config.ts Outdated
Comment on lines +29 to +44
const startNuxtAndGetViteConfig: typeof _startNuxtAndGetViteConfig = (() => {
let _lock = Promise.resolve()

return async (...args) => {
const acquire = _lock
let release = () => {}
_lock = new Promise(resolve => release = resolve)
try {
await acquire
return await _startNuxtAndGetViteConfig(...args)
}
finally {
release()
}
}
})()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ideally Nuxt's default asyncContext should mean this isn't necessary:

nuxt/nuxt#30510

I wonder what's going wrong, that this isn't working?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

thank you for the review
agreed, investigation will follow to find why

Copy link
Copy Markdown
Collaborator Author

@yamachi4416 yamachi4416 Feb 28, 2026

Choose a reason for hiding this comment

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

loadNuxt and buildNuxt run successfully in parallel.
however, when modules use different versions of @nuxt/kit, asyncContext appears to be undefined in those using the secondary version, causing a fallback to nuxtCtx and resulting in a reference to an incorrect Nuxt instance.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've attempted to fix the cause of the issue
I would appreciate your review
nuxt/nuxt#34492

@yamachi4416 yamachi4416 marked this pull request as draft February 23, 2026 12:39
@yamachi4416 yamachi4416 force-pushed the support-parallel-test-project-setup branch from f002d54 to bcb0ee7 Compare March 24, 2026 11:54
@yamachi4416 yamachi4416 changed the title feat(config): support parallel test projects setup test: change example/workspace to use glob based projects setup Mar 24, 2026
@yamachi4416 yamachi4416 marked this pull request as ready for review March 24, 2026 12:07
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.

Intermittent "#imports" package specifier error in Nuxt environment tests (monorepo/layer setup)

2 participants