Skip to content

Commit ffba2df

Browse files
authored
chore: upgrade to Jest 27 (#693)
* chore: upgrade to Jest 27 * fix: ESLint config
1 parent 4029441 commit ffba2df

File tree

8 files changed

+27
-24
lines changed

8 files changed

+27
-24
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"is-ci": "^2.0.0",
5050
"jest-in-case": "^1.0.2",
5151
"jest-serializer-ansi": "^1.0.3",
52-
"kcd-scripts": "^7.5.1",
52+
"kcd-scripts": "^11.1.0",
5353
"react": "^17.0.2",
5454
"react-dom": "^17.0.2",
5555
"typescript": "^4.1.2"

src/__tests__/clear.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,6 @@ test('non-inputs/textareas are currently unsupported', () => {
8989
const {element} = setup('<div />')
9090

9191
expect(() => userEvent.clear(element)).toThrowErrorMatchingInlineSnapshot(
92-
`"clear currently only supports input and textarea elements."`,
92+
`clear currently only supports input and textarea elements.`,
9393
)
9494
})

src/__tests__/helpers/utils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable testing-library/no-node-access */
12
import {eventMap} from '@testing-library/dom/dist/event-map'
23
import {isElementType} from '../../utils'
34
// this is pretty helpful:

src/__tests__/hover.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ test('fires non-bubbling events on parents for hover', () => {
7070
userEvent.hover(button)
7171

7272
expect(calls.join('\n')).toMatchInlineSnapshot(`
73-
"BUTTON: pointerover
74-
DIV: pointerover
75-
DIV: pointerenter
76-
BUTTON: pointerenter
77-
BUTTON: mouseover
78-
DIV: mouseover
79-
DIV: mouseenter
80-
BUTTON: mouseenter"
81-
`)
73+
BUTTON: pointerover
74+
DIV: pointerover
75+
DIV: pointerenter
76+
BUTTON: pointerenter
77+
BUTTON: mouseover
78+
DIV: mouseover
79+
DIV: mouseenter
80+
BUTTON: mouseenter
81+
`)
8282
})
8383

8484
test('fires non-bubbling events on parents for unhover', () => {
@@ -112,15 +112,15 @@ test('fires non-bubbling events on parents for unhover', () => {
112112
userEvent.unhover(button)
113113

114114
expect(calls.join('\n')).toMatchInlineSnapshot(`
115-
"BUTTON: pointerout
116-
DIV: pointerout
117-
BUTTON: pointerleave
118-
DIV: pointerleave
119-
BUTTON: mouseout
120-
DIV: mouseout
121-
BUTTON: mouseleave
122-
DIV: mouseleave"
123-
`)
115+
BUTTON: pointerout
116+
DIV: pointerout
117+
BUTTON: pointerleave
118+
DIV: pointerleave
119+
BUTTON: mouseout
120+
DIV: mouseout
121+
BUTTON: mouseleave
122+
DIV: mouseleave
123+
`)
124124
})
125125

126126
test('throws when hovering element with pointer-events set to none', () => {

src/__tests__/paste.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ test('should give error if we are trying to call paste on an invalid element', (
102102
const {element} = setup('<div />')
103103
expect(() => userEvent.paste(element, "I'm only a div :("))
104104
.toThrowErrorMatchingInlineSnapshot(`
105-
"The given DIV element is currently unsupported.
106-
A PR extending this implementation would be very much welcome at https://github.com/testing-library/user-event"
105+
The given DIV element is currently unsupported.
106+
A PR extending this implementation would be very much welcome at https://github.com/testing-library/user-event
107107
`)
108108
})

src/__tests__/type.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ test('should delay the typing when opts.delay is not 0', async () => {
232232

233233
const text = 'Hello, world!'
234234
const delay = 10
235+
// eslint-disable-next-line testing-library/no-await-sync-events
235236
await userEvent.type(element, text, {delay})
236237

237238
expect(onInput).toHaveBeenCalledTimes(text.length)

src/__tests__/upload.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,13 @@ test('throw error if trying to use upload on an invalid element', () => {
242242
expect(() =>
243243
userEvent.upload(elements[0], "I'm only a div :("),
244244
).toThrowErrorMatchingInlineSnapshot(
245-
`"The given DIV element does not accept file uploads"`,
245+
`The given DIV element does not accept file uploads`,
246246
)
247247

248248
expect(() =>
249249
userEvent.upload(elements[1], "I'm a checkbox :("),
250250
).toThrowErrorMatchingInlineSnapshot(
251-
`"The associated INPUT element does not accept file uploads"`,
251+
`The associated INPUT element does not accept file uploads`,
252252
)
253253
})
254254

src/__tests__/utils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable testing-library/no-node-access */
12
import {screen} from '@testing-library/dom'
23
import {isElementType, isVisible} from '../utils'
34
import {setup} from './helpers/utils'

0 commit comments

Comments
 (0)