`@cypress/vue@4.0.0` bundle is broken: `@vue/test-utils` is not externalized
See original GitHub issueCurrent behavior
Currently @cypress/vue
(v4) has a dependency:
{
"dependencies": {
"@vue/test-utils": "2.0.0-rc.19"
}
}
But if you explore actual dist/cypress-vue.*.js
files, you will see that Vue Test Utils is not imported, but bundled. The only external import is vue
.
Desired behavior
@cypress/vue
should import @vue/test-utils
, not bundle it.
Test code to reproduce
Bundle bug, not test code.
Cypress Version
10
Other
It is a huge problem because our tests rely heavily on setting global Vue Test Utils configuration to achieve global components registration per spec file. (https://test-utils.vuejs.org/api/#config-global)
For example, we do that trick:
import { config } from '@vue/test-utils'
import { mount } from '@cypress/vue'
before(() => {
config.global.components = { SRadio, SRadioGroup }
})
after(() => {
config.global.components = {}
})
it('just mounts', () => {
cy.mount({ template: `<SRadioGroup />` })
})
Now it doesn’t make any effect because mount()
from @cypress/vue
does not import @vue/test-utils
, i.e. it is broken.
BTW, Cypress 10 is awesome!
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:6 (6 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looking good
Hi! Good point. If we import it, though, it’s an additional peer dependency, which isn’t really ideal.
We’ve got two options:
I think 2 is the best option - this way, you just need to update to the latest
cypress
version, and you’ll get all the updates for free.cypress/vue
is generally running against the latest stable test utils version.This would mean you’d do
Also, if you are on Cypress 10, you don’t even need to install
@cypress/vue
- we bundle it with Cypress, so just import it fromcypress/vue
. The goal is, instead of installing lots of different libraries, you just need to install and update Cypress, and we deal with the rest!What do you think? Open to the first option too, but I think less peer dependencies is generally better for the end user, since you don’t have to mess around with updating everything, just one dependency (cypress).