You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] vitest missing in package.json of testtools #2659
but is not listed as a dependency of the package.json.
This causes an error for projects that don't use Vite, but would like to use @zenstackhq/testtools in their Jest tests. As an example, we would like to use the loadSchema function in our tests to load schemas, but this currently throws the error Cannot find module 'vitest' due to the missing package dependency. This likely is only an issue for projects using Jest instead of Vite. Many older projects will likely be in this position.
While this can be resolved by the project including it as a dependency, this seems like something that should really be handled by the package. It really doesn't make sense for a Jest based project to include vitest. :)
Unfortunately, this only one of many issues we are running into when trying to use Zenstack v3 with a project that uses CommonJS (older project) and Jest.
Environment (please complete the following information):
Sorry, this was my ticket but I posted under the wrong account :)
Looking further into it to make a PR, I'm not sure how exactly you want to handle this, as most of the package deps use catalog, but vitest isn't in the catalog.
Thanks for filing this @jasonmacdonald . The "testtools" package was mainly for internal consumption and currently tightly coupled with vitest. V3's tests are now run against ESM build. I remember having tons of issues trying to get Jest to work with ESM, not sure if recent builds have made it easier ...
I'd like to send a small PR for this: declare vitest as a peer dependency of testtools, with a regression test that checks its runtime imports are all declared.
Activity
jasonmacdonald commentedon May 8, 2026
Sorry, this was my ticket but I posted under the wrong account :)
Looking further into it to make a PR, I'm not sure how exactly you want to handle this, as most of the package deps use catalog, but vitest isn't in the catalog.
ymc9 commentedon May 13, 2026
Thanks for filing this @jasonmacdonald . The "testtools" package was mainly for internal consumption and currently tightly coupled with vitest. V3's tests are now run against ESM build. I remember having tons of issues trying to get Jest to work with ESM, not sure if recent builds have made it easier ...
PR is always much appreciated!
thelastbackspace commentedon Nov 5, 2026
I'd like to send a small PR for this: declare
vitestas a peer dependency of testtools, with a regression test that checks its runtime imports are all declared.ymc9 commentedon Nov 5, 2026
Of course. A PR is much appreciated!
thelastbackspace commentedon Nov 5, 2026
Thanks! It's up as #2909.
ymc9 commentedon Nov 13, 2026
Fixed by #2909, released in v3.10.2:
vitestis now a peer dependency of@zenstackhq/testtools.