Files
kilocode/packages/kilo-vscode/tests/unit/diff-viewer-css-arch.test.ts
T
Marius c8fd421823 fix(vscode): restore sidebar diff viewer parity with Agent Manager (#9121)
* fix(vscode): restore sidebar diff viewer parity with Agent Manager

The sidebar diff viewer bundle was missing agent-manager-review.css, so
FullScreenDiffView rendered with a broken file tree (no flex layout, no
revert styles) since PR #7455. Co-locate the CSS imports with the
component so every consumer gets them automatically, and wire per-file
revert end-to-end via a shared WorktreeDiffClient used by both the
sidebar provider and the Agent Manager controller.

* fix(cli): skip flaky shell-completion test on Windows CI

The 'shell completion resumes queued loop callers' test relies on shell
process spawn timing that is unreliable on Windows CI and times out at
3s. Every other shell-process test in this file already uses the
existing `unix(...)` helper for the same reason — align this test
with that pattern.
2026-04-17 14:12:19 +02:00

43 lines
1.9 KiB
TypeScript

/**
* Architecture test: FullScreenDiffView CSS co-location.
*
* `FullScreenDiffView` and its children (`FileTree`, etc.) rely on classes
* defined in BOTH `agent-manager.css` and `agent-manager-review.css`. The
* component is shared by multiple webview bundles (sidebar diff viewer,
* agent manager, storybook). Historically, each bundle was responsible for
* importing its own CSS, which led to regressions when someone forgot to
* wire the review stylesheet into a new entry point (see PR #7455 fallout).
*
* Current invariant: `FullScreenDiffView.tsx` imports both stylesheets at the
* top of the file, so any bundle pulling in the component transitively gets
* the styles via esbuild's CSS bundling.
*
* If this test fails, do NOT move the CSS imports elsewhere — fix the
* component file to import the missing stylesheet, or add a new stylesheet
* to the REQUIRED list if you intentionally split the styles.
*/
import { describe, it, expect } from "bun:test"
import fs from "node:fs"
import path from "node:path"
const ROOT = path.resolve(import.meta.dir, "../..")
const FULL_SCREEN_DIFF_VIEW = path.join(ROOT, "webview-ui/agent-manager/FullScreenDiffView.tsx")
const REQUIRED = ["./agent-manager.css", "./agent-manager-review.css"] as const
describe("FullScreenDiffView — CSS co-location", () => {
it("imports every stylesheet required to render correctly", () => {
const src = fs.readFileSync(FULL_SCREEN_DIFF_VIEW, "utf-8")
const missing = REQUIRED.filter((css) => !src.includes(`import "${css}"`))
expect(
missing,
`FullScreenDiffView is missing required CSS imports:\n` +
missing.map((m) => ` - import "${m}"`).join("\n") +
`\n\nAdd them at the top of FullScreenDiffView.tsx. The component is\n` +
`shared by multiple webview bundles (sidebar diff viewer, agent manager,\n` +
`storybook) and every bundle relies on these imports for complete styling.\n`,
).toEqual([])
})
})