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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@gtkx/testing

v0.4.1

Published

Testing utilities for GTKX applications

Readme


GTKX lets you build native Linux desktop applications using React and TypeScript. Write familiar React code that renders as native GTK4 widgets—no Electron, no web views.

Features

  • React — Hooks, state, props, and components you already know
  • Hot Reload — Edit code and see changes instantly via Vite
  • Native — Direct FFI bindings to GTK4 via Rust and libffi
  • CLInpx @gtkx/cli@latest create scaffolds a ready-to-go project
  • CSS-in-JS — Emotion-style css template literals for GTK styling
  • Testing — Testing Library-style screen, userEvent, and queries

Quick Start

npx @gtkx/cli@latest create my-app
cd my-app
npm run dev

Edit your code and see changes instantly—no restart needed.

Example

import {
  render,
  ApplicationWindow,
  Box,
  Button,
  Label,
  quit,
} from "@gtkx/react";
import { Orientation } from "@gtkx/ffi/gtk";
import { useState } from "react";

const App = () => {
  const [count, setCount] = useState(0);

  return (
    <ApplicationWindow title="Counter" onCloseRequest={quit}>
      <Box orientation={Orientation.VERTICAL} spacing={12}>
        <Label.Root label={`Count: ${count}`} />
        <Button label="Increment" onClicked={() => setCount((c) => c + 1)} />
      </Box>
    </ApplicationWindow>
  );
};

render(<App />, "org.example.Counter");

Styling

import { css } from "@gtkx/css";
import { Button } from "@gtkx/react";

const primary = css`
  padding: 16px 32px;
  border-radius: 24px;
  background: linear-gradient(135deg, #3584e4, #9141ac);
  color: white;
`;

<Button label="Click me" cssClasses={[primary]} />;

GTK also provides built-in classes like suggested-action, destructive-action, card, and heading.

Testing

import { cleanup, render, screen, userEvent } from "@gtkx/testing";
import { AccessibleRole } from "@gtkx/ffi/gtk";

afterEach(() => cleanup());

test("increments count", async () => {
  await render(<App />);

  const button = await screen.findByRole(AccessibleRole.BUTTON, {
    name: "Increment",
  });
  await userEvent.click(button);

  await screen.findByText("Count: 1");
});

Queries: findByRole, findByText, findByLabelText, findByTestId

User events: click, dblClick, type, clear, tab, selectOptions

Examples

| Example | Description | | ------------------------------- | ------------------- | | gtk4-demo | Widget showcase | | todo | Todo app with tests |

Packages

| Package | Description | | --------------------------------- | ------------------------------------- | | @gtkx/cli | CLI with HMR dev server | | @gtkx/react | React reconciler and JSX components | | @gtkx/ffi | TypeScript bindings for GTK4/GLib/GIO | | @gtkx/native | Rust native module (libffi bridge) | | @gtkx/css | CSS-in-JS styling | | @gtkx/testing | Testing utilities | | @gtkx/gir | GObject Introspection parser |

Requirements

  • Node.js 20+
  • GTK4 Runtime (gtk4 on Fedora, libgtk-4-1 on Ubuntu)
  • Linux

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

License

MPL-2.0