Repository navigation
test(lsp): skip dart integration tests when dart cannot run - #128
Conversation
Replace the Bun.which('dart') skip guard with canRunDart(), which runs
`dart --version` and requires exit code 0. A version-manager shim (mise)
can resolve on PATH without being able to run, which made the suite fail
instead of skip.
Refs #127
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Code Review
This pull request updates the Dart integration test to ensure that the Dart SDK is not only present on the PATH but can also execute successfully, addressing issues with unconfigured version-manager shims. It introduces a canRunDart helper function that spawns a subprocess to check the exit code of dart --version. The review feedback suggests optimizing this check by first verifying if the dart executable exists using Bun.which('dart') before spawning the subprocess, thereby avoiding unnecessary process spawning overhead when Dart is completely missing from the PATH.
There was a problem hiding this comment.
No issues found across 1 file
Architecture diagram
sequenceDiagram
participant CI as CI Runner
participant Test as Dart Integration Test
participant PATH as System PATH
participant Dart as Dart Runtime
participant LSP as LSPManager
participant FileSys as Fixture Files
Note over CI,FileSys: Dart Integration Test - Runtime Flow
CI->>Test: run dart.integration.test.ts
Test->>PATH: canRunDart() - spawn "dart --version"
PATH->>Dart: Execute dart binary from PATH
alt Exit code 0 (working Dart)
Dart-->>Test: exitCode = 0
Test->>Test: isDartAvailable = true
Test->>LSP: Start DartServer integration suite
LSP->>FileSys: Read fixture files (lib/main.dart, lib/helper.dart)
FileSys-->>LSP: Return fixture contents
LSP-->>Test: Run 5 integration tests
else Exit code != 0 (shim resolves but fails)
Dart-->>Test: exitCode = 1 (e.g., mise shim error)
Test->>Test: isDartAvailable = false
Test->>Test: skip suite (2 pass, 9 skip, 0 fail)
else Spawn throws (dart not found or cannot execute)
PATH-->>Test: exception thrown
Test->>Test: catch - isDartAvailable = false
Test->>Test: skip suite entirely
end
[Low impact] This test-only change appears safe to merge. SummaryThe Dart integration suite now checks whether
The PR author, amondnet, explicitly excluded production fallback from a broken shim; that behavior is unchanged. Reviews (1) · Last reviewed commit: "test(lsp): skip dart integration tests w..." · Reviewed by Greptile |



Summary
packages/lsp/test/integration/dart.integration.test.tsskipped its suite only whenBun.which('dart')returned null. Whendartresolves on PATH to a version-manager shim that cannot run (for example mise with no Dart version configured:dart --versionprintsmise ERROR No version is set for shim: dartand exits 1), the suite ran anyway. The language server exited immediately and all 5 Dart tests failed onexpect(status.length).toBeGreaterThan(0).A new
canRunDart()runsBun.spawnSync(['dart', '--version'])with output ignored. It returns true only on exit code 0, and false if the spawn throws.describe.skipIf(!isDartAvailable)now uses it.What changed
canRunDart()to the Dart integration test and use it for the skip guard.Scope
Covers only the Dart part of #127. Left out:
src/server/dart.ts:120, which also prefersBun.which('dart')over the auto-downloaded SDK. In production a broken shim would be picked instead of falling back to the download.Blast radius
Test-only change. Machines with a working Dart SDK still run the suite.
Verification
Bun 1.4.3, macOS:
darton PATH whose--versionsucceeds, the suite runs.bun run typecheckfor packages/lsp and eslint on the file both pass.Related issue
Refs #127
Checklist
bun run testis left to CI: the Vue integration tests still fail locally (VueServer and DartServer integration tests fail locally in packages/lsp #127).bun run lint)BREAKING CHANGE:note is includedSummary by cubic
Fixes the Dart integration test skip guard so the suite skips instead of failing when a
dartshim cannot run.The guard previously only checked that
dartresolves on PATH viaBun.which. Version-manager shims (e.g., mise without a configured SDK) resolve but exit non-zero, which made all 5 tests fail. It now runsdart --versionand requires exit code 0.This is a test-only change; machines with a working Dart SDK still run the suite. Refs #127.
Written for commit 46e563e. Summary will update on new commits.