
nuxt-test-utils-skilld
ALWAYS use when writing code importing "@nuxt/test-utils". Consult for debugging, best practices, or modifying @nuxt/test-utils, nuxt/test-utils, nuxt test-utils, nuxt test utils, test-utils, test utils.
- Installs
- 39
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/nuxt/scripts --skill nuxt-test-utils-skilld- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads nuxt-test-utils-skilld automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
nuxt/test-utils @nuxt/test-utils
Version: 4.0.0 Deps: @clack/prompts@1.0.0, @nuxt/devtools-kit@^2.7.0, @nuxt/kit@^3.21.0, c12@^3.3.3, consola@^3.4.2, defu@^6.1.4, destr@^2.0.5, estree-walker@^3.0.3, exsolve@^1.0.8, fake-indexeddb@^6.2.5, get-port-please@^3.2.0, h3@^1.15.5, h3-next@npm:h3@2.0.1-rc.11, local-pkg@^1.1.2, magic-string@^0.30.21, node-fetch-native@^1.6.7, node-mock-http@^1.0.4, nypm@^0.6.4, ofetch@^1.5.1, pathe@^2.0.3, perfect-debounce@^2.1.0, radix3@^1.1.2, scule@^1.3.0, std-env@^3.10.0, tinyexec@^1.0.2, ufo@^1.6.3, unplugin@^3.0.0, vitest-environment-nuxt@^1.0.1, vue@^3.5.27 Tags: alpha: 3.9.0-alpha.3, latest: 4.0.0
References: package.json — exports, entry points • README — setup, basic usage • Docs — API reference, guides • GitHub Issues — bugs, workarounds, edge cases • GitHub Discussions — Q&A, patterns, recipes • Releases — changelog, breaking changes, new APIs
Search
Use skilld search instead of grepping .skilld/ directories — hybrid semantic + keyword search across all indexed docs, issues, and releases. If skilld is unavailable, use npx -y skilld search.
skilld search "query" -p @nuxt/test-utils
skilld search "issues:error handling" -p @nuxt/test-utils
skilld search "releases:deprecated" -p @nuxt/test-utils
Filters: docs:, issues:, releases: prefix narrows by source type.
API Changes
This section documents version-specific API changes — prioritize recent major/minor releases.
-
BREAKING: Composables at top-level of
describeblock — v4 moved Nuxt initialization fromsetupFilestobeforeAllhook, causinguseRouter(),useRoute(),useNuxtApp()and other composables to fail with[nuxt] instance unavailablewhen called outside ofbeforeAll/beforeEach/test block. Wrap at-describe-level usage inbeforeAll()source -
BREAKING:
vi.mockstricter exports — v4 (via vitest v4) throws error when accessing exports not returned by factory function, instead of silently returningundefined. UseimportOriginalhelper to preserve all exports source -
BREAKING: vitest peer dependency — v4 requires
vitest ^4.0.2(from^3.2.0). Tightened dependency ranges forhappy-dom >=20.0.11,jsdom >=27.4.0,@jest/globals >=30.0.0,@cucumber/cucumber >=11.0.0,@testing-library/vue ^8.0.1source -
NEW:
mockNuxtImportoriginal parameter — v4.0 passes original implementation to factory function, enabling natural partial mocking:mockNuxtImport('useRoute', original => vi.fn(original))source -
NEW:
registerEndpointquery parameter support — v4.0 fixed long-standing issue whereregisterEndpointdid not work correctly with query parameters in URLs (#1560) source -
NEW:
registerEndpointonceoption — v3.21 addedonceoption toregisterEndpointfor single-use endpoint registration source -
NEW:
renderSuspendedrerender behavior — v3.21 added support for rerender behavior inrenderSuspendedhelper (#1466) source -
NEW: CSS modules in mount/render helpers — v3.21 added support for CSS modules in
mountandrenderhelpers (#1464) source -
NEW:
cleanupscopedoption — v3.20 addedscopedoption tocleanupcomponents for targeted cleanup (#1389) source -
NEW:
registerEndpointwith native fetch — v3.20 enabledregisterEndpointto work with nativefetchand$fetch.create(#1415, #1403) source -
NEW:
wrapper.vmautomatic ref unwrapping — v3.20 added automatic ref unwrapping forwrapper.vmproperty, simplifying access to unwrapped reactive values (#1405) source -
NEW:
mockNuxtImportmocked target arguments — v3.21 added support for mocked target arguments inmockNuxtImport(#1492) source -
NEW: Mocking before Nuxt startup — v4.0 moved Nuxt initialization to
beforeAllhook, allowingvi.mockandmockNuxtImportto take effect before Nuxt starts, fixing unreliable mocking of composables used in middleware and plugins (#1516, #750, #836, #1496) source -
NEW: setupBun timeouts — v4.0 added support for setup and teardown timeouts configuration in
setupBun(#1578) source
Also changed: Route sync emulation skipped when NuxtPage exists (v3.22) · Initial route change can be skipped via option (v3.22) · h3 v2 support (v3.23) · mount + render helpers unified logic (v3.22) · App context passed across mount + render helpers (v3.21)
Best Practices
-
Move Nuxt composable calls to
beforeAllorbeforeEachhooks, not describe block scope — Nuxt initialization moved tobeforeAllin v4.0.0, causing describe-level composable calls to fail with "instance unavailable" error source -
Use
mockNuxtImportwith the original implementation parameter for natural partial mocking — v4.0.0 passes the original factory to enable spreading and modifying without infinite loops source
mockNuxtImport('useRoute', original =>
vi.fn(original)
)
-
Extract
import.meta.serverandimport.meta.clientto a helper module before mocking — direct assignment toimport.metadoesn't work; wrap in a re-export and mock that instead source -
Use
.env.testfile for test-specific environment variables instead of config — Vitest loads.env.testautomatically for test runs while preserving actual app config source -
Use
vi.hoisted()for mock factories to optimize module graph — avoids eager imports of large dependency trees thatmockNuxtImportrequires source
const mocks = vi.hoisted(() => ({
navigateTo: vi.fn(),
useRouter: vi.fn(),
}))
vi.mock('#app/composables/router', () => mocks)
-
Place server/API tests in the
nuxtenvironment, notnode— server code needs Nuxt magic (auto-imports, composables);nodeenvironment is only for pure utilities source -
Mock Pinia stores by wrapping the store import with
createTestingPinia— avoid Symbol conflicts when using@pinia/nuxtmodule by providing testing instance to store function source -
Use
scopedoption in cleanup for isolated component state — v3.20.0 addedcleanup({ scoped: true })to prevent test isolation issues with component instances source -
Enable automatic ref unwrapping with
wrapper.vm— v3.20.0 unwraps refs automatically, eliminating.valuecalls for cleaner test assertions source -
Use
registerEndpointin setup files for persistent mock routes — v4.0.0 ensures endpoints persist across module resets and supports query parameters source
Related: unplugin-skilld
FAQ
What does the nuxt-test-utils-skilld skill do?
ALWAYS use when writing code importing "@nuxt/test-utils". Consult for debugging, best practices, or modifying @nuxt/test-utils, nuxt/test-utils, nuxt test-utils, nuxt test utils, test-utils, test utils.
How do I install nuxt-test-utils-skilld?
Run npx skills add https://github.com/nuxt/scripts --skill nuxt-test-utils-skilld in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/nuxt-test-utils-skilld/ (personal) or .claude/skills/nuxt-test-utils-skilld/ (project).
Which AI agents can use nuxt-test-utils-skilld?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is nuxt-test-utils-skilld safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains nuxt-test-utils-skilld?
It is published by nuxt in nuxt/scripts, and it is an official skill from the maker of the technology it covers. It has 39 recorded installs.
Popular testing & qa skills
tdd
mattpocock/skills
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
grilling
mattpocock/skills
Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
migrate-to-shoehorn
mattpocock/skills
Migrate test files from as type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace as in tests, or needs partial test data.
run-train
lllllllama/rigorpilot-skills
Rigor Train skill for deep learning research repositories. Use when a documented or selected training command should be run conservatively for startup verification, short-run verification, full kickoff, or resume, with command, config, seed, log, checkpoint, status, and metric evidence written to standardized trainoutputs/. Do not use for environment setup, exploratory sweeps, speculative idea implementation, or end-to-end orchestration.
test-driven-development
obra/superpowers
Use when implementing any feature or bugfix, before writing implementation code
finishing-a-development-branch
obra/superpowers
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work