Skip to content
SPECIFICTION
Get listed

Pretender.js

github.com

Web
Visit github.com
Spec score 6.4 #25 of 26 in API Mocking Tools

Spec sheet

What it does
Pretender is a mock server library for XMLHttpRequest and Fetch with an Express- or Sinatra-style syntax for defining routes and handlers.Read 11 Oct 2026 · github.com
Purpose
Pretender is a mock server library for XMLHttpRequest and Fetch with an Express/Sinatra-style routing syntax.Read 4 Oct 2026 · github.com
License
The package metadata identifies the license as MIT.Read 11 Oct 2026 · github.com
Browser only
Pretender temporarily replaces native XMLHttpRequest and Fetch to intercept requests, and the README says it only works in the browser.Read 11 Oct 2026 · github.com
Cleanup
The README instructs users to call shutdown() when finished to restore the native XMLHttpRequest object.Read 11 Oct 2026 · github.com
Installation
The README shows installation with yarn add -D pretender or npm install --save-dev pretender.Read 4 Oct 2026 · github.com
Maintenance activity
The Pretender organization page lists the repository as updated Jan 29, 2024.Read 11 Oct 2026 · github.com
Module use
The README shows Pretender loaded directly in a browser or imported as a module.Read 4 Oct 2026 · github.com
Pass-through
Configured requests can pass through Pretender and be sent as real XMLHttpRequests.Read 11 Oct 2026 · github.com
Request tracking
Pretender tracks handled, unhandled, and pass-through requests, and request tracking can be disabled with an option.Read 11 Oct 2026 · github.com
Response timing
Routes can respond asynchronously, synchronously, after a delay, or only when manually resolved.Read 4 Oct 2026 · github.com
Responses
Route handlers can return a response array containing an HTTP status, headers, and body, or return a Promise.Read 11 Oct 2026 · github.com
Route methods
The routing DSL supports GET, PUT, POST, DELETE, PATCH, and HEAD methods.Read 11 Oct 2026 · github.com
Support and community
The project asks community members to follow its Code of Conduct and directs reports to a maintainer.Read 4 Oct 2026 · github.com
Support channel
The project repository provides an Issues page for reporting and discussing issues.Read 11 Oct 2026 · github.com
Timing controls
Routes can respond asynchronously, synchronously, after a delay, or only when manually resolved.Read 11 Oct 2026 · github.com
Usage
The README documents installation with npm or Yarn, direct browser script loading, and importing Pretender as a module.Read 11 Oct 2026 · github.com

Where Specifiction places it

Alternatives to Pretender.jsAll alternatives →