Skip to content

@effect/vitest compatibility with vite+ #6129

@deadcoder0904

Description

@deadcoder0904

https://viteplus.dev/ uses vite-plus/test instead of vitest. I already adopted it because instead of having oxlint/oxfmt & other deps, I just now have one vp but it gives this error.

Its a bit hard to debug when you want to test using @effect/vitest.

I asked Opus 4.6 & it gave me this:

The issue is a **dual vitest instance** problem. `@effect/vitest` imports from `vitest`,
but the `vp test` runner uses its own internal vitest instance from `vite-plus-test`.

The `describe`/it calls register with one instance while the runner executes from another  so no tests are found.

**What's needed to use `@effect/vitest` exclusively:**

1. **Add `vitest` as an explicit devDependency**
 the pnpm override will resolve it to `@voidzero-dev/vite-plus-test`, ensuring a single instance
2. **Change the test script to `vitest run`** instead of `vp test`
 so the runner and `@effect/vitest` share the same vitest module
This ensures `@effect/vitest` imports the exact same `vitest` that the runner uses.

Concretely, in package.json:
```diff
  "devDependencies": {
    "@effect/vitest": "^0.28.0",
    "bun-types": "^1.3.10",
+   "vitest": "latest",
    "vite-plus": "latest"
  },
```
And the test script:
```diff
-  "vitest": "vp test",
+  "vitest": "vitest run",
```

The pnpm override `"vitest": "npm:@voidzero-dev/vite-plus-test@latest"`
already ensures `vitest` resolves to the vite-plus distribution.

Want me to make these changes
and revert the test files back to `@effect/vitest` imports?

So would love to know how to go about this? Obviously, vite+ is a bit worse DX right now so it might be the reason.

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