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

@frontend-testing/vitest-browser-navigate

v0.0.1-alpha.8

Published

Browser navigation command for Vitest browser mode

Readme

@frontend-testing/vitest-browser-navigate

Browser navigation command for Vitest browser mode. Simulates SPA navigation by updating browser history and dispatching popstate events.

Features

  • 🧭 SPA Navigation - Navigate programmatically in browser tests
  • 🎭 Playwright Support - Works with @vitest/browser-playwright
  • 🚗 WebdriverIO Support - Works with @vitest/browser-webdriverio
  • 📦 TypeScript - Full type support with automatic commands.navigate() types

Installation

npm install -D @frontend-testing/vitest-browser-navigate

Peer Dependencies: vitest >= 4.0.0

Quick Start

1. Configure Vitest

// vitest.config.ts
import { navigate } from "@frontend-testing/vitest-browser-navigate";
import { defineConfig } from "vitest/config";

export default defineConfig({
  test: {
    browser: {
      enabled: true,
      provider: "playwright", // or "webdriverio"
      instances: [{ browser: "chromium" }],
      commands: { navigate },
    },
  },
});

2. Use in Tests

import { commands } from "vitest/browser";

describe("MyPage", () => {
  it("navigates to dashboard", async () => {
    await commands.navigate("/dashboard");
    expect(window.location.pathname).toBe("/dashboard");
  });
});

TypeScript Support

Types for commands.navigate() are included automatically. If your IDE doesn't recognize the types, add a side-effect import:

Option A: In your test setup file (recommended)

// src/test/setup.ts
import "@frontend-testing/vitest-browser-navigate";
// ... rest of your setup

Option B: In individual test files

// my-component.spec.tsx
import "@frontend-testing/vitest-browser-navigate";
import { commands } from "vitest/browser";

// Now commands.navigate() has full type support
await commands.navigate("/dashboard");

Note: After adding the import, you may need to restart your TypeScript server (Cmd+Shift+P → "TypeScript: Restart TS Server").

API

commands.navigate(path: string): Promise<void>

Navigates to the specified path by:

  1. Calling window.history.pushState()
  2. Dispatching a popstate event (triggers SPA routers like React Router)
  3. Waiting for the browser to process the navigation
// Basic navigation
await commands.navigate("/login");

// With route parameters
await commands.navigate("/users/123");

// With query parameters
await commands.navigate("/search?q=test&page=1");

How It Works

The command executes inside the browser context and simulates navigation without a full page reload - exactly how SPA routers work. This makes it perfect for testing React Router, Vue Router, or any other client-side routing solution.

License

MIT