Skip to content

Commit

Permalink
chore: update to vitest v0.24.3
Browse files Browse the repository at this point in the history
We were blocked by vitest-dev/vitest#1978
but thanks to @sheremet-va help (see vitest-dev/vitest#1978 (comment))
we now have a way to use the latest vitest releases.

It turns out that we needed to:
- alias `@vue/compat` to its ESM bundle
- use `Vue.extend` instead of `extend` in the `compat.spec.ts` file, as `extend` is not a named export
  • Loading branch information
cexbrayat committed Oct 20, 2022
1 parent f68ceee commit 33d7c68
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -55,7 +55,7 @@
"unplugin-vue-components": "0.22.8",
"vite": "3.1.8",
"vitepress": "0.22.4",
"vitest": "0.22.1",
"vitest": "0.24.3",
"vue": "3.2.41",
"vue-class-component": "8.0.0-rc.1",
"vue-router": "4.1.5",
Expand Down
35 changes: 26 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/features/compat.spec.ts
Expand Up @@ -3,7 +3,7 @@ import * as mockVue from '@vue/compat'
import { mount } from '../../src'

vi.mock('vue', () => mockVue)
const { configureCompat, extend, defineComponent, h } = mockVue
const { configureCompat, defineComponent, h } = mockVue
// @ts-expect-error @vue/compat does not expose default export in types
const Vue = mockVue.default

Expand Down Expand Up @@ -46,7 +46,7 @@ describe('@vue/compat build', () => {
it('finds components declared with legacy Vue.extend', () => {
configureCompat({ MODE: 3, GLOBAL_EXTEND: 'suppress-warning' })

const LegacyComponent = extend({
const LegacyComponent = Vue.extend({
template: '<div>LEGACY</div>'
})

Expand Down Expand Up @@ -97,7 +97,7 @@ describe('@vue/compat build', () => {
COMPONENT_FUNCTIONAL: 'suppress-warning'
})

const Component = extend({
const Component = Vue.extend({
functional: true,
render: () => h('div', 'test')
})
Expand All @@ -112,7 +112,7 @@ describe('@vue/compat build', () => {
GLOBAL_EXTEND: 'suppress-warning'
})

const Foo = extend({
const Foo = Vue.extend({
name: 'Foo',
template: '<div>original</div>'
})
Expand Down Expand Up @@ -147,7 +147,7 @@ describe('@vue/compat build', () => {
template: '<div>original</div>'
}

const FooStub = extend({ template: '<div>stubbed</div>' })
const FooStub = Vue.extend({ template: '<div>stubbed</div>' })

const Component = {
components: { NamedAsNotFoo: Foo },
Expand All @@ -172,7 +172,7 @@ describe('@vue/compat build', () => {
GLOBAL_MOUNT: 'suppress-warning'
})

const Component = extend({
const Component = Vue.extend({
data() {
return { foo: 'bar' }
},
Expand Down
5 changes: 4 additions & 1 deletion vitest.config.ts
Expand Up @@ -35,6 +35,9 @@ export default defineConfig({
},
resolve: {
extensions: ['.vue', '.js', '.json', '.jsx', '.ts', '.tsx', '.node'],
dedupe: ['vue', '@vue/compat']
dedupe: ['vue', '@vue/compat'],
alias: {
'@vue/compat': '@vue/compat/dist/vue.esm-bundler.js'
}
}
})

0 comments on commit 33d7c68

Please sign in to comment.