Upcoming features
Administration web user interface, Chrome extension, Web Sockets, etc.
Check the GitHub project to stay up to date on what we are working.
Node.js mock server
json
files or JavaScript files. Babel is supported, so ESM modules and TypeScript can also be used.
Define responses using plain objects, or even Express middlewares. Hot reload changes the responses in real time once files are changed.
@mocks-server/cypress-commands
allows to easily control the mock server from Cypress.
Read the Cypress integration chapter for further info
// mocks/routes/users.json
[
{
"id": "get-user",
"url": "/api/user/:id",
"method": "GET",
"variants": [
{
"id": "success",
"response": {
"status": 200,
"body": { "id": 1, "name": "John Doe"}
}
},
{
"id": "not-found",
"response": {
"status": 404
}
},
{
"id": "proxied",
"handler": "proxy"
"host": "https://jsonplaceholder.typicode.com/users/1"
}
]
}
]
express
routers to the server, etc.
class MyPlugin {
constructor(mocksServer) {
mocksServer.addSetting({
name: "traceMocks",
type: "boolean",
description: "Trace mocks changes",
default: true
});
mocksServer.onChangeMocks(this._onChangeMocks.bind(this))
}
// ...
}
Administration web user interface, Chrome extension, Web Sockets, etc.
Check the GitHub project to stay up to date on what we are working.