Class: StartedWiremockContainer
Defined in: src/index.ts:427
A started WireMock container with URL, health, reset and verification helpers – and every
Testcontainers StartedTestContainer method, such as stop() and logs().
See
Extends
Constructors
Constructor
new StartedWiremockContainer(startedTestContainer, url): StartedWiremockContainer;
Defined in: src/index.ts:433
Created by WiremockContainer.start; url is WireMock's base URL.
Parameters
| Parameter | Type |
|---|---|
startedTestContainer | StartedTestContainer |
url | string |
Returns
StartedWiremockContainer
Overrides
AbstractStartedContainer.constructor
Accessors
rpcUrl
Get Signature
get rpcUrl(): string;
Defined in: src/index.ts:441
Base URL, e.g. http://localhost:32768.
Returns
string
Methods
countRequests()
countRequests(request): Promise<number>;
Defined in: src/index.ts:533
Number of journal entries matching request since the last reset.
Parameters
| Parameter | Type |
|---|---|
request | WiremockRequestCriteria |
Returns
Promise<number>
Example
expect(await wiremock.countRequests({ method: "GET", url: "/payments" })).toBe(1); // exact path and query
expect(await wiremock.countRequests({ method: "GET", urlPath: "/payments" })).toBe(2); // any query
Throws
If WireMock rejects the criteria, with its explanation.
See
findRequests()
findRequests(request): Promise<RecordedRequest[]>;
Defined in: src/index.ts:544
Journal entries matching request since the last reset.
Parameters
| Parameter | Type |
|---|---|
request | WiremockRequestCriteria |
Returns
Promise<RecordedRequest[]>
Throws
If WireMock rejects the criteria, with its explanation.
See
getAdminUrl()
getAdminUrl(): string;
Defined in: src/index.ts:461
Admin API base URL: <rpcUrl>/__admin.
Returns
string
getMappingUrl()
getMappingUrl(): string;
Defined in: src/index.ts:469
Stub mappings endpoint: <rpcUrl>/__admin/mappings – e.g. to add stubs at runtime.
Returns
string
See
getUrl()
getUrl(path?): string;
Defined in: src/index.ts:452
Absolute URL for path, e.g. getUrl("cards?page=1"); no argument → rpcUrl.
Parameters
| Parameter | Type | Default value |
|---|---|---|
path? | string | "" |
Returns
string
Example
expect(wiremock.getUrl("/payments")).toBe(`${wiremock.rpcUrl}/payments`);
expect(wiremock.getUrl("payments?page=2")).toBe(`${wiremock.rpcUrl}/payments?page=2`); // "/" added
See
isRunning()
isRunning(): Promise<boolean>;
Defined in: src/index.ts:477
Whether WireMock responds healthily. Never throws.
Returns
Promise<boolean>
See
reset()
reset(): Promise<void>;
Defined in: src/index.ts:513
Restores registered stubs and scenarios and clears the journal – no restart.
Returns
Promise<void>
Example
afterEach(() => wiremock.reset()); // pristine stubs, empty journal – no restart
See
resetRequests()
resetRequests(): Promise<void>;
Defined in: src/index.ts:521
Clears the request journal; stubs – and scenario states – are kept.
Returns
Promise<void>
See
waitUntilReady()
waitUntilReady(options?): Promise<void>;
Defined in: src/index.ts:493
Polls isRunning until healthy.
Parameters
| Parameter | Type |
|---|---|
options? | WaitUntilReadyOptions |
Returns
Promise<void>
Throws
If not healthy within options.timeout.