Skip to content

test(lsp): skip dart integration tests when dart cannot run - #128

Merged
amondnet merged 1 commit into
mainfrom
amondnet/127-dart-skip-guard
Oct 22, 2026
Merged

amondnet merged 1 commit into
mainfrom
amondnet/127-dart-skip-guard

Conversation

@amondnet

@amondnet amondnet commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

packages/lsp/test/integration/dart.integration.test.ts skipped its suite only when Bun.which('dart') returned null. When dart resolves on PATH to a version-manager shim that cannot run (for example mise with no Dart version configured: dart --version prints mise ERROR No version is set for shim: dart and exits 1), the suite ran anyway. The language server exited immediately and all 5 Dart tests failed on expect(status.length).toBeGreaterThan(0).

A new canRunDart() runs Bun.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

  • Add canRunDart() to the Dart integration test and use it for the skip guard.

Scope

Covers only the Dart part of #127. Left out:

Blast radius

Test-only change. Machines with a working Dart SDK still run the suite.

Verification

Bun 1.4.3, macOS:

  • With the broken mise shim, the file reports 2 pass, 9 skip, 0 fail (previously 5 fail).
  • With a fake dart on PATH whose --version succeeds, the suite runs.
  • bun run typecheck for packages/lsp and eslint on the file both pass.

Related issue

Refs #127

Checklist

  • PR title follows Conventional Commits
  • Tests updated; the Dart integration file passes locally (2 pass, 9 skip, 0 fail). Full bun run test is left to CI: the Vue integration tests still fail locally (VueServer and DartServer integration tests fail locally in packages/lsp #127).
  • Lint/format pass (bun run lint)
  • Documentation updated if behavior changed
  • No breaking change, or a BREAKING CHANGE: note is included

Summary by cubic

Fixes the Dart integration test skip guard so the suite skips instead of failing when a dart shim cannot run.

The guard previously only checked that dart resolves on PATH via Bun.which. Version-manager shims (e.g., mise without a configured SDK) resolve but exit non-zero, which made all 5 tests fail. It now runs dart --version and 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.

Turn on auto-fix

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
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/lsp/test/integration/dart.integration.test.ts
@amondnet
amondnet marked this pull request as ready for review October 22, 2026 04:44

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Loading

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This test-only change appears safe to merge.

Summary

The Dart integration suite now checks whether dart --version succeeds instead of only checking whether dart exists on PATH.

  • The Dart integration suite runs only when Dart can start.

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

@amondnet
amondnet merged commit b0a8527 into main Oct 22, 2026
10 checks passed
@amondnet
amondnet deleted the amondnet/127-dart-skip-guard branch October 22, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant