Skip to content

Commit 8d94afd

Browse files
committed
Update readme to reflect 5.x supports Vue 2
1 parent 4d4a8df commit 8d94afd

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

README.md

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div align="center">
2-
<h1>Vue Testing Library</h1>
2+
<h1>Vue Testing Library for Vue 2</h1>
33

44
<br />
55

@@ -15,11 +15,12 @@
1515
<p>Simple and complete Vue.js testing utilities that encourage good testing practices.</p>
1616

1717
<p>Vue Testing Library is a lightweight adapter built on top of <a href="https://github.com/testing-library/dom-testing-library/">DOM Testing Library</a> and <a href="https://github.com/vuejs/vue-test-utils">@vue/test-utils</a>.</p>
18-
19-
18+
2019
<br />
21-
22-
<p>If you're looking for the Vue 3 version of Vue Testing Library, check out the <a href="https://github.com/testing-library/vue-testing-library/tree/next">next</a> branch.</p>
20+
21+
<p>If you're looking for the Vue 3 version of Vue Testing Library, check out the <a href="https://github.com/testing-library/vue-testing-library/tree/main">main</a> branch.</p>
22+
23+
<p>Vue Testing Library support Vue 2 in its 5.x version range. Bear in mind that it means that <strong>any version bump in the 5.x range may include breaking changes</strong>.</p>
2324

2425
<br />
2526

@@ -66,16 +67,10 @@
6667
This module is distributed via `npm` and should be installed as one of your
6768
project's `devDependencies`:
6869

69-
If using Vue 2
7070
```
7171
npm install --save-dev @testing-library/vue@5
7272
```
7373

74-
If using Vue 3
75-
```
76-
npm install --save-dev @testing-library/vue
77-
```
78-
7974
This library has `peerDependencies` listings for `Vue` and
8075
`vue-template-compiler`.
8176

src/__tests__/about-vue-router-mocha.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
/* eslint-disable jest/no-conditional-in-test */
12
import '@testing-library/jest-dom'
23
import {render} from '@testing-library/vue'
4+
import semver from 'semver'
35

46
import About from './components/Router/About.vue'
57

@@ -11,6 +13,10 @@ test('uses require("vue-router").default when require("vue-router") is undefined
1113
})
1214

1315
expect(() => render(About, {routes})).toThrowError(
14-
new TypeError("Cannot read property 'default' of undefined"),
16+
new TypeError(
17+
semver.gte(process.version, '16.0.0')
18+
? "Cannot read properties of undefined (reading 'default')"
19+
: "Cannot read property 'default' of undefined",
20+
),
1521
)
1622
})

0 commit comments

Comments
 (0)