Skip to content

Commit c00fe77

Browse files
authored
feat: Bump DOM Testing Library and minimum required version for node (#301)
* Bump node and DTL versions * Update other deps * Update readme to reflect 5.x supports Vue 2 * Update links to point to 5.x
1 parent 181765f commit c00fe77

File tree

7 files changed

+45
-50
lines changed

7 files changed

+45
-50
lines changed

.github/workflows/validate.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
main:
1818
strategy:
1919
matrix:
20-
node: [12, 14, 16]
20+
node: [14, 16]
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: ⬇️ Checkout repo

README.md

+16-21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<div align="center">
2-
<h1>Vue Testing Library</h1>
2+
<h1>Vue Testing Library for Vue 2</h1>
3+
4+
<br />
5+
6+
<p>Vue Testing Library support Vue 2 in its 5.x version range. This means that <strong>any version bump within the 5.x range may include breaking changes</strong>.</p>
7+
8+
<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>
39

410
<br />
511

@@ -15,11 +21,6 @@
1521
<p>Simple and complete Vue.js testing utilities that encourage good testing practices.</p>
1622

1723
<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-
20-
<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>
2324

2425
<br />
2526

@@ -66,17 +67,11 @@
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-
79-
This library has `peerDependencies` listings for `Vue` and
74+
This library has `peerDependencies` listings for `Vue v2` and
8075
`vue-template-compiler`.
8176

8277
You may also be interested in installing `@testing-library/jest-dom` so you can
@@ -258,7 +253,7 @@ instead of filing an issue on GitHub.
258253
[npm-badge]: https://badge.fury.io/js/%40testing-library%2Fvue.svg
259254
[npm]: https://badge.fury.io/js/%40testing-library%2Fvue
260255
[license-badge]: https://img.shields.io/github/license/testing-library/vue-testing-library.svg
261-
[license]: https://github.com/testing-library/vue-testing-library/blob/main/LICENSE
256+
[license]: https://github.com/testing-library/vue-testing-library/blob/5.x/LICENSE
262257
[discord]: https://discord.gg/testing-library
263258
[discord-badge]: https://img.shields.io/discord/723559267868737556.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2&style=flat-square
264259
[jest-dom]: https://github.com/testing-library/jest-dom
@@ -274,11 +269,11 @@ instead of filing an issue on GitHub.
274269
[add-issue-bug]: https://github.com/testing-library/vue-testing-library/issues/new?assignees=&labels=bug&template=bug_report.md&title=
275270
[add-issue]: (https://github.com/testing-library/vue-testing-library/issues/new)
276271

277-
[types-directory]: https://github.com/testing-library/vue-testing-library/blob/main/types
278-
[test-directory]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__
279-
[vuex-example]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__/vuex.js
280-
[vue-router-example]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__/vue-router.js
281-
[vee-validate-example]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__/validate-plugin.js
282-
[vue-i18n-example]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__/translations-vue-i18n.js
283-
[vuetify-example]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__/vuetify.js
272+
[types-directory]: https://github.com/testing-library/vue-testing-library/blob/5.x/types
273+
[test-directory]: https://github.com/testing-library/vue-testing-library/blob/5.x/src/__tests__
274+
[vuex-example]: https://github.com/testing-library/vue-testing-library/blob/5.x/src/__tests__/vuex.js
275+
[vue-router-example]: https://github.com/testing-library/vue-testing-library/blob/5.x/src/__tests__/vue-router.js
276+
[vee-validate-example]: https://github.com/testing-library/vue-testing-library/blob/5.x/src/__tests__/validate-plugin.js
277+
[vue-i18n-example]: https://github.com/testing-library/vue-testing-library/blob/5.x/src/__tests__/translations-vue-i18n.js
278+
[vuetify-example]: https://github.com/testing-library/vue-testing-library/blob/5.x/src/__tests__/vuetify.js
284279
<!-- prettier-ignore-end -->

package.json

+21-20
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
"test": "kcd-scripts test",
1212
"test:update": "npm test -- --updateSnapshot --coverage",
1313
"validate": "kcd-scripts validate",
14-
"typecheck": "dtslint ./types/",
14+
"typecheck": "kcd-scripts typecheck --build types",
1515
"setup": "npm install && npm run validate -s"
1616
},
1717
"engines": {
18-
"node": ">10.18"
18+
"node": ">=14"
1919
},
2020
"files": [
2121
"types/*.d.ts",
@@ -43,32 +43,33 @@
4343
"author": "Daniel Cook",
4444
"license": "MIT",
4545
"dependencies": {
46-
"@babel/runtime": "^7.12.5",
47-
"@testing-library/dom": "^7.26.6",
48-
"@vue/test-utils": "^1.1.0"
46+
"@babel/runtime": "^7.21.0",
47+
"@testing-library/dom": "^9.0.0",
48+
"@vue/test-utils": "^1.3.0"
4949
},
5050
"devDependencies": {
51-
"@babel/plugin-transform-runtime": "^7.11.5",
52-
"@testing-library/jest-dom": "^5.11.6",
53-
"@testing-library/user-event": "^12.1.10",
54-
"@types/estree": "0.0.46",
55-
"@vue/vue2-jest": "^27.0.0-alpha.2",
51+
"@babel/plugin-transform-runtime": "^7.21.0",
52+
"@testing-library/jest-dom": "^5.16.5",
53+
"@testing-library/user-event": "^12",
54+
"@types/estree": "1.0.0",
55+
"@vue/vue2-jest": "^29.2.3",
5656
"apollo-boost": "^0.4.9",
5757
"apollo-cache-inmemory": "^1.6.6",
58-
"axios": "^0.21.1",
59-
"dtslint": "^4.0.5",
60-
"eslint": "^7.13.0",
61-
"eslint-plugin-vue": "^7.6.0",
58+
"axios": "^1.3.4",
59+
"dtslint": "^4.2.1",
60+
"eslint": "^8.35.0",
61+
"eslint-plugin-vue": "^9.9.0",
6262
"graphql": "^15.3.0",
63-
"graphql-tag": "^2.11.0",
64-
"isomorphic-unfetch": "^3.0.0",
65-
"jest-serializer-vue": "^2.0.2",
66-
"kcd-scripts": "^11.1.0",
63+
"graphql-tag": "^2.12.6",
64+
"isomorphic-unfetch": "^3.0.2",
65+
"jest-serializer-vue": "^3.1.0",
66+
"kcd-scripts": "^13.0.0",
6767
"lodash.merge": "^4.6.2",
68-
"msw": "^0.35.0",
68+
"msw": "^1.1",
6969
"portal-vue": "^2.1.7",
7070
"semver": "^7.3.5",
71-
"typescript": "^4.0.5",
71+
"tslint": "^6.1.3",
72+
"typescript": "^4.9",
7273
"vee-validate": "^2.2.15",
7374
"vue": "^2.6.12",
7475
"vue-apollo": "^3.0.4",

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

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

src/__tests__/fetch-axios-mock.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ import {render, fireEvent} from '@testing-library/vue'
44
import Component from './components/Fetch.vue'
55

66
test('mocks an API call when load-greeting is clicked', async () => {
7-
axiosMock.get.mockImplementationOnce(() =>
8-
Promise.resolve({
9-
data: {greeting: 'hello there'},
10-
}),
11-
)
7+
axiosMock.get.mockResolvedValueOnce({
8+
data: {greeting: 'hello there'},
9+
})
1210

1311
const {html, getByText} = render(Component, {props: {url: '/greeting'}})
1412

src/__tests__/hello-world-debug.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable testing-library/no-debug */
1+
/* eslint-disable testing-library/no-debugging-utils */
22
import {render} from '@testing-library/vue'
33
import HelloWorld from './components/HelloWorld'
44

@@ -67,7 +67,7 @@ test('allows same arguments as prettyDOM', () => {
6767

6868
expect(console.log).toHaveBeenCalledTimes(1)
6969
expect(console.log.mock.calls[0]).toMatchInlineSnapshot(`
70-
Array [
70+
[
7171
<div>
7272
...,
7373
]

types/test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export function testInstantiatedRouter() {
165165
eslint
166166
testing-library/prefer-explicit-assert: "off",
167167
testing-library/no-wait-for-empty-callback: "off",
168-
testing-library/no-debug: "off",
168+
testing-library/no-debugging-utils: "off",
169169
testing-library/prefer-screen-queries: "off",
170170
@typescript-eslint/unbound-method: "off",
171171
*/

0 commit comments

Comments
 (0)