Skip to content

Commit

Permalink
Fix user-event import (fix #16)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickserv committed Aug 22, 2022
1 parent 38de211 commit 8cb1282
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Open a recording and click export to use the Testing Library script option.
* @jest-environment-options { "url": "https://example.com/" }
*/
const { screen, waitFor } = require("@testing-library/dom")
const userEvent = require("@testing-library/user-event")
const { default: userEvent } = require("@testing-library/user-event")
require("@testing-library/jest-dom")

test("Example", async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/fixtures/example.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @jest-environment-options { "url": "https://example.com/" }
*/
const { screen, waitFor } = require("@testing-library/dom")
const userEvent = require("@testing-library/user-event")
const { default: userEvent } = require("@testing-library/user-event")
require("@testing-library/jest-dom")

test("Example", async () => {
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export class Extension implements StringifyExtension {
out.appendLine(
'const { screen, waitFor } = require("@testing-library/dom")',
)
out.appendLine('const userEvent = require("@testing-library/user-event")')
out.appendLine(
'const { default: userEvent } = require("@testing-library/user-event")',
)
out.appendLine('require("@testing-library/jest-dom")')

out.appendLine("")
Expand Down

0 comments on commit 8cb1282

Please sign in to comment.