[vitest-pool-workers] Support @voidzero-dev/vite-plus-test as vitest alternative#13075
[vitest-pool-workers] Support @voidzero-dev/vite-plus-test as vitest alternative#13075
@voidzero-dev/vite-plus-test as vitest alternative#13075Conversation
🦋 Changeset detectedLatest commit: 2ec74bd The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
✅ All changesets look good |
There was a problem hiding this comment.
I'm Bonk, and I've done a quick review of your PR.
Adds support for @voidzero-dev/vite-plus-test as an alternative vitest distribution by extracting the upstream vitest version from @vitest/* deps and allowlisting the package in the setTimeout monkeypatch.
One minor robustness concern:
getUpstreamVitestVersionreturns the raw dependency version string frompeerDependencies/devDependencies. Todayvite-plus-test@0.1.14pins these to exact versions (e.g."@vitest/ui": "4.1.1"), but if a future release uses a range like^4.1.1,semverSatisfieswould receive an invalid version string, silently returnfalse, and emit a spurious compatibility warning. A defensivesemver.coerce()call (or a comment documenting the assumption) would make this more resilient.
|
Review posted successfully on PR #13075. I flagged one minor robustness concern: |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
3ac4c1b to
18553d6
Compare
…alternative - Extract real upstream vitest version from @vitest/* peer/devDependencies in the distribution's package.json instead of using its own version (0.x) - Add vite-plus-test to the setTimeout monkeypatch allowlist so its eager fake-timer initialisation isn't blocked by the global-scope guard
18553d6 to
c86763f
Compare
Support '@voidzero-dev/vite-plus-test' as an alternative to 'vitest'. Fix version compatibility checks and monkeypatch behavior for better integration.
|
Codeowners approval required for this PR:
Show detailed file reviewers |
7009987 to
2ec74bd
Compare
Fixes #13001.
When users run tests via Vite+ (
@voidzero-dev/vite-plus-test) with the recommended pnpm overrides, two things break:Version check rejects
0.1.14—assertCompatibleVitestVersioncompares the distribution's own version (0.1.14) against ourpeerDependencies.vitestconstraint (^4.1.0). Fix: read thebundledVersions.vitestfield from the distribution'spackage.jsonto get the real upstream version (e.g.4.1.1).Disallowed operation called within global scope— vite-plus-test eagerly initialises@sinonjs/fake-timersduring module loading, which callssetTimeout. OurmonkeypatchedSetTimeoutguard blocks this because the call originates from@voidzero-dev/vite-plus-testrather thanvitest. Fix: add@voidzero-dev/vite-plus-testto thefromVitestallowlist regex.Setup required by users
Per vite-plus's bundling docs, users must configure pnpm overrides to alias
vitestto@voidzero-dev/vite-plus-test:{ "pnpm": { "overrides": { "vitest": "npm:@voidzero-dev/vite-plus-test@0.1.14", "@vitest/runner": "npm:@voidzero-dev/vite-plus-test@0.1.14", "@vitest/snapshot": "npm:@voidzero-dev/vite-plus-test@0.1.14" } } }Verified end-to-end in an isolated reproduction project outside the monorepo.
vite-plus@0.1.14+ pnpm overrides. Cannot add a CI fixture because vite-plus requires the recommended pnpm overrides setup, which would mess up the rest of workers-sdk