mockyeah

A powerful service mocking, recording, and playback utility.

Notice: These docs are for mockyeah 1.x & above. For legacy mockyeah 0.x, please see https://mockyeah.github.io/mockyeah/.

Suites

mockyeah provides the ability to capture request/responses and play them back later as mock services. While recording, mockyeah proxies all received requests to configured hosts and captures their responses. Suites include: response body, method, headers, status code, latency, and path.

See record, recordStop, and play.

See also our section on the CLI for another way to record and play.

Ad Hoc Suites

Suites can be created manually. This can ease the repetitive setup of multiple services. Here are the steps to creating ad hoc suites:

  1. Create a suite directory (e.g. ./mockyeah/suite-example)

  2. Add one or more files containing, at minimum, the following:

module.exports = [
  [
    '/some/service',
    {
      text: 'Hello world!'
    }
  ]
];
  1. Play your ad hoc suites.
require('@mockyeah/server').play('suite-example');

Or play all:

require('@mockyeah/server').playAll();

That's it!

Dynamic Suites

Without mounting suites explicitly via play or playAll, you can dynamically opt-in to them using our custom HTTP header x-mockyeah-suite, or custom cookie mockyeahSuite, with a value equal to the name of a suite in suitesDir from configuration.


© 2020 mockyeah, Built with Gatsby