Lightweight TypeScript REST client for interacting with a running WireMock server (v1.11.0) via its OpenAPI 3.0 endpoints. Provides programmatic access to stub mappings, recordings, requests, and scenarios. Supports TypeScript types, global reset, shutdown, and bulk operations from files/directories. Actively maintained with monthly releases. Key differentiators: full API coverage, TypeScript-first, file-based mapping creation, and proxy/header configuration.
npm install wiremock-rest-clientVerified import paths — ran on the pinned version, not inferred.
Demonstrates client initialization, resetting server state, creating stub mappings via object and file, fetching all mappings, and graceful shutdown.
Update code to use await or .then(). All methods now return Promise.
Upgrade Node.js to >=14.15.0 or >=16.0.0 (LTS).
Use StubMapping type or follow OpenAPI spec shape explicitly.
Use absolute paths or ensure correct working directory. Call path.resolve(__dirname, 'stubs/hello.json') if needed.
Only call shutdown() in cleanup hooks (e.g., afterAll) and ensure no other tests depend on the same server.
Start WireMock with --record-mappings or use snapshot functionality alternatively.
Change to ES module imports: use import { WireMockRestClient } from 'wiremock-rest-client' and set 'type': 'module' in package.json, or use dynamic import.Ensure the client is instantiated before calling service methods. No async initialization needed; error typically due to null/undefined variable.
Verify WireMock server is started on expected host/port. Default is http://localhost:8080. Use console to log the URL.
Call resetAllMappings() before bulk imports, or use updateMapping() to overwrite specific IDs.
Increase timeout via config: new WireMockRestClient(url, { timeout: 10000 }). Check server logs.No dependency data recorded yet.