Description and expected behavior
The package vitest is imported in the file
|
import { expect } from 'vitest'; |
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):
- ZenStack version:3.1.0
- Database type: Postgresql
- Node.js/Bun version: v24.14.0
- Package manager: [yarn
- test suite: Jest
Additional context
I will submit a PR shortly for this.
Description and expected behavior
The package
vitestis imported in the filezenstack/packages/testtools/src/vitest-ext.ts
Line 2 in ce50d3b
This causes an error for projects that don't use
Vite, but would like to use@zenstackhq/testtoolsin 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 errorCannot find module 'vitest'due to the missing package dependency. This likely is only an issue for projects usingJestinstead ofVite. 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):
Additional context
I will submit a PR shortly for this.