Skip to content

Commit 1998c53

Browse files
committed
test: skip extended tests in < 2.3
1 parent 3d47913 commit 1998c53

File tree

2 files changed

+42
-38
lines changed

2 files changed

+42
-38
lines changed

test/specs/mounting-options/mocks.spec.js

+20-18
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { createLocalVue, config } from '~vue/test-utils'
22
import Vue from 'vue'
33
import Component from '~resources/components/component.vue'
44
import ComponentWithVuex from '~resources/components/component-with-vuex.vue'
5-
import { describeWithMountingMethods } from '~resources/utils'
6-
import { itDoNotRunIf } from 'conditional-specs'
5+
import { describeWithMountingMethods, vueVersion } from '~resources/utils'
6+
import { itDoNotRunIf, itSkipIf } from 'conditional-specs'
77

88
describeWithMountingMethods('options.mocks', mountingMethod => {
99
let configMocksSave
@@ -42,27 +42,29 @@ describeWithMountingMethods('options.mocks', mountingMethod => {
4242
expect(HTML).contains('http://test.com')
4343
})
4444

45-
it('adds variables to extended components', () => {
46-
const extendedComponent = Vue.extend({
47-
name: 'extended-component'
48-
})
49-
const TestComponent = extendedComponent.extend({
50-
template: `
45+
itSkipIf(
46+
vueVersion < 2.3,
47+
'adds variables to extended components', () => {
48+
const extendedComponent = Vue.extend({
49+
name: 'extended-component'
50+
})
51+
const TestComponent = extendedComponent.extend({
52+
template: `
5153
<div>
5254
{{$route.path}}
5355
</div>
5456
`
55-
})
56-
const $route = { path: 'http://test.com' }
57-
const wrapper = mountingMethod(TestComponent, {
58-
mocks: {
59-
$route
60-
}
61-
})
62-
const HTML =
57+
})
58+
const $route = { path: 'http://test.com' }
59+
const wrapper = mountingMethod(TestComponent, {
60+
mocks: {
61+
$route
62+
}
63+
})
64+
const HTML =
6365
mountingMethod.name === 'renderToString' ? wrapper : wrapper.html()
64-
expect(HTML).contains('http://test.com')
65-
})
66+
expect(HTML).contains('http://test.com')
67+
})
6668

6769
// render returns a string so reactive does not apply
6870
itDoNotRunIf(

test/specs/mounting-options/stubs.spec.js

+22-20
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { createLocalVue, config } from '~vue/test-utils'
66
import { config as serverConfig } from '~vue/server-test-utils'
77
import Vue from 'vue'
88
import { describeWithMountingMethods, vueVersion } from '~resources/utils'
9-
import { itDoNotRunIf } from 'conditional-specs'
9+
import { itDoNotRunIf, itSkipIf } from 'conditional-specs'
1010

1111
describeWithMountingMethods('options.stub', mountingMethod => {
1212
let info
@@ -87,27 +87,29 @@ describeWithMountingMethods('options.stub', mountingMethod => {
8787
})
8888
})
8989

90-
it('overrides components in extended components', () => {
91-
const extendedComponent = Vue.extend({
92-
name: 'extended-component',
93-
components: {
94-
ToStubComponent: {
95-
template: '<span />'
90+
itSkipIf(
91+
vueVersion < 2.3,
92+
'overrides components in extended components', () => {
93+
const extendedComponent = Vue.extend({
94+
name: 'extended-component',
95+
components: {
96+
ToStubComponent: {
97+
template: '<span />'
98+
}
9699
}
97-
}
98-
})
99-
const TestComponent = extendedComponent.extend({
100-
template: `<to-stub-component />`
101-
})
102-
const wrapper = mountingMethod(TestComponent, {
103-
stubs: {
104-
ToStubComponent: { template: '<date />' }
105-
}
106-
})
107-
const HTML =
100+
})
101+
const TestComponent = extendedComponent.extend({
102+
template: `<to-stub-component />`
103+
})
104+
const wrapper = mountingMethod(TestComponent, {
105+
stubs: {
106+
ToStubComponent: { template: '<date />' }
107+
}
108+
})
109+
const HTML =
108110
mountingMethod.name === 'renderToString' ? wrapper : wrapper.html()
109-
expect(HTML).contains('<date')
110-
})
111+
expect(HTML).contains('<date')
112+
})
111113

112114
itDoNotRunIf(
113115
mountingMethod.name === 'shallowMount' ||

0 commit comments

Comments
 (0)