npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@schalkneethling/css-expect

v0.1.0

Published

Native browser-backed expectations for CSS custom functions and future CSS mixins.

Readme

css-expect

Native browser-backed expectations for CSS custom functions and future CSS mixins.

@schalkneethling/css-expect is a prototype for unit testing CSS language features in the browser. It is inspired by Sass True's ergonomics, but it does not parse, transform, compile, or emulate CSS. The selected browser engine is the source of truth.

Requirements

  • Chromium with native CSS custom function support for the current prototype.
  • Playwright, installed as this package's runtime browser automation dependency.
  • CSS mixin expectations are future-ready, but currently report unsupported until Chromium implements native @mixin and @apply.

Chromium is the default and currently validated browser. The browser option also accepts "firefox" and "webkit" so future test suites can target whichever engine first implements a given native CSS feature.

Usage

import { createCssExpect } from "@schalkneethling/css-expect";

const css = await createCssExpect({
  browser: "chromium",
  css: `
    @function --double(--value <length>) returns <length> {
      result: calc(var(--value) * 2);
    }
  `,
});

try {
  await css.function("--double", ["4px"]).as("width").equals("8px");
} finally {
  await css.close();
}

Use .as(property) to test a function through a real CSS property grammar. CSS custom functions are evaluated at computed-value time, so expectations read values from getComputedStyle().

await css
  .function("--space-plus", ["var(--gap)"])
  .with({ "--gap": "4px" })
  .as("margin-left")
  .equals("8px");

Runnable Example

This repository includes a runnable file-based example in examples/functions.css.

vp run example

The script builds the package, loads the CSS file through files: ["examples/functions.css"], and runs Chromium-backed expectations against the functions in that file.

CSSOM Introspection

css.functions() reports metadata observed through Chromium's CSSOM when the browser exposes the CSS Functions and Mixins interfaces.

const functions = await css.functions();
const supportsFunctions = await css.hasFunctions();
const supportsMixins = await css.hasMixins();
const supportsApply = await css.hasApply();

The returned metadata is diagnostic only. @schalkneethling/css-expect does not depend on CSSOM descriptors to execute expectations; expectations are based on actual computed style.

Mixins

The mixin API is reserved for native browser support:

await css.mixin("--button", ["primary"]).styles({
  display: "inline-flex",
  color: "rgb(255, 255, 255)",
});

In the current prototype this feature-detects @mixin and @apply, then fails or skips with a clear unsupported-feature diagnostic depending on the unsupported option.

Development

vp install
vp check
vp test
vp pack

Publishing

Before the first release:

  • Enable 2FA for npm and GitHub.
  • Configure npm trusted publishing for @schalkneethling/css-expect after creating the package on npm:
    • provider: GitHub Actions
    • repository: schalkneethling/css-expect
    • workflow filename: publish.yml
    • environment: publish
  • Remove any npm tokens from GitHub repository secrets.
  • Protect the main branch and require pull-request review before merging.
  • Set GitHub Actions default workflow permissions to read-only.
  • Create a GitHub environment named publish and restrict it to the main branch.
  • Run the local package checks:
vp check
vp test
vp run build
vp run package:check
npm pack --dry-run

This package uses .npmrc with ignore-scripts=true so npm lifecycle scripts do not run during installs.