@kubb/plugin-cypress 5.0.9 → 5.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/docs/overview.md +13 -12
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import { Exclude, Group, Include, Output, OutputOptions, Override,
|
|
2
|
+
import { Exclude, Group, Include, Output, OutputOptions, Override, PluginType, Resolver, ResolverPatch, ast } from "kubb/kit";
|
|
3
3
|
import { KubbReactNode } from "kubb/jsx";
|
|
4
4
|
import { ResolverTs } from "@kubb/plugin-ts";
|
|
5
5
|
//#region src/components/Request.d.ts
|
|
@@ -67,7 +67,7 @@ type ResolvedOptions = {
|
|
|
67
67
|
baseURL: Options['baseURL'] | undefined;
|
|
68
68
|
resolver: ResolverCypress;
|
|
69
69
|
};
|
|
70
|
-
type PluginCypress =
|
|
70
|
+
type PluginCypress = PluginType<'plugin-cypress', Options, ResolvedOptions, ResolverCypress>;
|
|
71
71
|
declare global {
|
|
72
72
|
namespace Kubb {
|
|
73
73
|
interface PluginRegistry {
|
package/dist/index.js
CHANGED
package/docs/overview.md
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
# Cypress
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Cypress plugin generates a typed `cy.request()` helper for each operation in your OpenAPI spec.
|
|
4
4
|
|
|
5
5
|
Each helper takes grouped `path`, `query`, `headers`, and `body` parameters named after the spec. It returns the response body typed as `Cypress.Chainable<{Operation}Response>`.
|
|
6
6
|
|
|
7
7
|
## Setup
|
|
8
8
|
|
|
9
9
|
- Add `@kubb/plugin-ts` for the request and response types.
|
|
10
|
-
-
|
|
10
|
+
- Install `cypress` v15 or v16 in the project that runs the tests.
|
|
11
|
+
- Add `"types": ["cypress"]` to the tsconfig that covers the generated files, because the helpers use the global `Cypress` namespace.
|
|
11
12
|
|
|
12
13
|
## Options worth knowing
|
|
13
14
|
|
|
14
|
-
- `baseURL` is prepended to every request.
|
|
15
|
+
- `baseURL` is prepended to every request. Without it, Cypress resolves the path against its own `baseUrl`.
|
|
16
|
+
|
|
17
|
+
See [Options](https://kubb.dev/extensions/kubb-labs/plugin-cypress/options) for every option and its default.
|
|
15
18
|
|
|
16
19
|
## Example
|
|
17
20
|
|
|
21
|
+
The config below writes the helpers to `src/gen/cypress`.
|
|
22
|
+
|
|
18
23
|
```typescript [kubb.config.ts]
|
|
19
24
|
import { defineConfig } from 'kubb/config'
|
|
20
25
|
import { pluginTs } from '@kubb/plugin-ts'
|
|
@@ -30,20 +35,16 @@ export default defineConfig({
|
|
|
30
35
|
})
|
|
31
36
|
```
|
|
32
37
|
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
A test then calls a helper and gets a typed response body. `petId` is an `int64`, which the default adapter types as `bigint`.
|
|
39
|
+
|
|
40
|
+
```typescript [cypress/e2e/pet.cy.ts]
|
|
41
|
+
import { getPetById } from '../../src/gen/cypress/getPetById'
|
|
35
42
|
|
|
36
43
|
describe('Pet API', () => {
|
|
37
44
|
it('returns the pet by id', () => {
|
|
38
45
|
getPetById({ path: { petId: 1n } }).then((pet) => {
|
|
39
|
-
expect(pet.
|
|
46
|
+
expect(pet.name).to.be.a('string')
|
|
40
47
|
})
|
|
41
48
|
})
|
|
42
49
|
})
|
|
43
50
|
```
|
|
44
|
-
|
|
45
|
-
## See also
|
|
46
|
-
|
|
47
|
-
- [Cypress](https://www.cypress.io/)
|
|
48
|
-
- [cy.request()](https://docs.cypress.io/api/commands/request)
|
|
49
|
-
- [@kubb/plugin-ts](https://kubb.dev/extensions/kubb-labs/plugin-ts)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-cypress",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.11",
|
|
4
4
|
"description": "Generate Cypress request commands and e2e test fixtures with Kubb for automated API testing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"code-generation",
|
|
@@ -63,17 +63,17 @@
|
|
|
63
63
|
"registry": "https://registry.npmjs.org/"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@kubb/plugin-ts": "^5.0.
|
|
66
|
+
"@kubb/plugin-ts": "^5.0.11"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@internals/shared": "0.0.0",
|
|
70
70
|
"@internals/utils": "0.0.0",
|
|
71
71
|
"cypress": "^16.1.1",
|
|
72
|
-
"kubb": "^5.
|
|
72
|
+
"kubb": "^5.9.2"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"cypress": "^15.0.0 || ^16.0.0",
|
|
76
|
-
"kubb": "^5.
|
|
76
|
+
"kubb": "^5.9.2"
|
|
77
77
|
},
|
|
78
78
|
"peerDependenciesMeta": {
|
|
79
79
|
"cypress": {
|