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
| Option | Purpose | Default |
|---|---|---|
output | Where files are written: path, mode, barrel, banner, footer. | { path: 'cypress', barrel: { type: 'named' } } |
group | Split output by tag or path: type, name. | None |
baseURL | Base URL prepended to every request. | None |
include | Keep only operations that match. | None |
exclude | Skip operations that match. | [] |
override | Apply different options per pattern. | [] |
resolver | Customize generated names and file paths. | resolverCypress |
macros | Rewrite 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.
| Type | string |
| Required | false |
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)
}