Skip to content
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

Testing Library User Event Error #243

Closed
6 tasks done
fadi-george opened this issue Dec 21, 2021 · 3 comments
Closed
6 tasks done

Testing Library User Event Error #243

fadi-george opened this issue Dec 21, 2021 · 3 comments
Labels

Comments

@fadi-george
Copy link

fadi-george commented Dec 21, 2021

Describe the bug

Importing or re-exporting and then using user event from '@testing-library/user-event' leads to an error.

Reproduction

Importing:
import user from '@testing-library/user-event'
or re-exporting

export { renderWithProviders as render, userEvent as user };

Then use it in a test:

user.click(someElement)

System Info

System:
    OS: macOS 12.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 151.58 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
    npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm
  Browsers:
    Brave Browser: 96.1.33.106
    Chrome: 96.0.4664.110
    Safari: 15.2
  npmPackages:
    @vitejs/plugin-react-refresh: ^1.3.6 => 1.3.6 
    vite: 2.7.4 => 2.7.4 
    vitest: 0.0.102 => 0.0.102

Used Package Manager

npm

Logs

TypeError: __vite_ssr_import_2__.user.click is not a function

Validations

@wtchnm
Copy link
Contributor

wtchnm commented Dec 21, 2021

It worked by adding @testing-library/user-event to inline deps:

test: {
	deps: {
		inline: ['@testing-library/user-event']
	}
}

@antfu
Copy link
Member

antfu commented Dec 21, 2021

Caused by testing-library/user-event#813

@sheremet-va
Copy link
Member

Should be fixed in 0.0.120

@github-actions github-actions bot locked and limited conversation to collaborators Jun 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants