Summary
Add a small helper API that makes it easy for Vitest or other test runners to skip CSS function expectations when the active browser does not support native CSS custom functions.
Context
css-expect can already detect runtime feature support and supports unsupported: "skip" for expectations. In Vitest, however, returning a skipped expectation result does not automatically mark the enclosing test as skipped or stop the test body. Users currently need to manually inspect result.skipped or call css.features() and return early.
Native CSS custom functions are currently effectively Chromium-only, but the helper should rely on feature detection rather than a hardcoded browser-name check so Firefox/WebKit start working automatically if they ship support later.
Possible API shapes
await css.requireFunctions() throws/skips with a clear unsupported diagnostic when @function is unavailable.
await css.skipUnsupportedFunctions() returns a boolean/result that test code can use to return early.
- A runner-agnostic helper could expose support state, while optional Vitest docs show how to wire it to
ctx.skip() or early returns.
Acceptance criteria
- There is an ergonomic helper for checking native CSS custom function support before running function expectations.
- The helper is based on browser feature detection, not only
browser === "chromium".
- Documentation includes a Vitest example that avoids noisy failures in unsupported browsers.
- Existing
unsupported: "skip" behavior remains supported for individual expectations.
- Tests cover supported and unsupported feature-detection paths where practical.
Summary
Add a small helper API that makes it easy for Vitest or other test runners to skip CSS function expectations when the active browser does not support native CSS custom functions.
Context
css-expectcan already detect runtime feature support and supportsunsupported: "skip"for expectations. In Vitest, however, returning a skipped expectation result does not automatically mark the enclosing test as skipped or stop the test body. Users currently need to manually inspectresult.skippedor callcss.features()and return early.Native CSS custom functions are currently effectively Chromium-only, but the helper should rely on feature detection rather than a hardcoded browser-name check so Firefox/WebKit start working automatically if they ship support later.
Possible API shapes
await css.requireFunctions()throws/skips with a clear unsupported diagnostic when@functionis unavailable.await css.skipUnsupportedFunctions()returns a boolean/result that test code can use to return early.ctx.skip()or early returns.Acceptance criteria
browser === "chromium".unsupported: "skip"behavior remains supported for individual expectations.