Ng-apimock is essentially a set of npm packages that can be installed over npm.
- Node.js version >= 10.15.1 or above (which can be checked by running
node -v). You can use nvm for managing multiple Node versions on a single machine installed
- Yarn version >= 1.5 (which can be checked by running
npmclient. It is not strictly necessary but highly encouraged. To add the standard WireMock JAR as a project dependency, put the following in the dependencies section of your build file:
Installing using npm / yarn
The next step is to tell @ng-apimock/core where it can find the mocks and / or presets. You can do that by calling the processor.
There are 3 parameters here:
- src: this is the directory that will be use to search for mocks and presets.
- patterns: there are 2 regex patterns that can be overridden, mocks and presets.
- watch: set to true will ensure that ng-apimock will watch for file changes.
As a side-effect, when a mock or preset change has been detected, the saved state will be reset.
Middleware body limit
The default bodyParser library that is used has a body limit is
100kb. In order to increase the limit you can set the limit like this:
You can configure apimock with a configuration object.
The cookie or header is used to make sure that parallel executed tests do not interfere with each other. Each session is fully isolated.
Minimal setup example
This is a minimal setup example of how you can manually use @ng-apimock/core
To start up the script just type: