review-followups-4: @vscode/test-electron integration tests (R17)#14
Closed
dmartinochoa wants to merge 1 commit into
Closed
review-followups-4: @vscode/test-electron integration tests (R17)#14dmartinochoa wants to merge 1 commit into
dmartinochoa wants to merge 1 commit into
Conversation
Stacked on review-followups-batch-3 (#13). Boots a real VS Code extension host in CI and verifies the contracts that unit tests can only approximate. Scope deliberately bounded to client-side activation contracts so the suite doesn't depend on Python + pipeline-check[lsp] being installed in CI. Future tests can add an LSP stub if end-to-end diagnostic publishing is worth verifying. Wiring: - .vscode-test.mjs: workspace-folder is test-fixtures/sample-workflow, so `workspaceContains:` activation events fire. - tsconfig.integration.json: compiles src/test/integration/ to out-test/. Inherits the main tsconfig's strict flags; overrides noEmit (the production build is the only no-emit path) and pulls in the mocha + node global types. - tsconfig.json: excludes src/test/integration/ so the main build doesn't try to type-check the mocha suite without mocha globals. - vitest.config.ts: same exclusion so the unit-test suite doesn't pick up mocha-style describe/test files. - package.json: npm run test:integration:compile + test:integration. - ci.yml: Linux-only step `xvfb-run -a npm run test:integration`. Windows / macOS in the matrix still exercise the bundle + smoke + unit suite; the integration suite adds the genuine extension-host contract on top. - .vscodeignore: excludes out-test/, .vscode-test.mjs, tsconfig.integration.json, vitest.config.ts. Test infra never ships in the .vsix. - .gitignore: adds out-test/. (.vscode-test/ was already ignored.) Tests (src/test/integration/activation.test.ts, 5 cases): - Extension is installed and activates. - All six declared commands register (pipelineCheck.restart / showLog / findings.refresh / findings.changeGrouping / goToNextFinding / goToPreviousFinding). - Findings view registers under the activity-bar container (proxied by the auto-generated pipelineCheck.findings.focus command). - Configuration schema exposes every documented setting (serverCommand, serverArgs, severityThreshold, disabledProviders, trace.server). - untrustedWorkspaces capability is "limited" and virtualWorkspaces is false. DevDeps: - @vscode/test-cli, @vscode/test-electron, mocha@^11, @types/mocha. - mocha pinned to ^11 (npm chose mocha@12-beta by default; the beta has unfixed advisories in `diff` and `serialize-javascript`). CI's `npm audit --omit=dev` still returns clean — the remaining dev-only advisories don't reach users. Total: 90 unit tests (unchanged), 5 integration tests. Lint, compile, unit, integration-compile, smoke all green locally. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced May 19, 2026
Member
Author
dmartinochoa
added a commit
that referenced
this pull request
May 19, 2026
…landed - status snapshot: mark v0.1.1, v0.2.0, v1.0.0 as shipped (was 'in flight'); add Post-1.0.0 row pointing at scan-workspace fix, welcome-panel rework, serialize-javascript override, and open PRs - Tests section: integration tests bullet flipped to done with back-ref to R17/PR #14 and the src/test/integration/activation.test.ts surface - C1 / H4 / maintainer-item-4 manual smokes: marked done; v1.0.0 has been live on the marketplace without a regression report, so the hypothesis is moot
6 tasks
dmartinochoa
added a commit
that referenced
this pull request
May 19, 2026
…28) * refactor: extract install + lspState modules from extension.ts extension.ts has been growing a long tail of one-off helpers — the install-in-terminal flow, the clipboard-fallback copier, and the `pipelineCheck.lspReady` context-key setter — all anchored to that file because they read or write vscode-namespace APIs. Each one is small but they collectively obscure the extension's main job (activation orchestration), and none of them were unit-testable while they lived inside the activate() closure. Extract three things: - install.ts: `installInTerminal`, `copyInstallCommandToClipboard`, `PIP_INSTALL_COMMAND`. Both the welcome-panel CTA and the LSP- failure toast now share one implementation per CTA. - lspState.ts: `setLspReady` + the `LSP_READY_CONTEXT_KEY` constant that drives the conditional viewsWelcome entries. Single writer, single key name, single hop to VS Code's setContext channel. - workspaceScan.ts now exports `findScannableFiles` so the unit suite can pin the per-pattern findFiles contract that fences against the nested-brace bug returning. No behaviour change. extension.ts shrinks; the new modules are pure and unit-testable. Follow-up commit wires up the tests. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test: expand coverage to 187 unit + integration tests (was 134) Backstop the recent fixes and add coverage for surfaces that had none. The most load-bearing additions: - findScannableFiles: per-pattern findFiles, dedupe-on-toString, first-seen order. Locks the fence against the nested-brace glob that produced "no scannable files found" returning. - scanWorkspace orchestration: no-workspace path, no-files path, quiet vs notification toasts, openTextDocument-failure counting, user cancellation. Previously only formatSummary had tests. - installInTerminal: opens a terminal, types pip command, asserts addNewLine=false so the user's unactivated venv isn't violated. copyInstallCommandToClipboard: clipboard write + status-bar confirmation TTL. The PIP_INSTALL_COMMAND literal is pinned. - setLspReady: exact setContext payload for both true and false transitions. The conditional viewsWelcome panel rides on this. - registerStatusBar visibility latch: hidden until either a CI candidate file or a pipeline-check diagnostic is observed; non- pipeline-check sources don't flip the latch. - manifest.test.ts: viewsWelcome shape (two gated entries, primary CTAs, no "Copy install command" button), every welcome-link command target declared, workspace-trust capability locked. - Integration: runs the actual pipelineCheck.scanWorkspace command against the fixture workspace so a real VS Code findFiles walks the glob — end-to-end regression fence for the nested-brace bug. Shared infra: the __testStubs__/vscode.ts module gains findFiles, createTerminal, createStatusBarItem, openTextDocument, clipboard, setStatusBarMessage, withProgress, configurable workspaceFolders, and a resetStubState() helper that beforeEach hooks use to keep each test's globalThis observations isolated. 134 → 187 vitest assertions; lint, typecheck, integration typecheck, and bundle all green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(roadmap): reconcile with v1.0.0 release + R17 integration tests landed - status snapshot: mark v0.1.1, v0.2.0, v1.0.0 as shipped (was 'in flight'); add Post-1.0.0 row pointing at scan-workspace fix, welcome-panel rework, serialize-javascript override, and open PRs - Tests section: integration tests bullet flipped to done with back-ref to R17/PR #14 and the src/test/integration/activation.test.ts surface - C1 / H4 / maintainer-item-4 manual smokes: marked done; v1.0.0 has been live on the marketplace without a regression report, so the hypothesis is moot * fix: harden four high-severity activation / scan edge cases 1. LSP crash mid-session no longer leaves the welcome panel showing 'Scan workspace' against a dead server. Subscribe to onDidChangeState so State.Stopped flips pipelineCheck.lspReady back to false; the install-prompt welcome state returns automatically. 2. providerForPath now matches case-insensitively, so a workspace with lowercase 'dockerfile' or 'jenkinsfile' is classified correctly and the disabledProviders middleware can actually silence it. Affects Windows case-preserving filesystems and any user who lowercased the file. Globs themselves stay POSIX-shaped. 3. client.start() is raced against a 30-second timeout. Previously an empty pipelineCheck.serverArgs (or any hung interpreter) left activation pending forever and the welcome panel stuck on the install prompt. On timeout we fire-and-forget client.stop() and surface the standard 'Install in terminal / Open server log' toast. 4. scanWorkspace gates on isLspReady() (new synchronous mirror of the context key) and routes the user toward Install / Restart / Show log via a warning toast when the LSP is down. Previously the scan would openTextDocument every candidate file and complete with a misleading 'scanned N files' toast even though no LSP was alive to produce findings. Quiet mode (scan-on-save) stays silent. Tests: +7 (194 total). Adds coverage for the isLspReady readback, the lowercase/mixed-case provider match, and the LSP-not-ready scan gate (zero counts, no findFiles call, warning toast in noisy mode, silence in quiet mode). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fourth batch from the post-v0.1.1 review. Stacked on #13. Lands R17 — `@vscode/test-electron` integration tests.
Scope is deliberately bounded to client-side activation contracts so CI doesn't need Python + pipeline-check[lsp] installed. Future PRs can add an LSP stub to verify end-to-end diagnostic publishing if it earns its keep.
What changed
New test surface
Wiring
DevDeps
What this catches that unit tests can't
The 5 integration tests verify:
Test plan
Notes
🤖 Generated with Claude Code