Closed towerhe closed 2 years ago
I'm not seeing any code that would instantiate a liveQuery, which makes the error message and trace confusing. Any chance you could reproduce your problem in a fork of this codesandbox or in a public repo?
@dgeb I pushed a test project to https://github.com/towerhe/orbit-vitest.
It can reproduce my problem.
Thanks !
@towerhe thanks for the reproduction! That helped me narrow the issue down to an edge case in the environment check (in which the process
global could be null
instead of undefined
). I've patched this in #937 and will get a patch release out soon.
Incidentally, I was surprised to see the commonjs
dist being used instead of modules
(ESM). I'm new to vite and vitest - is this unexpected to you as well? Can you configure vite to prefer modules
instead of main
?
Fix included in v0.17.2
I am also a newbie of Vue + Vite community. By looking through the doc of vite and vitest, es modules should be used first.
After checking the deps of my project, I found some deps are distrubuted as commonjs modules e.g. @testing-library/vue. This commonjs deps maybe cause vite and vitest to change the resolving policy.
I try to run a test with vitest. It throws an error when creating an instance of MemorySource:
My test codes: