Skip to content

[Bug] vitest missing in package.json of testtools #2659

@jasonmacdonald-lgtm

Description

@jasonmacdonald-lgtm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions