Skip to content

How it works

Terms

TermMeaning
RecipeOptional prepare, required start, optional ready / share / hashInputs
DriverFactory that returns a Recipe (staticDir, nuxt, host, …)
Running{ kind: 'url', url, stop } and/or { kind: 'dir', dir }
HarnessHandleurl?, dir?, $fetch, files.*
IdentityHash of recipe id + inputs → cache key under .untestutils

Lifecycle

  1. RegisterdefineRecipes({ … }, import.meta.url)
  2. Prepare (optional) — build into an artifact dir; skipped when cache is warm
  3. Start — local server, dir, or remote URL
  4. Ready — HTTP (or custom) gate
  5. Teardown — stop processes; clear registry

Local servers bind to 127.0.0.1.

Shared prepare (speed)

Prepare outputs live under .untestutils/builds, keyed by identity. Parallel workers take a file lock so they do not corrupt the same build. Running URLs are registered for Playwright/Vitest (UNTESTUTILS_HOST_<ID>).

EnvEffect
UNTESTUTILS_SHARE=0Disable sharing
UNTESTUTILS_DEBUG=1Verbose logs
UNTESTUTILS_ARTIFACTS_DIRCustom artifacts root
UNTESTUTILS_SESSIONPlaywright session namespace (see Playwright)

CI: cache .untestutils/ when inputs are stable; use prewarm; always tear down.

Imports

ImportUse in
untestutilsdefineRecipes, drivers
untestutils/vitest/pluginVitest config only
untestutils/vitestSpecs
untestutils/playwrightPlaywright config + specs
untestutils/nuxtnuxt({ run })
untestutils/utilsCookies, SEO, poll, …

Next

Released under the MIT License.