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/.

play() API @mockyeah/server

mockyeah.play(suiteName)

suiteName (String|String[]; required) Suite name(s) to mount.

Mounts the specified suite in the suites directory (e.g., ./mockyeah/mySuite/index.js). This behavior may be changed by altering the values in the suite files.

You can also pass an array of suite names, or a single string with comma-separated list of suite names, e.g.:

mockyeah.play('some-custom-suite,some-custom-suite-2');

or:

mockyeah.play(['some-custom-suite', 'some-custom-suite-2']);

Or on the CLI, comma-separated:

$ mockyeah play some-custom-suite,some-custom-suite-2

or space-separated:

$ mockyeah play some-custom-suite some-custom-suite-2

Here is an example of a suite file:

module.exports = [
  [
    'http://example.com/some/service',
    {
      headers: {
        'x-powered-by': 'Express',
        'content-type': 'text/plain; charset=utf-8',
        'content-length': '12'
      },
      status: 200,
      raw: 'Hello world!',
      latency: 57
    }
  ]
];

© 2020 mockyeah, Built with Gatsby