WireMock Standalone for NPM
This package downloads WireMock standalone from Maven Central and provides simple CLI wrapper for NPM.
How to use
npm i -D wiremock-standalone
yar add -D wiremock-standalone
Usage (as script in package.json
):
{
"scripts": {
"start:mock": "wiremock --root-dir ./mock"
}
}
Downloader configuration
By default, the latest stable version of WireMock JAR is downloaded from public Maven repository (https://repo1.maven.org
).
You can override this behavior (by precedence):
- setting environment variables:
MAVEN_REPO_URL
, WIREMOCK_VERSION
- creating
.wiremock
configuration file in your project (JSON):
{
"version": "[version]",
"mavenRepoURL": "[custom Maven URL]"
}
- adding
wiremock
property in your package.json
:
"wiremock": {
"version": "[version]",
"mavenRepoURL": "[custom Maven URL]"
}
Runtime options
Java arguments
You can pass options to Java runtime with --java-arg
CLI argument. All system properties are collected and appended to wiremock's --permitted-system-keys
option.
wiremock --java-arg -Dmy.custom.var=some-value --root-dir ./mock
HOWTOs
Passing ENV variables with env-cmd
yarn env-cmd -f [path/to/.env] yarn wiremock --global-response-templating --verbose --root-dir ./mocks --permitted-system-keys=WIREMOCK_.*
Donation
If this project help you reduce time to develop, you can give me a cup of coffee :)