Skip to content

Commit addae98

Browse files
authored
feat: Update deps (#156)
This release comes with an updated version of DOM Testing Library – make sure to check their changelog to see what's new!
1 parent 76cdc70 commit addae98

18 files changed

+4286
-5456
lines changed

.eslintrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ module.exports = {
88
rules: {
99
'no-console': 'off',
1010
'import/no-unresolved': 'off',
11+
12+
'testing-library/no-dom-import': 'off',
13+
'testing-library/prefer-screen-queries': 'off',
14+
'testing-library/no-manual-cleanup': 'off',
1115
},
1216
}

.github/ISSUE_TEMPLATE/bug_report.md

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ assignees: ''
4343
Relevant code or config (if any)
4444

4545
```javascript
46+
4647
```
4748

4849
**Additional context**

package-lock.json

+4,230-5,415
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+19-19
Original file line numberDiff line numberDiff line change
@@ -40,35 +40,35 @@
4040
"author": "Daniel Cook",
4141
"license": "MIT",
4242
"dependencies": {
43-
"@babel/runtime": "^7.9.6",
44-
"@testing-library/dom": "^7.5.7",
45-
"@types/testing-library__vue": "^2.0.1",
46-
"@vue/test-utils": "^1.0.3"
43+
"@babel/runtime": "^7.11.2",
44+
"@testing-library/dom": "^7.24.3",
45+
"@types/testing-library__vue": "^5.0.0",
46+
"@vue/test-utils": "^1.1.0"
4747
},
4848
"devDependencies": {
49-
"@babel/plugin-transform-runtime": "^7.9.6",
50-
"@testing-library/jest-dom": "^5.7.0",
49+
"@babel/plugin-transform-runtime": "^7.11.5",
50+
"@testing-library/jest-dom": "^5.11.4",
5151
"apollo-boost": "^0.4.9",
5252
"apollo-cache-inmemory": "^1.6.6",
53-
"axios": "^0.19.2",
53+
"axios": "^0.20.0",
5454
"eslint-plugin-vue": "^6.2.2",
55-
"graphql": "^15.0.0",
56-
"graphql-tag": "^2.10.3",
55+
"graphql": "^15.3.0",
56+
"graphql-tag": "^2.11.0",
5757
"isomorphic-unfetch": "^3.0.0",
5858
"jest-serializer-vue": "^2.0.2",
59-
"kcd-scripts": "^5.11.1",
59+
"kcd-scripts": "^6.5.1",
6060
"lodash.merge": "^4.6.2",
61-
"msw": "^0.20.5",
61+
"msw": "^0.21.2",
6262
"portal-vue": "^2.1.7",
6363
"vee-validate": "^2.2.15",
64-
"vue": "^2.6.11",
65-
"vue-apollo": "^3.0.3",
66-
"vue-i18n": "^8.17.6",
67-
"vue-jest": "^4.0.0-beta.2",
68-
"vue-router": "^3.1.6",
69-
"vue-template-compiler": "^2.6.11",
70-
"vuetify": "^2.2.28",
71-
"vuex": "^3.4.0"
64+
"vue": "^2.6.12",
65+
"vue-apollo": "^3.0.4",
66+
"vue-i18n": "^8.21.1",
67+
"vue-jest": "^4.0.0-rc.0",
68+
"vue-router": "^3.4.5",
69+
"vue-template-compiler": "^2.6.12",
70+
"vuetify": "^2.3.10",
71+
"vuex": "^3.5.1"
7272
},
7373
"peerDependencies": {
7474
"vue": "^2.6.10",

src/__tests__/axios-mock.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ test('mocks an API call when load-greeting is clicked', async () => {
1616

1717
expect(axiosMock.get).toHaveBeenCalledTimes(1)
1818
expect(axiosMock.get).toHaveBeenCalledWith('/greeting')
19-
getByText('hello there')
19+
expect(getByText('hello there')).toBeInTheDocument()
2020

2121
// You can render component snapshots by using html(). However, bear in mind
2222
// that Snapshot Testing should not be treated as a replacement for regular

src/__tests__/cleanup-throw.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ test('cleanup re-throws errors from async lifecycle hooks', async () => {
55
const err = new Error('foo')
66
render({
77
async mounted() {
8-
await new Promise((resolve, reject) => reject(err))
8+
await new Promise((resolve, reject) => {
9+
reject(err)
10+
})
911
},
1012
template: `<h1>Hello World</h1>`,
1113
})

src/__tests__/debug.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable testing-library/no-debug */
12
import {render} from '@testing-library/vue'
23
import HelloWorld from './components/HelloWorld'
34

src/__tests__/directive.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import Directive from './components/Directive'
88
test('Component with a custom directive', () => {
99
// Do not forget to add the new custom directive to the render function as
1010
// the third parameter.
11-
const {queryByText} = render(Directive, {}, vue =>
11+
const {queryByText, getByText} = render(Directive, {}, vue =>
1212
vue.directive('uppercase', uppercaseDirective),
1313
)
1414

1515
// Test that the text in lower case does not appear in the DOM
1616
expect(queryByText('example text')).not.toBeInTheDocument()
1717

1818
// Test that the text in upper case does appear in the DOM thanks to the directive
19-
expect(queryByText('EXAMPLE TEXT')).toBeInTheDocument()
19+
expect(getByText('EXAMPLE TEXT')).toBeInTheDocument()
2020
})

src/__tests__/disappearance.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ test('waits for the data to be loaded', async () => {
66
const {getByText, queryByText, queryByTestId} = render(Disappearance)
77

88
// Assert initial state
9-
getByText('Loading...')
9+
expect(getByText('Loading...')).toBeInTheDocument()
1010
expect(queryByText(/Loaded this message/)).not.toBeInTheDocument()
1111

1212
// Following line reads as follows:

src/__tests__/form.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@ test('Review form submits', async () => {
3737
const initiallySelectedInput = getByLabelText('Awful')
3838
const ratingSelect = getByLabelText('Wonderful')
3939

40-
expect(initiallySelectedInput.checked).toBe(true)
41-
expect(ratingSelect.checked).toBe(false)
40+
expect(initiallySelectedInput).toBeChecked()
41+
expect(ratingSelect).not.toBeChecked()
4242

4343
await fireEvent.update(ratingSelect)
4444

45-
expect(ratingSelect.checked).toBe(true)
46-
expect(initiallySelectedInput.checked).toBe(false)
45+
expect(ratingSelect).toBeChecked()
46+
expect(initiallySelectedInput).not.toBeChecked()
4747

4848
// Get the Input element by its implicit ARIA role.
4949
const recommendInput = getByRole('checkbox')
5050

51-
expect(recommendInput.checked).toBe(false)
51+
expect(recommendInput).not.toBeChecked()
5252
await fireEvent.update(recommendInput)
53-
expect(recommendInput.checked).toBe(true)
53+
expect(recommendInput).toBeChecked()
5454

5555
// Make sure the submit button is enabled.
5656
expect(submitButton).toBeEnabled()

src/__tests__/functional.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {render} from '@testing-library/vue'
2+
import '@testing-library/jest-dom'
23
import FunctionalSFC from './components/FunctionalSFC'
34

45
const Functional = {
@@ -11,11 +12,11 @@ const Functional = {
1112
test('renders functional component', () => {
1213
const {getByText} = render(Functional)
1314

14-
getByText('Hi!')
15+
expect(getByText('Hi!')).toBeInTheDocument()
1516
})
1617

1718
test('renders functional SFC component', () => {
1819
const {getByText} = render(FunctionalSFC)
1920

20-
getByText('Hi!')
21+
expect(getByText('Hi!')).toBeInTheDocument()
2122
})

src/__tests__/slots.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ test('Card component', () => {
1919
})
2020

2121
// The default slot should render the template above with the scoped prop "content".
22-
getByText('Yay! Scoped content!')
22+
expect(getByText('Yay! Scoped content!')).toBeInTheDocument()
2323

2424
// Instead of the default slot's fallback content.
2525
expect(
2626
queryByText('Nothing used the Scoped content!'),
2727
).not.toBeInTheDocument()
2828

2929
// And the header and footer slots should be rendered with the given templates.
30-
getByText('HEADER')
31-
getByText('FOOTER')
30+
expect(getByText('HEADER')).toBeInTheDocument()
31+
expect(getByText('FOOTER')).toBeInTheDocument()
3232
})

src/__tests__/stopwatch.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import '@testing-library/jest-dom'
22
import {render, waitFor, fireEvent} from '@testing-library/vue'
33
import StopWatch from './components/StopWatch.vue'
44

5-
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
5+
const sleep = ms =>
6+
new Promise(resolve => {
7+
setTimeout(resolve, ms)
8+
})
69

710
test('updates component state', async () => {
811
const {getByTestId, getByText} = render(StopWatch)
@@ -12,11 +15,11 @@ test('updates component state', async () => {
1215

1316
// Assert initial state.
1417
expect(elapsedTime).toHaveTextContent('0ms')
15-
getByText('Start')
18+
expect(getByText('Start')).toBeInTheDocument()
1619

1720
await fireEvent.click(startButton)
1821

19-
getByText('Stop')
22+
expect(getByText('Stop')).toBeInTheDocument()
2023

2124
// Wait for one tick of the event loop.
2225
await waitFor(() => {

src/__tests__/stubs.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import {render} from '@testing-library/vue'
2+
import '@testing-library/jest-dom'
23
import Stubs from './components/Stubs'
34

45
test('Form contains search button', () => {
56
const {getByText} = render(Stubs, {
67
stubs: ['FontAwesomeIcon'],
78
})
8-
getByText('Search now')
9+
expect(getByText('Search now')).toBeInTheDocument()
910
})

src/__tests__/vue-portal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test('portal', async () => {
2121
// wait until PortalVue has removed content from the source element
2222
// and moved it to the target one.
2323
await waitFor(() => {
24-
expect(getByTestId('portal')).toBeEmpty()
24+
expect(getByTestId('portal')).toBeEmptyDOMElement()
2525
})
2626

2727
expect(getByTestId('target')).toHaveTextContent(

src/__tests__/vuetify.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const renderWithVuetify = (component, options, callback) => {
3333
test('should set [data-app] attribute on outer most div', () => {
3434
const {container} = renderWithVuetify(VuetifyDemoComponent)
3535

36-
expect(container.getAttribute('data-app')).toEqual('true')
36+
expect(container).toHaveAttribute('data-app', 'true')
3737
})
3838

3939
test('renders a Vuetify-powered component', async () => {

src/__tests__/within.js

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ test('within() returns an object with all queries bound to the DOM node', () =>
2121
// within() returns queries bound to the provided DOM node, so the following
2222
// assertion passes. Notice how we are not using the getByText() function
2323
// provided by render(), but the one coming from within().
24+
// eslint-disable-next-line testing-library/prefer-explicit-assert
2425
within(divNode).getByText('repeated text')
2526

2627
// Here, proof that there's only one match for the specified text.

src/vue-testing-library.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable testing-library/no-wait-for-empty-callback */
12
import {createLocalVue, mount} from '@vue/test-utils'
23

34
import {

0 commit comments

Comments
 (0)