@kubb/plugin-cypress 5.0.9 → 5.0.10

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 CHANGED
@@ -392,7 +392,7 @@ var compatibility = {
392
392
  };
393
393
  //#endregion
394
394
  //#region package.json
395
- var version = "5.0.9";
395
+ var version = "5.0.10";
396
396
  //#endregion
397
397
  //#region src/resolvers/resolverCypress.ts
398
398
  /**
package/dist/index.js CHANGED
@@ -388,7 +388,7 @@ var compatibility = {
388
388
  };
389
389
  //#endregion
390
390
  //#region package.json
391
- var version = "5.0.9";
391
+ var version = "5.0.10";
392
392
  //#endregion
393
393
  //#region src/resolvers/resolverCypress.ts
394
394
  /**
package/docs/overview.md CHANGED
@@ -1,20 +1,25 @@
1
1
  # Cypress
2
2
 
3
- Generates a typed `cy.request()` helper for each operation in your OpenAPI spec. Your Cypress tests call the API through these helpers, so a call with the wrong parameters fails at compile time instead of at run time.
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
- - The generated helpers need Cypress v13 or higher.
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
- ```typescript [pet.cy.ts]
34
- import { getPetById } from '../src/gen/cypress/getPetById'
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.id).to.eq(1n)
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.9",
3
+ "version": "5.0.10",
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,7 +63,7 @@
63
63
  "registry": "https://registry.npmjs.org/"
64
64
  },
65
65
  "dependencies": {
66
- "@kubb/plugin-ts": "^5.0.9"
66
+ "@kubb/plugin-ts": "^5.0.10"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@internals/shared": "0.0.0",