src/apiSpecs.js
function apiSpecs(options) {
  options = Options.applyDefaultSpecOptions(options)
  if (options.headers) {
    request.defaults.headers.common = Object.assign({}, request.defaults.headers.common, options.headers)
  }
  const api = swaggerSpec.getSpecSync(options.api)
  const operations = swaggerSpec.getAllOperations(api)
  options.fixtures = getJsonFile(options.fixtures)
  describeApi(api, operations, options)
}
function apiSpecs(options) {
  options = Options.applyDefaultSpecOptions(options)
  if (options.headers) {
    request.defaults.headers.common = Object.assign({}, request.defaults.headers.common, options.headers)
  }
  const api = swaggerSpec.getSpecSync(options.api)
  const operations = swaggerSpec.getAllOperations(api)
  options.fixtures = getJsonFile(options.fixtures)
  describeApi(api, operations, options)
}
function apiSpecs ( options ) { options = Options . applyDefaultSpecOptions ( options ) if ( options . headers ) { request . defaults . headers . common = Object . assign ( { } , request . defaults . headers . common , options . headers ) } const api = swaggerSpec . getSpecSync ( options . api ) const operations = swaggerSpec . getAllOperations ( api ) options . fixtures = getJsonFile ( options . fixtures ) describeApi ( api , operations , options ) }
Generates a suite of Mocha test specifications for each of your Swagger api operations.

Both request and response of an operation call are validated for conformity
with your Swagger document.

You'll need to depend on and set up Mocha in your project yourself.

@param {object} options
- `api` path to your Swagger spec, or the loaded spec reference.
- `host` server host + port where your tests will run e.g. `localhost:3453`.
- `specs` path to specs dir, or function to return the set of specs for an operation.
- `maxTimeout` maximum time a test can take to complete.
- `slowTime` time taken before a test is marked slow. Defaults to 1 second.
- `startServer(done)` function called before all tests where you can start your local server.
- `stopServer(done)`function called after all tests where you can stop your local server.
- `fixtures`: path to a yaml file with test fixtures.
- `sortByStatus`: Sort specs by response status, lowest to highest. Defaults to true.
- `prefetch`: path to a yaml file with requests to prefetch values into fixtures before
executing specs, e.g. auth tokens
@return {void}
Generates a suite of Mocha test specifications for each of your Swagger api operations .