Skip to content
Cypress

Cypress

Officialv5.0.9

@kubb/plugin-cypress

kubb add plugin-cypress

Options

Pass these options to pluginCypress(). Shared options link to Shared plugin options.

Options overview

OptionPurposeDefault
outputWhere files are written: path, mode, barrel, banner, footer.{ path: 'cypress', barrel: { type: 'named' } }
groupSplit output by tag or path: type, name.None
baseURLBase URL prepended to every request.None
includeKeep only operations that match.None
excludeSkip operations that match.[]
overrideApply different options per pattern.[]
resolverCustomize generated names and file paths.resolverCypress
macrosRewrite AST nodes before printing.[]

resolverCypress adds no namespaces of its own, so a resolver patch uses only the shared name, file and imports members.

Option details

baseURL

Base URL prepended to every request in the generated helpers. When omitted, no host is prepended and each helper uses the operation's relative path from the spec. The host is emitted into each helper's URL, so no runtime host setup is needed.

Typestring
Requiredfalse
baseURL: 'https://staging.petstore.dev'
export function showPetById(
  { path }: ShowPetByIdOptions,
  options: Partial<Cypress.RequestOptions> = {},
): Cypress.Chainable<ShowPetByIdResponse> {
  return cy
    .request<ShowPetByIdResponse>({
      method: 'GET',
      url: `https://staging.petstore.dev/pets/${path.petId}`,
      ...options,
    })
    .then((res) => res.body)
}