router-act

Official

Deterministic routing tests for Next.js

Authorvercel
Version1.0.0
Installs0

System Documentation

What problem does it solve?

End-to-end testing of Next.js router interactions becomes deterministic by controlling the timing and responses of router requests (such as prefetches) and by asserting on outcomes.

Core Features & Use Cases

  • Act API intercepts router requests (prefetches, navigations) and buffers responses until the test scope ends, enabling deterministic assertions.
  • LinkAccordion pattern gates prefetching by toggling link visibility inside an act scope, reducing flakiness.
  • Fake clocks and fixtures simulate time-based scenarios, such as segment-cache staleness and navigation timing.
  • Use cases include validating prefetch timing, navigation flows, and segment-cache behavior in Next.js apps.

Quick Start

Wrap your test scope with act to deterministically control router requests and responses.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: router-act
Download link: https://github.com/vercel/next.js/archive/main.zip#router-act

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.