Skip to content

Test error on @primer/react/lib/drafts/hooks/useCombobox.js #2346

Closed
@hyochan

Description

@hyochan

Description

I am facing a test error after installing the package.

Error: require() of ES Module /Users/hyo/Github/doobooio/dooboo.io/node_modules/@github/combobox-nav/dist/index.js from /Users/hyo/Github/doobooio/dooboo.io/node_modules/@primer/react/lib/drafts/hooks/useCombobox.js not supported.
Instead change the require of index.js in /Users/hyo/Github/doobooio/dooboo.io/node_modules/@primer/react/lib/drafts/hooks/useCombobox.js to a dynamic import() which is available in all CommonJS modules.

Screen Shot 2022-09-19 at 2 29 08 PM

I am currently using vitest. Can I get any clue on the error? I've also tried mocking.

Steps to reproduce

  1. Clone project
    https://github.com/hyochan/react-typescript-vite
    
  2. Install package.
  3. Wrap root with ThemeProvider.
  4. Run test pnpm test.

Version

v35.9.0

Browser

Chrome

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingreact

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions