Skip to content

feat: Bump DOM Testing Library and minimum required version for node #301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
main:
strategy:
matrix:
node: [12, 14, 16]
node: [14, 16]
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
Expand Down
37 changes: 16 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<div align="center">
<h1>Vue Testing Library</h1>
<h1>Vue Testing Library for Vue 2</h1>

<br />

<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>

<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>

<br />

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

<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>


<br />

<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>

<br />

Expand Down Expand Up @@ -66,17 +67,11 @@
This module is distributed via `npm` and should be installed as one of your
project's `devDependencies`:

If using Vue 2
```
npm install --save-dev @testing-library/vue@5
```

If using Vue 3
```
npm install --save-dev @testing-library/vue
```

This library has `peerDependencies` listings for `Vue` and
This library has `peerDependencies` listings for `Vue v2` and
`vue-template-compiler`.

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

[types-directory]: https://github.com/testing-library/vue-testing-library/blob/main/types
[test-directory]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__
[vuex-example]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__/vuex.js
[vue-router-example]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__/vue-router.js
[vee-validate-example]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__/validate-plugin.js
[vue-i18n-example]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__/translations-vue-i18n.js
[vuetify-example]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__/vuetify.js
[types-directory]: https://github.com/testing-library/vue-testing-library/blob/5.x/types
[test-directory]: https://github.com/testing-library/vue-testing-library/blob/5.x/src/__tests__
[vuex-example]: https://github.com/testing-library/vue-testing-library/blob/5.x/src/__tests__/vuex.js
[vue-router-example]: https://github.com/testing-library/vue-testing-library/blob/5.x/src/__tests__/vue-router.js
[vee-validate-example]: https://github.com/testing-library/vue-testing-library/blob/5.x/src/__tests__/validate-plugin.js
[vue-i18n-example]: https://github.com/testing-library/vue-testing-library/blob/5.x/src/__tests__/translations-vue-i18n.js
[vuetify-example]: https://github.com/testing-library/vue-testing-library/blob/5.x/src/__tests__/vuetify.js
<!-- prettier-ignore-end -->
41 changes: 21 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"test": "kcd-scripts test",
"test:update": "npm test -- --updateSnapshot --coverage",
"validate": "kcd-scripts validate",
"typecheck": "dtslint ./types/",
"typecheck": "kcd-scripts typecheck --build types",
"setup": "npm install && npm run validate -s"
},
"engines": {
"node": ">10.18"
"node": ">=14"
},
"files": [
"types/*.d.ts",
Expand Down Expand Up @@ -43,32 +43,33 @@
"author": "Daniel Cook",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@testing-library/dom": "^7.26.6",
"@vue/test-utils": "^1.1.0"
"@babel/runtime": "^7.21.0",
"@testing-library/dom": "^9.0.0",
"@vue/test-utils": "^1.3.0"
},
"devDependencies": {
"@babel/plugin-transform-runtime": "^7.11.5",
"@testing-library/jest-dom": "^5.11.6",
"@testing-library/user-event": "^12.1.10",
"@types/estree": "0.0.46",
"@vue/vue2-jest": "^27.0.0-alpha.2",
"@babel/plugin-transform-runtime": "^7.21.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/user-event": "^12",
"@types/estree": "1.0.0",
"@vue/vue2-jest": "^29.2.3",
"apollo-boost": "^0.4.9",
"apollo-cache-inmemory": "^1.6.6",
"axios": "^0.21.1",
"dtslint": "^4.0.5",
"eslint": "^7.13.0",
"eslint-plugin-vue": "^7.6.0",
"axios": "^1.3.4",
"dtslint": "^4.2.1",
"eslint": "^8.35.0",
"eslint-plugin-vue": "^9.9.0",
"graphql": "^15.3.0",
"graphql-tag": "^2.11.0",
"isomorphic-unfetch": "^3.0.0",
"jest-serializer-vue": "^2.0.2",
"kcd-scripts": "^11.1.0",
"graphql-tag": "^2.12.6",
"isomorphic-unfetch": "^3.0.2",
"jest-serializer-vue": "^3.1.0",
"kcd-scripts": "^13.0.0",
"lodash.merge": "^4.6.2",
"msw": "^0.35.0",
"msw": "^1.1",
"portal-vue": "^2.1.7",
"semver": "^7.3.5",
"typescript": "^4.0.5",
"tslint": "^6.1.3",
"typescript": "^4.9",
"vee-validate": "^2.2.15",
"vue": "^2.6.12",
"vue-apollo": "^3.0.4",
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/about-vue-router-mocha.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable jest/no-conditional-in-test */
import '@testing-library/jest-dom'
import {render} from '@testing-library/vue'
import semver from 'semver'
Expand Down
8 changes: 3 additions & 5 deletions src/__tests__/fetch-axios-mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import {render, fireEvent} from '@testing-library/vue'
import Component from './components/Fetch.vue'

test('mocks an API call when load-greeting is clicked', async () => {
axiosMock.get.mockImplementationOnce(() =>
Promise.resolve({
data: {greeting: 'hello there'},
}),
)
axiosMock.get.mockResolvedValueOnce({
data: {greeting: 'hello there'},
})

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

Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/hello-world-debug.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable testing-library/no-debug */
/* eslint-disable testing-library/no-debugging-utils */
import {render} from '@testing-library/vue'
import HelloWorld from './components/HelloWorld'

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

expect(console.log).toHaveBeenCalledTimes(1)
expect(console.log.mock.calls[0]).toMatchInlineSnapshot(`
Array [
[
<div>
...,
]
Expand Down
2 changes: 1 addition & 1 deletion types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export function testInstantiatedRouter() {
eslint
testing-library/prefer-explicit-assert: "off",
testing-library/no-wait-for-empty-callback: "off",
testing-library/no-debug: "off",
testing-library/no-debugging-utils: "off",
testing-library/prefer-screen-queries: "off",
@typescript-eslint/unbound-method: "off",
*/