cypress 10.3.1 → 10.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. package/lib/exec/open.js +6 -0
  2. package/mount-utils/CHANGELOG.md +0 -1
  3. package/mount-utils/README.md +7 -0
  4. package/package.json +10 -5
  5. package/react/CHANGELOG.md +0 -19
  6. package/react/README.md +28 -323
  7. package/react/dist/createMount.d.ts +30 -0
  8. package/react/dist/cypress-react.cjs.js +59 -78
  9. package/react/dist/cypress-react.esm-bundler.js +51 -74
  10. package/react/dist/getDisplayName.d.ts +1 -1
  11. package/react/dist/index.d.ts +2 -0
  12. package/react/dist/mount.d.ts +5 -141
  13. package/react/dist/types.d.ts +50 -0
  14. package/react/package.json +1 -5
  15. package/react18/dist/cypress-react.cjs.js +422 -0
  16. package/react18/dist/cypress-react.esm-bundler.js +394 -0
  17. package/react18/dist/index.d.ts +5 -0
  18. package/react18/package.json +59 -0
  19. package/types/cypress.d.ts +9 -0
  20. package/types/index.d.ts +1 -1
  21. package/types/{net-stubbing.ts → net-stubbing.d.ts} +0 -0
  22. package/vue/CHANGELOG.md +2 -17
  23. package/vue/README.md +17 -608
  24. package/vue/dist/@vue/test-utils/baseWrapper.d.ts +3 -1
  25. package/vue/dist/@vue/test-utils/config.d.ts +4 -2
  26. package/vue/dist/@vue/test-utils/emit.d.ts +1 -0
  27. package/vue/dist/@vue/test-utils/index.d.ts +2 -1
  28. package/vue/dist/@vue/test-utils/interfaces/wrapperLike.d.ts +2 -2
  29. package/vue/dist/@vue/test-utils/mount.d.ts +2 -0
  30. package/vue/dist/@vue/test-utils/stubs.d.ts +2 -6
  31. package/vue/dist/@vue/test-utils/types.d.ts +1 -1
  32. package/vue/dist/@vue/test-utils/vueWrapper.d.ts +2 -1
  33. package/vue/dist/cypress-vue.cjs.js +5379 -5090
  34. package/vue/dist/cypress-vue.esm-bundler.js +5380 -5091
  35. package/vue/dist/index.d.ts +1 -0
  36. package/vue/package.json +2 -2
  37. package/vue2/README.md +11 -627
  38. package/vue2/dist/cypress-vue2.browser.js +251 -260
  39. package/vue2/dist/cypress-vue2.cjs.js +250 -259
  40. package/vue2/dist/cypress-vue2.esm-bundler.js +248 -257
  41. package/react/dist/cypress-react.browser.js +0 -512
package/vue/README.md CHANGED
@@ -1,87 +1,20 @@
1
1
  # @cypress/vue
2
2
 
3
- [![NPM][npm-icon] ][npm-url]
3
+ Mount Vue components in the open source [Cypress.io](https://www.cypress.io/) test runner **v7.0.0+**
4
4
 
5
- [![semantic-release][semantic-image] ][semantic-url]
6
-
7
- > Browser-based Component Testing for Vue.js with the Open-Source [Cypress.io](https://www.cypress.io/) Test Runner ✌️🌲
8
- >
9
- **✨ New** We're growing the Cypress Community Discord. We have dedicated sections on Component Testing. 👉 [Join now](https://discord.com/invite/TmzTGUW) and let's chat!
10
-
11
- **Jump to:** [Comparison](#comparison), [Blog posts](#blog-posts), Examples: [basic](#basic-examples), [advanced](#advanced-examples), [full](#full-examples), [external](#external-examples), [Code coverage](#code-coverage), [Development](#development)
12
-
13
- ### What is @cypress/vue?
14
- This package allows you to use the [Cypress](https://www.cypress.io/) test runner to mount and test your Vue 3.x components within Cypress. It is built on top of the [Vue Test Utils](https://github.com/vuejs/vue-test-utils) package.
15
-
16
- ![Example component test](images/dynamic.gif)
17
-
18
- ### How is this different from Vue Test Utils?
19
- It uses [Vue Test Utils](https://github.com/vuejs/vue-test-utils) under the hood. This is more of a replacement for node-based testing than it is replacing Vue Test Utils and its API. Instead of running your tests in node (using Jest or Mocha), the Cypress Component Testing Library runs each component in the **real browser** with full power of the Cypress Framework: [live GUI, full API, screen recording, CI support, cross-platform](https://www.cypress.io/features/). One benefit to using Cypress instead of a node-based runner is that limitations of Vue Test Utils in Node (e.g. manually awaiting Vue's internal event loop) are hidden from the user due to Cypress's retry-ability logic.
20
-
21
- - If you like using `@testing-library/vue`, you can use `@testing-library/cypress` for the same `findBy`, `queryBy` commands, see one of the examples in the list below
22
- - If you need to access the underlying Vue Test Utils API, you can do so by importing it: `import { VueTestUtils } from 'cypress/vue'`.
5
+ > **Note:** This package is bundled with the `cypress` package and should not need to be installed separately. See the [Vue Component Testing Docs](https://docs.cypress.io/guides/component-testing/quickstart-vue#Configuring-Component-Testing) for mounting Vue components. Installing and importing `mount` from `@cypress/vue` should only be used for advanced use-cases.
23
6
 
24
7
  ### How is this different from @cypress/vue2?
25
- Cypress packages the current version of Vue under @cypress/vue, and older versions under separate package names. Use [@cypress/vue2](cypress-vue2-npm-url) if you're still using vue@2, and this package if you're on vue@3.
8
+ Cypress packages the current version of Vue under @cypress/vue, and older versions under separate package names. Use [@cypress/vue2](https://github.com/cypress-io/cypress/tree/develop/npm/vue2) if you're still using vue@2, and this package if you're on vue@3.
26
9
 
27
10
  ## Installation
28
11
 
29
12
  - Requires Cypress v7.0.0 or later
30
13
  - Requires [Node](https://nodejs.org/en/) version 12 or above
31
- - Requires Vue 3.x. If you are using Vue 2.x, you want [@cypress/vue2](cypress-vue2-npm-url) instead.
32
- - Supports projects built with Vue CLI, Vite, and Webpack. If you would like us to support another build configuration, please [create an issue](https://github.com/cypress-io/cypress/issues/new?assignees=&labels=npm:%20@cypress/vue&template=3-feature.md).
33
-
34
- Now you are ready to install.
35
-
36
- ### Manual Installation
37
-
38
- Using [@cypress/webpack-dev-server](https://github.com/cypress-io/cypress-webpack-preprocessor#readme) and [vue-loader](https://github.com/vuejs/vue-loader).
39
-
40
- ```js
41
- // cypress/plugins/index.js
42
- const webpack = require('@cypress/webpack-dev-server')
43
- const webpackOptions = {
44
- module: {
45
- rules: [
46
- {
47
- test: /\.vue$/,
48
- loader: 'vue-loader',
49
- },
50
- ],
51
- },
52
- }
53
-
54
- const options = {
55
- // send in the options from your webpack.config.js, so it works the same
56
- // as your app's code
57
- webpackOptions,
58
- watchOptions: {},
59
- }
60
-
61
- module.exports = (on) => {
62
- on('dev-server:start', webpack(options))
63
- }
64
- ```
65
-
66
- Install dev dependencies
67
-
68
- ```shell
69
- npm i -D @cypress/webpack-dev-server @cypress/vue
70
- ```
14
+ - Requires Vue 3.x. If you are using Vue 2.x, you want [@cypress/vue2](https://github.com/cypress-io/cypress/tree/develop/npm/vue2) instead.
71
15
 
72
- And write a test
73
-
74
- ```js
75
- import Hello from '../../components/Hello.vue'
76
- import { mountCallback } from '@cypress/vue'
77
-
78
- describe('Hello.vue', () => {
79
- beforeEach(mountCallback(Hello))
80
-
81
- it('shows hello', () => {
82
- cy.contains('Hello World!')
83
- })
84
- })
16
+ ```sh
17
+ npm i -D @cypress/vue
85
18
  ```
86
19
 
87
20
  ## Usage and Examples
@@ -99,6 +32,8 @@ describe('HelloWorld component', () => {
99
32
  })
100
33
  ```
101
34
 
35
+ Look at the examples in [cypress/component](cypress/component) folder. Here is the list of examples showing various testing scenarios.
36
+
102
37
  ### Options
103
38
 
104
39
  You can pass additional styles, css files and external stylesheets to load, see [docs/styles.md](./docs/styles.md) for full list.
@@ -118,8 +53,6 @@ mount(Todo, {
118
53
  })
119
54
  ```
120
55
 
121
- See examples below for details.
122
-
123
56
  ### Global Vue Options
124
57
 
125
58
  You can pass extensions (global components, mixins, modules to use)
@@ -131,527 +64,20 @@ the `options`.
131
64
  - `mixin` (alias `mixins`) - list of global mixins, see [Mixins](npm/vue/cypress/component/basic/mixins) example
132
65
  - `filters` - hash of global filters, see [Filters](npm/vue/cypress/component/basic/filters) example
133
66
 
134
- ### intro example
135
-
136
- Take a look at the first Vue v2 example:
137
- [Declarative Rendering](https://vuejs.org/v2/guide/#Declarative-Rendering).
138
- The code is pretty simple
139
-
140
- ```html
141
- <div id="app">
142
- {{ message }}
143
- </div>
144
- ```
145
-
146
- ```js
147
- var app = new Vue({
148
- el: '#app',
149
- data() {
150
- return { message: 'Hello Vue!' }
151
- },
152
- })
153
- ```
154
-
155
- It shows the message when running in the browser
156
-
157
- ```
158
- Hello Vue!
159
- ```
160
-
161
- Let's test it in [Cypress.io][cypress.io] (for the current version see
162
- [cypress/integration/spec.js](cypress/integration/spec.js)).
163
-
164
- ```js
165
- import { mountCallback } from '@cypress/vue'
166
-
167
- describe('Declarative rendering', () => {
168
- // Vue code from https://vuejs.org/v2/guide/#Declarative-Rendering
169
- const template = `
170
- <div id="app">
171
- {{ message }}
172
- </div>
173
- `
174
-
175
- const data = {
176
- message: 'Hello Vue!',
177
- }
178
-
179
- // that's all you need to do
180
- beforeEach(mountCallback({ template, data }))
181
-
182
- it('shows hello', () => {
183
- cy.contains('Hello Vue!')
184
- })
185
-
186
- it('changes message if data changes', () => {
187
- // mounted Vue instance is available under Cypress.vue
188
- Cypress.vue.message = 'Vue rocks!'
189
- cy.contains('Vue rocks!')
190
- })
191
- })
192
- ```
193
-
194
- Fire up Cypress test runner and have real browser (Electron, Chrome) load
195
- Vue and mount your test code and be able to interact with the instance through
196
- the reference `Cypress.vue.$data` and via GUI. The full power of the
197
- [Cypress API](https://on.cypress.io/api) is available.
198
-
199
- ![Hello world tested](images/spec.png)
200
-
201
- ### list example
202
-
203
- There is a list example next in the Vue docs.
204
-
205
- ```html
206
- <div id="app-4">
207
- <ol>
208
- <li v-for="todo in todos">
209
- {{ todo.text }}
210
- </li>
211
- </ol>
212
- </div>
213
- ```
214
-
215
- ```js
216
- var app4 = new Vue({
217
- el: '#app-4',
218
- data: {
219
- todos: [
220
- { text: 'Learn JavaScript' },
221
- { text: 'Learn Vue' },
222
- { text: 'Build something awesome' },
223
- ],
224
- },
225
- })
226
- ```
227
-
228
- Let's test it. Simple.
229
-
230
- ```js
231
- import { mountCallback } from '@cypress/vue'
232
-
233
- describe('Declarative rendering', () => {
234
- // List example from https://vuejs.org/v2/guide/#Declarative-Rendering
235
- const template = `
236
- <ol>
237
- <li v-for="todo in todos">
238
- {{ todo.text }}
239
- </li>
240
- </ol>
241
- `
242
-
243
- function data() {
244
- return {
245
- todos: [
246
- { text: 'Learn JavaScript' },
247
- { text: 'Learn Vue' },
248
- { text: 'Build something awesome' },
249
- ],
250
- }
251
- }
252
-
253
- beforeEach(mountCallback({ template, data }))
254
-
255
- it('shows 3 items', () => {
256
- cy.get('li').should('have.length', 3)
257
- })
258
-
259
- it('can add an item', () => {
260
- Cypress.vue.todos.push({ text: 'Test using Cypress' })
261
- cy.get('li').should('have.length', 4)
262
- })
263
- })
264
- ```
265
-
266
- ![List tested](images/list-spec.png)
267
-
268
- ### Handling User Input
269
-
270
- The next section in the Vue docs starts with [reverse message example](https://vuejs.org/v2/guide/#Handling-User-Input).
271
-
272
- ```html
273
- <div id="app-5">
274
- <p>{{ message }}</p>
275
- <button @click="reverseMessage">Reverse Message</button>
276
- </div>
277
- ```
278
-
279
- ```js
280
- var app5 = new Vue({
281
- el: '#app-5',
282
- data: {
283
- message: 'Hello Vue.js!',
284
- },
285
- methods: {
286
- reverseMessage: function () {
287
- this.message = this.message.split('').reverse().join('')
288
- },
289
- },
290
- })
291
- ```
292
-
293
- We can write the test the same way
294
-
295
- ```js
296
- import { mountCallback } from '@cypress/vue'
297
-
298
- describe('Handling User Input', () => {
299
- // Example from https://vuejs.org/v2/guide/#Handling-User-Input
300
- const template = `
301
- <div>
302
- <p>{{ message }}</p>
303
- <button @click="reverseMessage">Reverse Message</button>
304
- </div>
305
- `
306
-
307
- function data() {
308
- return { message: 'Hello Vue.js!' }
309
- }
310
-
311
- const methods = {
312
- reverseMessage: function () {
313
- this.message = this.message.split('').reverse().join('')
314
- },
315
- }
316
-
317
- beforeEach(mountCallback({ template, data, methods }))
318
-
319
- it('reverses text', () => {
320
- cy.contains('Hello Vue')
321
- cy.get('button').click()
322
- cy.contains('!sj.euV olleH')
323
- })
324
- })
325
- ```
326
-
327
- Take a look at the video of the test. When you hover over the `CLICK` step
328
- the test runner is showing _before_ and _after_ DOM snapshots. Not only that,
329
- the application is fully functioning, you can interact with the application
330
- because it is really running!
331
-
332
- ![Reverse input](images/reverse-spec.gif)
333
-
334
- <a name="component-example"/>
335
-
336
- ### Component example
337
-
338
- Let us test a complex example. Let us test a [single file Vue component](https://vuejs.org/v2/guide/single-file-components.html). Here is the [Hello.vue](Hello.vue) file
339
-
340
- ```vue
341
- <template>
342
- <p>{{ greeting }} World!</p>
343
- </template>
344
-
345
- <script>
346
- export default {
347
- data() {
348
- return {
349
- greeting: 'Hello',
350
- }
351
- },
352
- }
353
- </script>
354
-
355
- <style scoped>
356
- p {
357
- font-size: 2em;
358
- text-align: center;
359
- }
360
- </style>
361
- ```
362
-
363
- **note** to learn how to load Vue component files in Cypress, see
364
- [Bundling](#bundling) section.
365
-
366
- Do you want to interact with the component? Go ahead! Do you want
367
- to have multiple components? No problem!
368
-
369
- ```js
370
- import Hello from '../../components/Hello.vue'
371
- import { mountCallback } from '@cypress/vue'
372
- describe('Several components', () => {
373
- const template = `
374
- <div>
375
- <hello></hello>
376
- <hello></hello>
377
- <hello></hello>
378
- </div>
379
- `
380
- const components = {
381
- hello: Hello,
382
- }
383
- beforeEach(mountCallback({ template, components }))
384
-
385
- it('greets the world 3 times', () => {
386
- cy.get('p').should('have.length', 3)
387
- })
388
- })
389
- ```
390
-
391
- ### Spying example
392
-
393
- Button counter component is used in several Vue doc examples
394
-
395
- ```vue
396
- <template>
397
- <button @click="incrementCounter">{{ counter }}</button>
398
- </template>
399
-
400
- <script>
401
- export default {
402
- data() {
403
- return {
404
- counter: 0,
405
- }
406
- },
407
-
408
- methods: {
409
- incrementCounter: function () {
410
- this.counter += 1
411
- this.$emit('increment')
412
- },
413
- },
414
- }
415
- </script>
416
-
417
- <style scoped>
418
- button {
419
- margin: 5px 10px;
420
- padding: 5px 10px;
421
- border-radius: 3px;
422
- }
423
- </style>
424
- ```
425
-
426
- Let us test it - how do we ensure the event is emitted when the button is clicked?
427
- Simple - let us spy on the event, [spying and stubbing is built into Cypress](https://on.cypress.io/stubs-spies-and-clocks)
428
-
429
- ```js
430
- import ButtonCounter from '../../components/ButtonCounter.vue'
431
- import { mountCallback } from '@cypress/vue'
432
-
433
- describe('ButtonCounter', () => {
434
- beforeEach(mountCallback(ButtonCounter))
435
-
436
- it('starts with zero', () => {
437
- cy.contains('button', '0')
438
- })
439
-
440
- it('increments the counter on click', () => {
441
- cy.get('button').click().click().click().contains('3')
442
- })
443
-
444
- it('emits "increment" event on click', () => {
445
- const spy = cy.spy()
446
- Cypress.vue.$on('increment', spy)
447
- cy.get('button')
448
- .click()
449
- .click()
450
- .then(() => {
451
- expect(spy).to.be.calledTwice
452
- })
453
- })
454
- })
455
- ```
456
-
457
- The component is really updating the counter in response to the click
458
- and is emitting an event.
459
-
460
- ![Spying test](images/spy-spec.png)
461
-
462
- [cypress.io]: https://www.cypress.io/
463
-
464
- <a name="xhr-spying-stubbing"/>
465
-
466
- ### XHR spying and stubbing
467
-
468
- The mount function automatically wraps XMLHttpRequest giving you an ability to intercept XHR requests your component might do. For full documentation see [Network Requests](https://on.cypress.io/network-requests). In this repo see [components/AjaxList.vue](components/AjaxList.vue) and the corresponding tests [cypress/integration/ajax-list-spec.js](cypress/integration/ajax-list-spec.js).
469
-
470
- ```js
471
- // component use axios to get list of users
472
- created() {
473
- axios.get(`https://jsonplaceholder.cypress.io/users?_limit=3`)
474
- .then(response => {
475
- // JSON responses are automatically parsed.
476
- this.users = response.data
477
- })
478
- }
479
- // test can observe, return mock data, delay and a lot more
480
- beforeEach(mountCallback(AjaxList))
481
- it('can inspect real data in XHR', () => {
482
- cy.server()
483
- cy.route('/users?_limit=3').as('users')
484
- cy.wait('@users').its('response.body').should('have.length', 3)
485
- })
486
- it('can display mock XHR response', () => {
487
- cy.server()
488
- const users = [{id: 1, name: 'foo'}]
489
- cy.route('GET', '/users?_limit=3', users).as('users')
490
- cy.get('li').should('have.length', 1)
491
- .first().contains('foo')
492
- })
493
- ```
494
-
495
- <a name="spying-window-alert"/>
496
-
497
- ### Spying on `window.alert`
498
-
499
- Calls to `window.alert` are automatically recorded, but do not show up. Instead you can spy on them, see [AlertMessage.vue](components/AlertMessage.vue) and its test [cypress/integration/alert-spec.js](cypress/integration/alert-spec.js)
500
-
501
- ## Comparison
502
-
503
- <!-- prettier-ignore-start -->
504
- Feature | Vue Test Utils or @testing-library/vue | Cypress + `@cypress/vue`
505
- --- | --- | ---
506
- Test runs in real browser | ❌ | ✅
507
- Uses full mount | ❌ | ✅
508
- Test speed | 🏎 | as fast as the app works in the browser
509
- Test can use additional plugins | maybe | use any [Cypress plugin](https://on.cypress.io/plugins)
510
- Test can interact with component | synthetic limited API | use any [Cypress command](https://on.cypress.io/api)
511
- Test can be debugged | via terminal and Node debugger | use browser DevTools
512
- Built-in time traveling debugger | ❌ | Cypress time traveling debugger
513
- Re-run tests on file or test change | ✅ | ✅
514
- Test output on CI | terminal | terminal, screenshots, videos
515
- Tests can be run in parallel | ✅ | ✅ via [parallelization](https://on.cypress.io/parallelization)
516
- Test against interface | if using `@testing-library/vue` | ✅ and can use `@testing-library/cypress`
517
- Spying and mocking | Jest mocks | Sinon library
518
- Code coverage | ✅ | ✅
519
- <!-- prettier-ignore-end -->
520
-
521
- ## Examples
522
-
523
- ```js
524
- // components/HelloWorld.spec.js
525
- import { mount } from '@cypress/vue'
526
- import { HelloWorld } from './HelloWorld.vue'
527
- describe('HelloWorld component', () => {
528
- it('works', () => {
529
- mount(HelloWorld)
530
- // now use standard Cypress commands
531
- cy.contains('Hello World!').should('be.visible')
532
- })
533
- })
534
- ```
535
-
536
- ### Basic examples
537
-
538
- <!-- prettier-ignore-start -->
539
- Spec | Description
540
- --- | ---
541
- [Components](cypress/component/basic/components) | Registers global components to use
542
- [Filters](cypress/component/basic/filters) | Registering global filters
543
- [Hello](cypress/component/basic/hello) | Testing examples from Vue2 cookbook
544
- [Mixins](cypress/component/basic/mixins) | Registering Vue mixins
545
- [Plugins](cypress/component/basic/plugins) | Loading additional plugins
546
- [Props](cypress/component/basic/props) | Pass props to the component during mount
547
- [Slots](cypress/component/basic/slots) | Passing slots and scopedSlots to the component
548
- [Small examples](cypress/component/basic/small-examples) | A few small examples testing forms, buttons
549
- <!-- prettier-ignore-end -->
550
-
551
- ### Advanced examples
552
-
553
- <!-- prettier-ignore-start -->
554
- Spec | Description
555
- --- | ---
556
- [access-component](cypress/component/advanced/access-component) | Access the mounted component directly from test
557
- [i18n](cypress/component/advanced/i18n) | Testing component that uses [Vue I18n](https://kazupon.github.io/vue-i18n/) plugin
558
- [mocking-axios](cypress/component/advanced/mocking-axios) | Mocking 3rd party CommonJS modules like `axios`
559
- [mocking-fetch](cypress/component/advanced/mocking-fetch) | Mocking `window.fetch` to stub responses and test the UI
560
- [fetch-polyfill](ypress/component/advanced/fetch-polyfill) | Using experimental `fetch` polyfill to spy on / stub those Ajax requests using regular Cypress network methods
561
- [mocking-components](cypress/component/advanced/mocking-components) | Mocking locally registered child components during tests
562
- [mocking-imports](cypress/component/advanced/mocking-imports) | Stub ES6 imports from the tests
563
- [render-functions](cypress/component/advanced/render-functions) | Mounting components with a [render function](https://www.tutorialandexample.com/vue-js-render-functions/)
564
- <!-- prettier-ignore-end -->
565
-
566
- ### Full examples
567
-
568
- We have several subfolders in [examples](examples) folder.
569
-
570
- <!-- prettier-ignore-start -->
571
- Folder Name | Description
572
- --- | ---
573
- [cli](examples/cli) | An example app scaffolded using Vue CLI and the component testing added using `vue add cypress-experimental` command.
574
- <!-- prettier-ignore-end -->
575
-
576
- ### External examples
577
-
578
- <!-- prettier-ignore-start -->
579
- Repo | Description
580
- --- | ---
581
- [vue-component-test-example](https://github.com/bahmutov/vue-component-test-example) | Scaffolded Vue CLI v3 project with added component tests, read [Write Your First Vue Component Test](https://glebbahmutov.com/blog/first-vue-component-test/).
582
- <!-- prettier-ignore-end -->
583
-
584
-
585
-
586
- ## Code coverage
587
-
588
- This plugin uses `babel-plugin-istanbul` to automatically instrument `.js` and `.vue` files and generates the code coverage report using dependency [cypress-io/code-coverage](https://github.com/cypress-io/code-coverage) (included). The output reports are saved in the folder "coverage" at the end of the test run.
589
-
590
- If you want to disable code coverage instrumentation and reporting, use `--env coverage=false` or `CYPRESS_coverage=false` or set in your `cypress.json` file
591
-
592
- ```json
593
- {
594
- "env": {
595
- "coverage": false
596
- }
597
- }
598
- ```
599
-
600
- **Note ⚠️:** if the component `.vue` file does not have a `<script>` section, it will not have any code coverage information.
601
-
602
- ## What happened to cypress-vue-unit-test?
603
-
604
- We were in the middle of moving into the Cypress NPM org, so any references to `cypress-vue-unit-test` should be switched to `@cypress/vue`. Once complete, the old repository will be archived.
605
-
606
67
  ## Development
607
68
 
608
- To see all local tests, install dependencies, build the code and open Cypress using the open --component command
609
-
610
- ```sh
611
- yarn install
612
- yarn workspace @cypress/vue build
613
- ```
614
-
615
- The build is done using `rollup`. It bundles all files from [src](src) to the `dist` folder. You can then run component tests by opening Cypress
616
-
617
- ```sh
618
- # cypress open --component
619
- yarn workspace @cypress/vue cy:open
620
- ```
69
+ Run `yarn build` to compile and sync packages to the `cypress` cli package.
621
70
 
622
- Larger tests that use full application and run on CI (see [circle.yml](circle.yml)) are located in the folder [examples](examples).
71
+ Run `yarn cy:open` to open Cypress component testing against real-world examples.
623
72
 
624
- ## Related info
73
+ Run `yarn test` to execute headless Cypress tests.
625
74
 
626
- - [Testing Vue web applications with Vuex data store & REST backend](https://www.cypress.io/blog/2017/11/28/testing-vue-web-application-with-vuex-data-store-and-rest-backend/)
627
- - [Why Cypress?](https://on.cypress.io/why-cypress)
628
- - [Cypress API](https://on.cypress.io/api)
629
- - [Learn TDD in Vue](https://learntdd.in/vue)
630
- - [@cypress/vue vs vue-test-utils](https://codingitwrong.com/2018/03/04/comparing-vue-component-testing-tools.html)
75
+ ## Compatibility
631
76
 
632
- ## Blog posts
633
-
634
- - [Write Your First Vue Component Test](https://glebbahmutov.com/blog/first-vue-component-test/)
635
-
636
- ## Test adapters for other frameworks
637
-
638
- - [@cypress/react](https://github.com/cypress-io/@cypress/react)
639
- - [cypress-cycle-unit-test](https://github.com/bahmutov/cypress-cycle-unit-test)
640
- - [cypress-svelte-unit-test](https://github.com/bahmutov/cypress-svelte-unit-test)
641
- - [@cypress/angular](https://github.com/bahmutov/@cypress/angular)
642
- - [cypress-hyperapp-unit-test](https://github.com/bahmutov/cypress-hyperapp-unit-test)
643
- - [cypress-angularjs-unit-test](https://github.com/bahmutov/cypress-angularjs-unit-test)
644
-
645
- ## Maintainers
646
-
647
- The Cypress.io Component Testing Team
648
-
649
- - [Jessica Sachs](https://github.com/jessicasachs) (Current Maintainer, [Vue Test Utils](https://github.com/vuejs/vue-test-utils) Maintainer)
650
- - [Lachlan Miller](https://github.com/lmiller1990) (Current Maintainer, [Vue Test Utils](https://github.com/vuejs/vue-test-utils) Maintainer)
651
- - [Bart Ledoux](https://github.com/elevatebart) (Current Maintainer, [Vue Styleguidist](https://github.com/vue-styleguidist/vue-styleguidist) Maintainer)
652
- - [Gleb Bahmutov](https://github.com/bahmutov) (Original Author, Current Maintainer of [@cypress/react](https://github.com//cypress-io/@cypress/react))
653
-
654
- Support: if you find any problems with this module, [tweet](https://twitter.com/_jessicasachs) / [open issue](https://github.com/cypress-io/cypress/issues) on Github
77
+ | @cypress/vue | cypress |
78
+ | ------------ | ------- |
79
+ | <= v3 | <= v9 |
80
+ | >= v4 | >= v10 |
655
81
 
656
82
  ## License
657
83
 
@@ -659,21 +85,4 @@ Support: if you find any problems with this module, [tweet](https://twitter.com/
659
85
 
660
86
  This project is licensed under the terms of the [MIT license](/LICENSE).
661
87
 
662
- ## Changelog
663
-
664
- [Changelog](./CHANGELOG.md)
665
-
666
- ## Badges
667
-
668
- Let the world know your project is using Cypress.io to test with this cool badge
669
-
670
- [![Cypress.io](https://img.shields.io/badge/tested%20with-Cypress-04C38E.svg)](https://www.cypress.io/)
671
-
672
- [npm-icon]: https://nodei.co/npm/@cypress/vue.svg?downloads=true
673
- [npm-url]: https://npmjs.org/package/@cypress/vue
674
- [cypress-vue2-npm-url]: https://www.npmjs.com/package/@cypress/vue2
675
- [semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
676
- [semantic-url]: https://github.com/semantic-release/semantic-release
677
- [cypress-badge]: https://img.shields.io/badge/cypress.io-tests-green.svg?style=flat-square
678
- [renovate-badge]: https://img.shields.io/badge/renovate-app-blue.svg
679
- [renovate-app]: https://renovateapp.com/
88
+ ## [Changelog](./CHANGELOG.md)
@@ -1,5 +1,5 @@
1
1
  import type { TriggerOptions } from './createDomEvent';
2
- import { ComponentInternalInstance, ComponentPublicInstance, FunctionalComponent } from 'vue';
2
+ import { ComponentInternalInstance, ComponentOptions, ComponentPublicInstance, ComputedOptions, CreateComponentPublicInstance, FunctionalComponent, MethodOptions } from 'vue';
3
3
  import { DomEventNameWithModifier } from './constants/dom-events';
4
4
  import type { VueWrapper } from './vueWrapper';
5
5
  import { DefinedComponent, FindAllComponentsSelector, FindComponentSelector, NameSelector, RefSelector, VueNode } from './types';
@@ -20,6 +20,8 @@ export default abstract class BaseWrapper<ElementType extends Node> implements W
20
20
  abstract findAll<T extends Element>(selector: string): DOMWrapper<T>[];
21
21
  abstract findAll(selector: string): DOMWrapper<Element>[];
22
22
  findComponent<T extends never>(selector: string): WrapperLike;
23
+ findComponent<Props, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions>(selector: ComponentOptions<Props, RawBindings, D, C, M>): VueWrapper<CreateComponentPublicInstance<Props, RawBindings, D, C, M>>;
24
+ findComponent<T extends ComponentOptions>(selector: string): VueWrapper<T extends ComponentOptions<infer Props, infer RawBindings, infer D, infer C, infer M> ? CreateComponentPublicInstance<Props, RawBindings, D, C, M> : VueWrapper<CreateComponentPublicInstance>>;
23
25
  findComponent<T extends DefinedComponent>(selector: T | Exclude<FindComponentSelector, FunctionalComponent>): VueWrapper<InstanceType<T>>;
24
26
  findComponent<T extends FunctionalComponent>(selector: T): DOMWrapper<Node>;
25
27
  findComponent<T extends FunctionalComponent>(selector: string): DOMWrapper<Element>;