# WireMock Testcontainers for Node.js > Mock HTTP APIs in Node.js integration tests: WireMock in Testcontainers, with a fluent TypeScript API. This file contains all documentation content in a single document following the llmstxt.org standard. ## Class: StartedWiremockContainer Defined in: [src/index.ts:427](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L427) A started WireMock container with URL, health, reset and verification helpers – and every Testcontainers `StartedTestContainer` method, such as `stop()` and `logs()`. ### See [Container lifecycle](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/container-lifecycle) ### Extends - [`AbstractStartedContainer`](https://node.testcontainers.org/features/containers/) ### Constructors #### Constructor ```ts new StartedWiremockContainer(startedTestContainer, url): StartedWiremockContainer; ``` Defined in: [src/index.ts:433](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L433) Created by [WiremockContainer.start](WiremockContainer.md#start); `url` is WireMock's base URL. ##### Parameters | Parameter | Type | | ------ | ------ | | `startedTestContainer` | [`StartedTestContainer`](https://node.testcontainers.org/features/containers/) | | `url` | `string` | ##### Returns `StartedWiremockContainer` ##### Overrides `AbstractStartedContainer.constructor` ### Accessors #### rpcUrl ##### Get Signature ```ts get rpcUrl(): string; ``` Defined in: [src/index.ts:441](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L441) Base URL, e.g. `http://localhost:32768`. ###### Returns `string` ### Methods #### countRequests() ```ts countRequests(request): Promise; ``` Defined in: [src/index.ts:533](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L533) Number of journal entries matching `request` since the last reset. ##### Parameters | Parameter | Type | | ------ | ------ | | `request` | [`WiremockRequestCriteria`](../interfaces/WiremockRequestCriteria.md) | ##### Returns `Promise`\<`number`\> ##### Example ```ts 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 [Verifying requests](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/verifying-requests#counting-requests) *** #### findRequests() ```ts findRequests(request): Promise; ``` Defined in: [src/index.ts:544](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L544) Journal entries matching `request` since the last reset. ##### Parameters | Parameter | Type | | ------ | ------ | | `request` | [`WiremockRequestCriteria`](../interfaces/WiremockRequestCriteria.md) | ##### Returns `Promise`\<[`RecordedRequest`](../interfaces/RecordedRequest.md)[]\> ##### Throws If WireMock rejects the criteria, with its explanation. ##### See [Verifying requests](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/verifying-requests#finding-requests) *** #### getAdminUrl() ```ts getAdminUrl(): string; ``` Defined in: [src/index.ts:461](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L461) Admin API base URL: `/__admin`. ##### Returns `string` *** #### getMappingUrl() ```ts getMappingUrl(): string; ``` Defined in: [src/index.ts:469](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L469) Stub mappings endpoint: `/__admin/mappings` – e.g. to add stubs at runtime. ##### Returns `string` ##### See [Stubs added at runtime](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/test-isolation#stubs-added-at-runtime) *** #### getUrl() ```ts getUrl(path?): string; ``` Defined in: [src/index.ts:452](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L452) Absolute URL for `path`, e.g. `getUrl("cards?page=1")`; no argument → [rpcUrl](#rpcurl). ##### Parameters | Parameter | Type | Default value | | ------ | ------ | ------ | | `path?` | `string` | `""` | ##### Returns `string` ##### Example ```ts expect(wiremock.getUrl("/payments")).toBe(`${wiremock.rpcUrl}/payments`); expect(wiremock.getUrl("payments?page=2")).toBe(`${wiremock.rpcUrl}/payments?page=2`); // "/" added ``` ##### See [URLs](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/container-lifecycle#urls) *** #### isRunning() ```ts isRunning(): Promise; ``` Defined in: [src/index.ts:477](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L477) Whether WireMock responds healthily. Never throws. ##### Returns `Promise`\<`boolean`\> ##### See [Health checks](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/container-lifecycle#health-checks) *** #### reset() ```ts reset(): Promise; ``` Defined in: [src/index.ts:513](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L513) Restores registered stubs and scenarios and clears the journal – no restart. ##### Returns `Promise`\<`void`\> ##### Example ```ts afterEach(() => wiremock.reset()); // pristine stubs, empty journal – no restart ``` ##### See [Test isolation](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/test-isolation#resetting-between-tests) *** #### resetRequests() ```ts resetRequests(): Promise; ``` Defined in: [src/index.ts:521](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L521) Clears the request journal; stubs – and scenario states – are kept. ##### Returns `Promise`\<`void`\> ##### See [Test isolation](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/test-isolation#clearing-only-the-journal) *** #### waitUntilReady() ```ts waitUntilReady(options?): Promise; ``` Defined in: [src/index.ts:493](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L493) Polls [isRunning](#isrunning) until healthy. ##### Parameters | Parameter | Type | | ------ | ------ | | `options?` | [`WaitUntilReadyOptions`](../interfaces/WaitUntilReadyOptions.md) | ##### Returns `Promise`\<`void`\> ##### Throws If not healthy within `options.timeout`. ##### See [Container lifecycle](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/container-lifecycle#starting-and-readiness) --- ## Class: WiremockContainer Defined in: [src/index.ts:77](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L77) A WireMock Testcontainer: register stubs, response bodies and extensions, then [start](#start) it. Registrations are validated at once and may not overwrite one another. Every Testcontainers `GenericContainer` builder method is available, too. ### See [Quick start](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/getting-started/quick-start) ### Extends - [`GenericContainer`](https://node.testcontainers.org/features/containers/) ### Constructors #### Constructor ```ts new WiremockContainer(image?): WiremockContainer; ``` Defined in: [src/index.ts:98](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L98) ##### Parameters | Parameter | Type | Default value | Description | | ------ | ------ | ------ | ------ | | `image?` | `string` | `"wiremock/wiremock"` | Docker image, default `wiremock/wiremock` – pin a tag for reproducible tests. | ##### Returns `WiremockContainer` ##### See [Configuring the container](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/configuring-the-container#the-image) ##### Overrides `GenericContainer.constructor` ### Methods #### start() ```ts start(): Promise; ``` Defined in: [src/index.ts:250](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L250) Starts WireMock – in Docker, or locally once `./no-docker` is installed. Resolves once the port listens; [StartedWiremockContainer.waitUntilReady](StartedWiremockContainer.md#waituntilready) waits until WireMock is healthy. ##### Returns `Promise`\<[`StartedWiremockContainer`](StartedWiremockContainer.md)\> ##### Throws Before starting, for a class with no registered JAR or options conflicting with `withCommand()`; if WireMock fails, naming the extensions in use. ##### See [Container lifecycle](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/container-lifecycle#starting-and-readiness) ##### Overrides `GenericContainer.start` *** #### withCommand() ```ts withCommand(command): this; ``` Defined in: [src/index.ts:108](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L108) WireMock CLI arguments, e.g. `["--verbose"]`; extensions add theirs on `start()`. ##### Parameters | Parameter | Type | | ------ | ------ | | `command` | `string`[] | ##### Returns `this` ##### See [WireMock options](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/configuring-the-container#wiremock-options) ##### Overrides `GenericContainer.withCommand` *** #### withExtension() ```ts withExtension(extension): this; ``` Defined in: [src/index.ts:195](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L195) Registers an extension: a fully qualified Java class name, or a [WireMockExtension](../interfaces/WireMockExtension.md) or its class. Class names share one `--extensions`, in registration order, without repeats. ##### Parameters | Parameter | Type | | ------ | ------ | | `extension` | [`ExtensionInput`](../type-aliases/ExtensionInput.md) | ##### Returns `this` ##### Example ```ts .withExtensionJar("./__mocks__/extensions/example-extensions.jar") // onto WireMock's class path .withExtension("com.hellaweb3.wiremock.extensions.UppercaseTransformer") // --extensions .withExtension(shortJournal) ``` ##### Throws If a class name, an extension or its JARs are invalid, or an option conflicts. ##### See [Registering extensions](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/extensions/typescript-extensions#registering-extensions) *** #### withExtensionJar() ```ts withExtensionJar(jar): this; ``` Defined in: [src/index.ts:213](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L213) Puts a JAR – or every `*.jar` of a directory – on WireMock's class path. Extensions listed in its `META-INF/services` load by themselves; others need [withExtension](#withextension). ##### Parameters | Parameter | Type | Description | | ------ | ------ | ------ | | `jar` | [`WiremockStaticFile`](../type-aliases/WiremockStaticFile.md) | Any file source; `{ file, name }` renames the JAR. | ##### Returns `this` ##### Throws If the source is missing, unreadable or not a JAR, or another JAR has the same name. ##### See [Java extensions](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/extensions/java-extensions#load-a-jar-and-name-its-classes) *** #### withExtensionJars() ```ts withExtensionJars(jars): this; ``` Defined in: [src/index.ts:222](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L222) [withExtensionJar](#withextensionjar) for several JARs or directories – all or nothing. ##### Parameters | Parameter | Type | | ------ | ------ | | `jars` | readonly [`WiremockStaticFile`](../type-aliases/WiremockStaticFile.md)[] | ##### Returns `this` ##### Example ```ts .withExtensionJars(["./__mocks__/extensions"]) // example-extensions.jar and powered-by-extension.jar ``` *** #### withExtensionOptions() ```ts withExtensionOptions(options): this; ``` Defined in: [src/index.ts:231](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L231) Configures how extensions load; options not given keep their value. ##### Parameters | Parameter | Type | | ------ | ------ | | `options` | [`WiremockExtensionOptions`](../interfaces/WiremockExtensionOptions.md) | ##### Returns `this` ##### Throws For an unknown option or a non-boolean value. ##### See [Extension options](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/extensions/java-extensions#extension-options) *** #### withExtensions() ```ts withExtensions(extensions): this; ``` Defined in: [src/index.ts:202](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L202) [withExtension](#withextension) for several extensions – all or nothing. ##### Parameters | Parameter | Type | | ------ | ------ | | `extensions` | readonly [`ExtensionInput`](../type-aliases/ExtensionInput.md)[] | ##### Returns `this` *** #### withFiles() ```ts withFiles(...files): this; ``` Defined in: [src/index.ts:173](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L173) Registers response bodies at `__files/` (default: base name). All or nothing. ##### Parameters | Parameter | Type | | ------ | ------ | | ...`files` | [`WiremockStaticFile`](../type-aliases/WiremockStaticFile.md)[] | ##### Returns `this` ##### Example ```ts .withFiles(STATEMENT_BODY, INVOICE_BODY, EXCHANGE_RATES_BODY); // bodies → __files/ ``` ##### Throws If a source or name is invalid, or a file would overwrite an earlier registration. ##### See [Registering stubs](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/registering-stubs#response-bodies) *** #### withMapping() ```ts withMapping(name, source): this; ``` Defined in: [src/index.ts:153](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L153) Registers one mapping file at `mappings/.json` (`name` may contain `/`); it may hold one stub or `{ "mappings": [...] }`. ##### Parameters | Parameter | Type | Description | | ------ | ------ | ------ | | `name` | `string` | The file name below `mappings/`, without `.json`. | | `source` | [`WiremockMappingSource`](../type-aliases/WiremockMappingSource.md) | A file source, or inline JSON: `{ json }`. | ##### Returns `this` ##### Example ```ts .withMapping("ping", { json: PING_STUB }) // inline: an object… .withMapping("maintenance", { json: MAINTENANCE_STUB }) // …or a JSON string .withMapping("payments/refunds", REFUND_STUBS) // "/" nests: mappings/payments/refunds.json ``` ##### Throws If the source is invalid, not a WireMock stub, or would overwrite an earlier registration. ##### See [Registering stubs](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/registering-stubs#mapping-files) *** #### withMappings() ```ts withMappings(directory): this; ``` Defined in: [src/index.ts:119](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L119) Copies `directory/mappings/` (required) and `directory/__files/` (optional) into the container. ##### Parameters | Parameter | Type | Description | | ------ | ------ | ------ | | `directory` | `string` | A path, relative to the working directory. | ##### Returns `this` ##### Throws If `mappings/` is missing or a file would overwrite an earlier registration. ##### See [Registering stubs](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/registering-stubs#a-recorded-directory) --- ## Function: detectCI() ```ts function detectCI(env?): string | undefined; ``` Defined in: [src/no-docker.ts:90](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/no-docker.ts#L90) The CI/CD variable set in `env`, if any – `CI`, `GITHUB_ACTIONS`, `GITLAB_CI`, `JENKINS_URL`, …; values `""`, `"0"` and `"false"` do not count. ### Parameters | Parameter | Type | Default value | | ------ | ------ | ------ | | `env?` | \{ \[`key`: `string`\]: `string` \| `undefined`; \} | `process.env` | ### Returns `string` \| `undefined` --- ## Function: installNoDockerRuntime() ```ts function installNoDockerRuntime(options?): () => void; ``` Defined in: [src/no-docker.ts:117](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/no-docker.ts#L117) **Local development only**: serves every `WiremockContainer` started from now on from a local WireMock JVM (Java 11+) on `127.0.0.1`, warning on each start. Container-only features throw. ### Parameters | Parameter | Type | | ------ | ------ | | `options?` | [`NoDockerOptions`](../interfaces/NoDockerOptions.md) | ### Returns A function that uninstalls it. () => `void` ### Example ```ts installNoDockerRuntime(NO_DOCKER_OPTIONS); ``` ### Throws In CI/CD, or if no WireMock JAR is found. ### See [Running without Docker](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/running-without-docker#set-up) --- ## Function: isNoDockerRequested() ```ts function isNoDockerRequested(env?): boolean; ``` Defined in: [src/no-docker.ts:103](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/no-docker.ts#L103) Whether [NO\_DOCKER\_ENV](../variables/NO_DOCKER_ENV.md) is `1` or `true`. ### Parameters | Parameter | Type | Default value | | ------ | ------ | ------ | | `env?` | \{ \[`key`: `string`\]: `string` \| `undefined`; \} | `process.env` | ### Returns `boolean` ### Example ```ts const noDocker = isNoDockerRequested(); // WIREMOCK_NO_DOCKER is "1" or "true" ``` ### See [Running without Docker](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/running-without-docker#detecting-ci-and-the-request) --- ## API reference ### Classes - [StartedWiremockContainer](classes/StartedWiremockContainer.md) - [WiremockContainer](classes/WiremockContainer.md) ### Interfaces - [NoDockerOptions](interfaces/NoDockerOptions.md) - [RecordedRequest](interfaces/RecordedRequest.md) - [WaitUntilReadyOptions](interfaces/WaitUntilReadyOptions.md) - [WireMockExtension](interfaces/WireMockExtension.md) - [WiremockExtensionOptions](interfaces/WiremockExtensionOptions.md) - [WiremockRequestCriteria](interfaces/WiremockRequestCriteria.md) - [WiremockStubMapping](interfaces/WiremockStubMapping.md) ### Type Aliases - [ExtensionConstructor](type-aliases/ExtensionConstructor.md) - [ExtensionInput](type-aliases/ExtensionInput.md) - [WiremockExtensionJar](type-aliases/WiremockExtensionJar.md) - [WiremockFileSource](type-aliases/WiremockFileSource.md) - [WiremockMappingSource](type-aliases/WiremockMappingSource.md) - [WiremockPath](type-aliases/WiremockPath.md) - [WiremockStaticFile](type-aliases/WiremockStaticFile.md) ### Variables - [NO\_DOCKER\_ENV](variables/NO_DOCKER_ENV.md) ### Functions - [detectCI](functions/detectCI.md) - [installNoDockerRuntime](functions/installNoDockerRuntime.md) - [isNoDockerRequested](functions/isNoDockerRequested.md) --- ## Interface: NoDockerOptions Defined in: [src/no-docker.ts:68](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/no-docker.ts#L68) Options for [installNoDockerRuntime](../functions/installNoDockerRuntime.md). ### See [Running without Docker](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/running-without-docker#options) ### Properties | Property | Modifier | Type | Description | Defined in | | ------ | ------ | ------ | ------ | ------ | | `cacheDir?` | `readonly` | `string` \| `false` | Cache for the class-data archive that halves JVM start-up after the first run; `false` disables it. Default: `/wiremock-testcontainers`. | [src/no-docker.ts:81](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/no-docker.ts#L81) | | `env?` | `readonly` | `Readonly`\<`Record`\<`string`, `string` \| `undefined`\>\> | Source of the CI/CD check and the defaults above. Default: `process.env`. | [src/no-docker.ts:83](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/no-docker.ts#L83) | | `jar?` | `readonly` | `string` | WireMock standalone JAR. Default: `$WIREMOCK_JAR`, else the `wiremock` npm package's. | [src/no-docker.ts:70](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/no-docker.ts#L70) | | `java?` | `readonly` | `string` | Java executable. Default: `$WIREMOCK_JAVA`, `$JAVA_HOME/bin/java`, else `java`. | [src/no-docker.ts:72](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/no-docker.ts#L72) | | `log?` | `readonly` | (`message`) => `void` | Receives the per-start warning. Default: `process.emitWarning`. | [src/no-docker.ts:76](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/no-docker.ts#L76) | | `startupTimeout?` | `readonly` | `number` | Milliseconds to wait for WireMock to be healthy. Default `60_000`. | [src/no-docker.ts:74](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/no-docker.ts#L74) | --- ## Interface: RecordedRequest Defined in: [src/index.ts:390](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L390) A request from WireMock's journal; fields not modelled here are kept as-is. ### See [Recorded requests](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/verifying-requests#recorded-requests) ### Indexable ```ts [field: string]: unknown ``` ### Properties | Property | Modifier | Type | Description | Defined in | | ------ | ------ | ------ | ------ | ------ | | `absoluteUrl?` | `readonly` | `string` | Scheme, host, port, path and query string, e.g. `"http://localhost:32768/cards?page=1"`. | [src/index.ts:396](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L396) | | `body?` | `readonly` | `string` | The body as text; `""` for requests without one. | [src/index.ts:404](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L404) | | `headers?` | `readonly` | `Readonly`\<`Record`\<`string`, `unknown`\>\> | Header name → value, e.g. `{ "Content-Type": "application/json" }`. | [src/index.ts:400](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L400) | | `id?` | `readonly` | `string` | The journal entry's id, where WireMock reports one. | [src/index.ts:392](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L392) | | `loggedDate?` | `readonly` | `number` | Epoch milliseconds. | [src/index.ts:406](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L406) | | `method` | `readonly` | `string` | E.g. `"GET"`. | [src/index.ts:398](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L398) | | `queryParams?` | `readonly` | `Readonly`\<`Record`\<`string`, `unknown`\>\> | Query parameter name → `{ key, values }`, e.g. `{ page: { key: "page", values: ["1"] } }`. | [src/index.ts:402](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L402) | | `url` | `readonly` | `string` | Path and query string, e.g. `"/cards?page=1"`. | [src/index.ts:394](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L394) | --- ## Interface: WaitUntilReadyOptions Defined in: [src/index.ts:413](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L413) Options for [StartedWiremockContainer.waitUntilReady](../classes/StartedWiremockContainer.md#waituntilready). ### Properties | Property | Modifier | Type | Description | Defined in | | ------ | ------ | ------ | ------ | ------ | | `interval?` | `readonly` | `number` | Milliseconds between probes. Default `250`. | [src/index.ts:417](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L417) | | `timeout?` | `readonly` | `number` | Milliseconds before giving up. Default `30_000`. | [src/index.ts:415](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L415) | --- ## Interface: WireMockExtension Defined in: [src/extensions.ts:23](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/extensions.ts#L23) Base interface all WireMock extensions must implement: what WireMock loads for it. Implement at least one optional member. ### Example ```ts const shortJournal: WireMockExtension = { getName: () => "short-journal", getOptions: () => ["--max-request-journal=2"], }; ``` ### See [TypeScript extensions](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/extensions/typescript-extensions#the-contract) ### Methods #### getClassNames()? ```ts getClassNames?(): readonly string[]; ``` Defined in: [src/extensions.ts:27](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/extensions.ts#L27) Fully qualified Java class names, passed to `--extensions`. ##### Returns readonly `string`[] *** #### getJars()? ```ts getJars?(): readonly WiremockStaticFile[]; ``` Defined in: [src/extensions.ts:29](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/extensions.ts#L29) JARs – or directories of them – for WireMock's class path. ##### Returns readonly [`WiremockStaticFile`](../type-aliases/WiremockStaticFile.md)[] *** #### getName() ```ts getName(): string; ``` Defined in: [src/extensions.ts:25](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/extensions.ts#L25) Its name, e.g. WireMock's `"uppercase"`. Re-registering a name: no-op if configured alike, else an error. ##### Returns `string` *** #### getOptions()? ```ts getOptions?(): readonly string[]; ``` Defined in: [src/extensions.ts:31](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/extensions.ts#L31) WireMock CLI options, one per entry: `"--flag"` or `"--option=value"`. ##### Returns readonly `string`[] --- ## Interface: WiremockExtensionOptions Defined in: [src/extensions.ts:50](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/extensions.ts#L50) Options for `WiremockContainer.withExtensionOptions()`. ### See [Extension options](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/extensions/java-extensions#extension-options) ### Properties | Property | Modifier | Type | Description | Defined in | | ------ | ------ | ------ | ------ | ------ | | `scanning?` | `readonly` | `boolean` | Load extensions JARs declare in `META-INF/services`; `false`: `--disable-extensions-scanning`. Default `true`. | [src/extensions.ts:52](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/extensions.ts#L52) | | `verifyClassNames?` | `readonly` | `boolean` | Fail `start()` for a class in no registered JAR and not WireMock's own; off for classes the image provides. Default `true`. | [src/extensions.ts:54](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/extensions.ts#L54) | --- ## Interface: WiremockRequestCriteria Defined in: [src/index.ts:366](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L366) WireMock [request-matching](https://wiremock.org/docs/request-matching/) criteria; unknown fields pass through. ### See [Request criteria](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/verifying-requests#request-criteria) ### Indexable ```ts [field: string]: unknown ``` ### Properties | Property | Modifier | Type | Description | Defined in | | ------ | ------ | ------ | ------ | ------ | | `bodyPatterns?` | `readonly` | readonly `object`[] | E.g. `[{ equalToJson: { id: 1 } }]`. | [src/index.ts:382](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L382) | | `headers?` | `readonly` | `Readonly`\<`Record`\<`string`, `unknown`\>\> | E.g. `{ "Content-Type": { equalTo: "application/json" } }`. | [src/index.ts:378](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L378) | | `method?` | `readonly` | `string` | E.g. `"GET"`; `"ANY"` matches every method. | [src/index.ts:368](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L368) | | `queryParameters?` | `readonly` | `Readonly`\<`Record`\<`string`, `unknown`\>\> | E.g. `{ page: { equalTo: "1" } }`. | [src/index.ts:380](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L380) | | `url?` | `readonly` | `string` | Exact path and query string. | [src/index.ts:370](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L370) | | `urlPath?` | `readonly` | `string` | Exact path, any query string. | [src/index.ts:372](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L372) | | `urlPathPattern?` | `readonly` | `string` | Regex for the path. | [src/index.ts:374](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L374) | | `urlPattern?` | `readonly` | `string` | Regex for path and query string. | [src/index.ts:376](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/index.ts#L376) | --- ## Interface: WiremockStubMapping Defined in: [src/sources.ts:39](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/sources.ts#L39) A WireMock stub; fields besides `request` and `response` are passed through. ### See [Inline stubs](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/registering-stubs#inline-stubs) ### Indexable ```ts [field: string]: unknown ``` ### Properties | Property | Modifier | Type | Description | Defined in | | ------ | ------ | ------ | ------ | ------ | | `request` | `readonly` | `object` | What the stub matches, e.g. `{ method: "GET", url: "/ping" }`. | [src/sources.ts:41](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/sources.ts#L41) | | `response` | `readonly` | `object` | What it answers, e.g. `{ status: 200, body: "pong" }`. | [src/sources.ts:43](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/sources.ts#L43) | --- ## Type Alias: ExtensionConstructor\ ```ts type ExtensionConstructor = new () => T; ``` Defined in: [src/extensions.ts:38](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/extensions.ts#L38) A [WireMockExtension](../interfaces/WireMockExtension.md) class with a no-argument constructor: registering the class instantiates it. ### Type Parameters | Type Parameter | Default type | | ------ | ------ | | `T` *extends* [`WireMockExtension`](../interfaces/WireMockExtension.md) | [`WireMockExtension`](../interfaces/WireMockExtension.md) | ### Returns `T` --- ## Type Alias: ExtensionInput ```ts type ExtensionInput = | string | ExtensionConstructor | WireMockExtension; ``` Defined in: [src/extensions.ts:44](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/extensions.ts#L44) Union type of all supported ways to register an extension: a Java class name, a [WireMockExtension](../interfaces/WireMockExtension.md) or its class. ### See [Registering extensions](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/extensions/typescript-extensions#registering-extensions) --- ## Type Alias: WiremockExtensionJar ```ts type WiremockExtensionJar = WiremockStaticFile; ``` Defined in: [src/extensions.ts:11](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/extensions.ts#L11) An extension JAR, or a directory of them – any [WiremockStaticFile](WiremockStaticFile.md); `name` renames a JAR. ### See [Java extensions](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/extensions/java-extensions) --- ## Type Alias: WiremockFileSource ```ts type WiremockFileSource = | WiremockPath | { file: WiremockPath; } | { file: string; package: string; } | { file: string; module: WiremockPath; }; ``` Defined in: [src/sources.ts:16](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/sources.ts#L16) A path or `file:` URL, `{ file }`, a file of an installed package `{ package, file }`, or one next to a module `{ module, file }`. ### Union Members [`WiremockPath`](WiremockPath.md) *** #### Type Literal ```ts { file: WiremockPath; } ``` | Name | Type | Description | Defined in | | ------ | ------ | ------ | ------ | | `file` | [`WiremockPath`](WiremockPath.md) | A path or `file:` URL. | [src/sources.ts:20](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/sources.ts#L20) | *** #### Type Literal ```ts { file: string; package: string; } ``` | Name | Type | Description | Defined in | | ------ | ------ | ------ | ------ | | `file` | `string` | A path inside the package, e.g. `"mappings/ping.json"`. | [src/sources.ts:26](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/sources.ts#L26) | | `package` | `string` | An installed npm package, found the way `require()` would from the working directory. | [src/sources.ts:24](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/sources.ts#L24) | *** #### Type Literal ```ts { file: string; module: WiremockPath; } ``` | Name | Type | Description | Defined in | | ------ | ------ | ------ | ------ | | `file` | `string` | A path relative to the module's directory. | [src/sources.ts:32](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/sources.ts#L32) | | `module` | [`WiremockPath`](WiremockPath.md) | `import.meta.url` (ES modules) or `__dirname` (CommonJS) – or any file or directory. | [src/sources.ts:30](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/sources.ts#L30) | ### See [File sources](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/file-sources) --- ## Type Alias: WiremockMappingSource ```ts type WiremockMappingSource = | WiremockFileSource | { json: | string | WiremockStubMapping | { mappings: readonly WiremockStubMapping[]; }; }; ``` Defined in: [src/sources.ts:51](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/sources.ts#L51) A file source, or inline JSON: a string, a stub or `{ mappings: [...] }`. ### Union Members [`WiremockFileSource`](WiremockFileSource.md) *** #### Type Literal ```ts { json: | string | WiremockStubMapping | { mappings: readonly WiremockStubMapping[]; }; } ``` | Name | Type | Description | Defined in | | ------ | ------ | ------ | ------ | | `json` | \| `string` \| [`WiremockStubMapping`](../interfaces/WiremockStubMapping.md) \| \{ `mappings`: readonly [`WiremockStubMapping`](../interfaces/WiremockStubMapping.md)[]; \} | A JSON string – copied verbatim – or an object, serialised. | [src/sources.ts:55](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/sources.ts#L55) | ### See [Registering stubs](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/registering-stubs#mapping-files) --- ## Type Alias: WiremockPath ```ts type WiremockPath = string | URL; ``` Defined in: [src/sources.ts:10](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/sources.ts#L10) A path (relative to the working directory) or a `file:` URL. ### See [File sources](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/file-sources) --- ## Type Alias: WiremockStaticFile ```ts type WiremockStaticFile = | WiremockPath | Exclude & object; ``` Defined in: [src/sources.ts:68](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/sources.ts#L68) A file source; object forms may set `name`, the path below `__files/`. ### See [File sources](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/file-sources#naming-static-files) --- ## Variable: NO\_DOCKER\_ENV ```ts const NO_DOCKER_ENV: "WIREMOCK_NO_DOCKER" = "WIREMOCK_NO_DOCKER"; ``` Defined in: [src/no-docker.ts:21](https://github.com/hella-labs/wiremock-testcontainers-nodejs/blob/main/src/no-docker.ts#L21) The environment variable that asks for the no-Docker runtime: `WIREMOCK_NO_DOCKER`, set to `1` by the `--no-docker` flag. ### See [Running without Docker](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/running-without-docker#detecting-ci-and-the-request) --- ## Documentation and examples | Project | Directory | Role | |---------|-----------|------| | Library | `/` (pnpm) | Its JSDoc generates the API reference | | Examples | `examples/` (npm) | The only source of code on this site – tested like library code | | Docs | `docs/` (npm) | This site | ### Run the docs Run `pnpm install` in the repository root once. Then every docs script runs as `pnpm docs: