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

@bemedev/app-solid-test

v0.2.1

Published

A test library for @bemedev/app-solid

Readme

@bemedev/app-solid-test

A comprehensive testing library for @bemedev/app-solid state machines and interpreters.

Features

  • 🧪 Test state machine interpreters with Vitest
  • 🔄 Test state transitions, context changes, and UI thread updates
  • ⏱️ Built-in fake timer support (createFakeWaiter)
  • 🎯 Convenient test helpers (testBy, matches, contains, hasTags)
  • 🚀 Easy assertion helpers for values, context, and UI state
  • 📊 Full support for parallel states and hierarchical state machines

Installation

pnpm add -D @bemedev/app-solid-test

Usage

Basic Example

import { createInterpreter } from '@bemedev/app-solid';
import { createTests } from '@bemedev/app-solid-test';

vi.useFakeTimers();

describe('My state machine', () => {
  const interpreter = createInterpreter({
    machine: myMachine,
    options: {
      context: { count: 0 },
    },
  });

  const inter = createTests(vi, interpreter);
  const testValue = inter.testBy(({ value }) => value());
  const testCount = inter.testBy(({ context }) => context(s => s.count));

  it(...inter.start);
  it(...testValue('Initial state', 'idle'));
  it(...testCount('Initial count', 0));
  it(...inter.send('INCREMENT'));
  it(...testCount('Count incremented', 1));
  it(...inter.stop);
});

API Reference

createTests(vi, interpreter)

Creates a test wrapper for an interpreter with helpful testing methods.

Parameters:

  • vi: Vitest utilities instance
  • interpreter: The interpreter instance to test

Returns: InterpreterTest instance with the following methods:

Test Methods

  • testBy(fn) - Create a custom test function

    const testValue = inter.testBy(({ value }) => value());
    const testContext = inter.testBy(({ context }) => context(s => s.data));
  • matches(...values) - Assert exact state match

    it(...inter.matches('idle', 'active'));
  • contains(...values) - Assert state contains values

    it(...inter.contains('working', 'active'));
  • hasTags(...tags) - Assert state has specific tags

    it(...inter.hasTags('loading', 'visible'));

Control Methods

  • start - Start the interpreter
  • stop - Stop the interpreter
  • pause - Pause the interpreter
  • resume - Resume the interpreter
  • send(event) - Send an event
  • sendUI(event) - Send a UI event
  • dispose - Dispose the interpreter

Timer Helper

  • createFakeWaiter - Create a fake timer waiter
    const wait = inter.createFakeWaiter.withDefaultDelay(1000);
    it(...wait()); // Wait 1000ms
    it(...wait(2)); // Wait 2000ms (2 × 1000ms)

Testing UI Thread

const interpreter = createInterpreter({
  machine: myMachine,
  options: { context: { count: 0 } },
  uiThread: { counter: 10 },
});

const inter = createTests(vi, interpreter);
const counterUI = inter.testBy(({ ui }) => ui(s => s?.counter));

it(...inter.start);
it(...counterUI('Initial UI counter', 10));
it(...inter.sendUI({ type: 'UPDATE', payload: 42 }));
it(...counterUI('Updated UI counter', 42));

Licence

MIT

CHANGE_LOG

[0.2.1] - 2025/11/29 => 17:30

  • Add peer dependencies for better compatibility
  • Enhance package configuration

Version [0.0.1] --> date & hour

  • ✨ Première version de la bibliothèque

Auteur

chlbri ([email protected])

My github

Liens