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

@tmakit/testing

v0.1.0

Published

Dev-only test utilities for tmakit: unit-test bridge double and Playwright driver on the core mock engine

Readme

@tmakit/testing

Dev-only test utilities for Telegram Mini Apps, on the same mock engine as the devtools panel: a bridge double for unit tests and a Playwright driver for E2E.

Part of tmakit.

Install

npm i -D @tmakit/testing

tma-kit is a peer dependency.

Unit tests — createMockBridge

A bridge test double backed by @tmakit/core. Wire it into TmaProvider to render components that use tma-kit hooks, and drive events / inspect traffic via mock.

import { renderHook, act, waitFor } from '@testing-library/react';
import { TmaProvider, usePayment } from 'tma-kit';
import { createMockBridge } from '@tmakit/testing';

const { bridge, mock } = createMockBridge({ version: '8.0' });
const wrapper = ({ children }) => <TmaProvider bridge={bridge}>{children}</TmaProvider>;

const { result } = renderHook(() => usePayment(), { wrapper });
act(() => { result.current.open('slug'); });
const { id } = (await mock.requests.pending())[0] ?? {};
act(() => mock.requests.resolve(id, { name: 'invoice_closed', params: { slug: 'slug', status: 'paid' } }));
await waitFor(() => expect(result.current.status).toBe('paid'));

E2E — createTmaPageDriver

The mock runs inside the page (your app exposes its MockController on window.__tmakit_mock__ in dev). The driver controls it from a Playwright test via page.evaluate, so E2E answers postEvents and injects events without a real client.

import { createTmaPageDriver } from '@tmakit/testing';

const tma = createTmaPageDriver(page);
await tma.emit('viewport_changed', { height: 500, width: 360, is_expanded: true, is_state_stable: true });

const [invoice] = await tma.pending();
await tma.resolveRequest(invoice.id, { name: 'invoice_closed', params: { slug: 's', status: 'paid' } });

const log = await tma.log(); // the bridge log, as seen in-page

Expose the mock in your dev entry:

import { MOCK_GLOBAL_KEY } from '@tmakit/testing';
if (import.meta.env.DEV) (window as any)[MOCK_GLOBAL_KEY] = mock;

Typed against a minimal PageLike — no hard dependency on @playwright/test.

License

MIT