Options#
Options for pluginCypress, with type and default in the table.
| Option | Type | Default | Description |
|---|---|---|---|
output | Output | { path: 'cypress', barrel: { type: 'named' } } | Where the generated files are written and exported |
group | Group | — | Split output into per-tag or per-path folders |
baseURL | string | — | Base URL prepended to every request |
include | Array<Include> | — | Keep only operations that match |
exclude | Array<Exclude> | [] | Skip operations that match |
override | Array<Override> | [] | Apply different options per pattern |
resolver | ResolverPatch<ResolverCypress> | — | Customize generated names and file paths |
macros | Array<Macro> | — | Rewrite AST nodes before printing |
output#
Where the generated .ts files are written and how they are exported.
output.path#
Folder where the plugin writes its files, resolved against the global output.path on defineConfig.
output.mode#
How the plugin consolidates its generated code into files.
'file'writes everything into a single file. Theoutput.pathmust include the file extension (for example'cypress.ts').'directory'writes one file per operation or schema underoutput.path.
Leave it unset and Kubb reads output.path: a name with an extension means one file, anything else a directory.
Important
group works with the inferred directory mode, no mode needed. Set mode: 'directory' yourself only to override the inference, such as a directory name that carries a dot (path: 'clients.v2'). An explicit mode: 'file' still forbids group and stops the build with KUBB_INVALID_PLUGIN_OPTIONS, since a single file has nothing to group.
output.barrel#
output.banner#
output.footer#
group#
group.name#
Function that turns a group key into a folder name, used as the subdirectory under output.path. By default the key is the camelCased tag, or the first path segment for 'path' groups.
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. Set it to point the helpers at a different environment, such as staging or production.
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)
}
include#
exclude#
override#
resolver#
Changes how the plugin names generated files and symbols. Pass a partial patch. Override only the members you want, and anything you omit keeps resolverCypress. See Override a resolver for the this context and how a patch layers over the default.
Tip
Inside a method this is the full resolver, so this.default.name(name) reuses the built-in casing.
type ResolverCypressPatch = {
name?(name: string): string
file?: {
baseName?(params: { name: string; extname: string }): string
path?(params: { baseName: string; output: Output }): string
}
// no extra namespaces
}