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

@holoscript/test

v3.1.0

Published

Testing framework for HoloScript applications

Readme

@holoscript/test

Testing framework for HoloScript applications.

Installation

npm install @holoscript/test

Overview

A comprehensive testing framework with HoloScript-specific assertions, visual regression testing, coverage tracking, E2E MCP server testing, and runtime observability.

Assertion Framework

import { expect, describe, it, beforeEach, afterEach, runTests } from '@holoscript/test';

describe('my scene', () => {
  it('should position objects correctly', () => {
    expect(obj).toHavePosition(0, 1, -2);
    expect(obj).toHaveTrait('grabbable');
    expect(obj).toHaveScale(1, 1, 1, 0.01);
  });

  it('should handle collisions', () => {
    expect(result).toBeDefined();
    expect(result.damage).toBeGreaterThan(0);
    expect(result.effects).toContain('spark');
    expect(result.effects).toHaveLength(3);
  });

  it('should reject invalid input', () => {
    expect(() => parse(bad)).toThrow('syntax error');
    await expect(fetchScene('missing')).toReject();
  });
});

await runTests({ verbose: true, bail: false });

Standard Matchers

toBe, toEqual, toBeDefined, toBeUndefined, toBeNull, toBeTruthy, toBeFalsy, toBeGreaterThan, toBeLessThan, toBeCloseTo, toContain, toHaveLength, toHaveProperty, toMatch, toThrow, toReject, toBeInstanceOf

HoloScript Matchers

  • toHavePosition(x, y, z, tolerance?) - 3D position
  • toHaveRotation(x, y, z, tolerance?) - 3D rotation
  • toHaveScale(x, y, z, tolerance?) - 3D scale
  • toHaveTrait(traitName) - Trait presence

All matchers support .not for negation.

Mocking

import { fn, spyOn } from '@holoscript/test';

const callback = fn((x) => x * 2);
callback(5);
expect(callback.mock.calls).toHaveLength(1);
expect(callback.mock.lastCall).toEqual([5]);

callback.mockReturnValue(42);
callback.mockResolvedValueOnce(Promise.resolve('async'));

const spy = spyOn(parser, 'parse');
parser.parse(code);
expect(spy.mock.calls[0][0]).toBe(code);

Scene Testing

import { createSceneTest, addObject, emit, tick, getEvents } from '@holoscript/test';

const ctx = createSceneTest();
addObject(ctx, { name: 'ball', position: [0, 1, 0], traits: ['physics'] });
emit(ctx, 'collision', 'ball', 'wall', { force: 10 });
tick(ctx, 0.016); // advance 16ms
const events = getEvents(ctx, 'collision');

Visual Regression Testing

Pixel-perfect screenshot comparison using Puppeteer:

import { SceneTester } from '@holoscript/test';

const tester = new SceneTester({
  baselineDir: './baselines',
  diffDir: './diffs',
  threshold: 0.01,
});

await tester.setup();
await tester.testScene('examples/lobby.holo', 'lobby');
await tester.teardown();

Lower-level API:

import { HeadlessRenderer, captureScreenshot, compareImages, saveDiff } from '@holoscript/test';

Coverage Tracking

Track coverage across parser nodes, traits, and error paths:

import { CoverageTracker, globalCoverageTracker, createCoverageTest } from '@holoscript/test';

globalCoverageTracker.markCovered('traits', '@grabbable');
globalCoverageTracker.recordPerformance('parse-large', 12.5, 1024);

const report = globalCoverageTracker.generateReport('3.0.0');
console.log(globalCoverageTracker.formatMarkdown(report));

Vitest integration:

const test = createCoverageTest(globalCoverageTracker);
test('parses objects', () => {
  /* auto-tracks coverage */
});

E2E Testing

Live Parser Tests

import { LiveTestRunner, runLiveTests } from '@holoscript/test';

const runner = new LiveTestRunner();
await runner.init();
await runner.runAll(); // tests all .holo/.hs/.hsplus files in examples/

MCP Server E2E

import { MCPServerE2E, runE2ETests } from '@holoscript/test';

const e2e = new MCPServerE2E();
await e2e.start(10000);
await e2e.callTool('parse_holo', { code: 'composition "Test" {}' });
await e2e.runTestSuite();
e2e.kill();

Observability

Runtime monitoring with health checks and tracing:

import { observability, traced, withTracing } from '@holoscript/test';

observability.increment('parse.count');
observability.recordLatency('parse.duration', 12.5);

const health = observability.getHealth();
// { status: 'healthy', checks: [...], metrics: {...} }

// Decorator
class Parser {
  @traced('parse')
  parse(code: string) {
    /* auto-traced */
  }
}

// Wrapper
const result = await withTracing('compile', async () => {
  return compiler.compile(ast);
});

Scripts

npm test              # Run unit tests (vitest)
npm run test:live     # Run live parser integration tests
npm run test:e2e      # Run MCP server E2E tests

License

MIT