question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vitest error with react-querybuilder on tests

See original GitHub issue

Hello everyone! I’m migrating my tests from jest to vitest and one of my Components is a custom implementation of the react-querybuilder.

When I was using jest and version 3.12.1, everything ran fine as allways. Now I seen to have landed on a double header:

  • migrating from jest to vitest
  • migrating ‘react-querybuilder’ from 3.12.1 to 4.1.2

So the error I get when running the tests now is the bellow:

Error: Failed to resolve entry for package "react-querybuilder". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "react-querybuilder". The package may have incorrect main/module/exports specified in its package.json.
 ❯ packageEntryFailure node_modules/vite/dist/node/chunks/dep-0351185a.js:30629:11
 ❯ resolvePackageEntry node_modules/vite/dist/node/chunks/dep-0351185a.js:30625:9
 ❯ tryNodeResolve node_modules/vite/dist/node/chunks/dep-0351185a.js:30440:20
 ❯ Context.resolveId node_modules/vite/dist/node/chunks/dep-0351185a.js:30257:28
 ❯ Object.resolveId node_modules/vite/dist/node/chunks/dep-0351185a.js:36922:55
 ❯ processTicksAndRejections ../../../../../internal/process/task_queues.js:95:5
 ❯ async TransformContext.resolve node_modules/vite/dist/node/chunks/dep-0351185a.js:36721:23
 ❯ async normalizeUrl node_modules/vite/dist/node/chunks/dep-0351185a.js:73692:34
 ❯ async TransformContext.transform node_modules/vite/dist/node/chunks/dep-0351185a.js:73834:57
 ❯ async Object.transform node_modules/vite/dist/node/chunks/dep-0351185a.js:36985:30

Any heading of what might be the issue on this? By the leaning of the error it seem like some mistaken entry got lost on module/exports, but I don’t know exactly what could be.

EQ: @jakeboone02 do you plan on migrating to vitest aswell? I would like to hear your opinion on it since v4.0 is using Vite now.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jakeboone02commented, Jan 31, 2022

Yeah, I’ll close this one since the original issue was resolved in v4.1.3.

1reaction
balboFKcommented, Jan 18, 2022

I’ll take a look at it tomorrow and update the Stackblitz to see if it’s fixed! If it is, i’ll close this one. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

vitest + msw / testing reactQuery (axios) hooks using ...
For v3, you need to call setLogger, which is exported from react-query: https://react-query-v3.tanstack.com/reference/setLogger
Read more >
From Jest to Vitest - Migration and Benchmark
This error comes from react-testing-library and it has to do with js-dom support of vitest. I'm going to look for some resources for...
Read more >
Loading CSS causes error · Issue #486 - GitHub
Describe the bug I created a component in QueryBuilder.tsx by taking the example from the README with some little cleanup.
Read more >
Testing React Query | TkDodo's blog
Let's take a look at how to efficiently test custom useQuery hooks and components using them.
Read more >
Testing | TanStack Query Docs
Testing. React Query works by means of hooks - either the ones we offer or ... When testing we want to suppress network...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found