testing-library / testing-library/user-event

import/namespace: Parse errors in imported module '@testing-library/user-event': ',' expected using Vue 2.6.x and @testing-library/vue

Open
#1,170 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs assessment
Dominant language
TypeScript
Stars
2.3k
Forks
258
PR merge metrics
No merged PRs in 30d

Description

Reproduction example

https://codesandbox.io/s/loving-archimedes-vvcdt3

Prerequisites
  1. Setup Vue 2.6.x
  2. Setup @testing-library/vue@5 ->
Expected behavior

No VS code error or import/namespace error appeared

Actual behavior

Error in VSCODE:

Parse errors in imported module '@testing-library/user-event': ',' expected. (6:39)

eslint[import/namespace](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/namespace.md)
User-event version

14.5.1

Environment

Testing Library framework: 14.5.1

JS framework: vue@2.6.14, nuxt@2.15.8

Test environment: "jest": "27.4.5"

JS DOM:

"@testing-library/dom": "^9.3.3",
"@testing-library/jest-dom": "5.16.2",
Additional context
image

I have vue, nuxt, and @testing-library/vue project, and after running:
yarn add --dev @testing-library/user-event

the setup below works in my test running:

import { userEvent as userEventLib } from "@testing-library/user-event";
//....
//....
const userEvent = userEventLib.setup(); // works

However, I can't do build / run the dev due to error in the title above. I'm using VSCODE.
But I can successfully run and simulate the userEvent.paste() call.

Please help how to fix the import error.

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox and reproduce the VS Code import/namespace parse error using the reported Vue, Nuxt, user-event, and ESLint versions. Trace the package import and parser diagnostics to identify the compatibility boundary; done means the reported error no longer appears while the existing userEvent.setup() and paste behavior still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript, nuxt, typescript
Domain
frontend, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.