Workers SDK Issue Reports

← Back to Dashboard

#5942 vitest isolated runtimes AssertionError when run from vscode extension

Recommendation:KEEP OPEN
Difficulty:easy
Reasoning:

Valid bug with user-provided fix. VSCode Vitest extension runs subset of files; caching logic assumes all files always run.

Suggested Action:

Invite PR from @connorpb or implement fix in pool/index.ts

Analysis Report

Issue Review: cloudflare/workers-sdk#5942

Summary

Vitest crashes with AssertionError when running tests from VSCode extension with isolated runtimes and only a subset of test files expanded.

Findings

  • Created: 2024-05-30
  • Updated: 2025-10-30
  • Version: wrangler 3.57.2, vitest 1.5.0, @cloudflare/vitest-pool-workers 0.3.0 → current (0.12.6)
  • Component: vitest-pool-workers
  • Labels: bug, vitest
  • Comments: 2

Key Evidence

  • Bug occurs when VSCode Vitest extension runs only a subset of test files (only expanded nodes)
  • Root cause: caching logic in pool/index.ts assumes runTests is always called with all test files
  • Reporter provided a fix: add code to initialize Miniflare instances for all test files in the else branch
  • Second user confirmed in Feb 2025 the fix works, offered to create PR
  • Workaround exists: use singleWorker: true

Recommendation

Status: KEEP OPEN

Reasoning: Valid bug with clear root cause and a user-provided fix that has been verified to work. The bug affects VSCode Vitest extension users who want isolated runtimes. Two users confirmed the issue and the fix approach. No PR has been merged to address this.

Action: Invite PR from @connorpb who offered to create one, or implement the suggested fix in pool/index.ts.

Suggested Comment

This issue is still relevant. The fix suggested by the reporter (adding Miniflare instance initialization for all test files) has been verified to work. @connorpb - if you're still interested in creating a PR for this, that would be welcome!

Notes & Feedback (0)

No notes yet.

Add Note