Skip to content

test(solid): migrate browser tests onto @solidjs/testing-library, lint-ban render from solid-js/web in tests (#389) - #417

Merged
omridevk merged 1 commit into
mainfrom
fix/389-testing-library-migration
Aug 10, 2026
Merged

omridevk merged 1 commit into
mainfrom
fix/389-testing-library-migration

Conversation

@omridevk

@omridevk omridevk commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Part of epic #409.

Summary

Finishes an interrupted repo-wide migration: browser tests move off hand-rolled render from solid-js/web plus manual disposer arrays, onto @solidjs/testing-library, across apps/conciv and 8 Solid packages (extensions/tanstack, terminal, test-runner, try-it, ui-kit-chat, ui-kit-chat-tools, ui-kit-system, ui-kit-terminal).

Critical finding: cleanup wasn't wired

@solidjs/testing-library only self-registers its afterEach(cleanup) when typeof afterEach === 'function' in global scope (vitest globals: true). This repo does not use vitest globals, so without explicit wiring the migration would have been a silent no-op (or a DOM leak across tests).

Verified directly against the installed package source:

node_modules/.pnpm/@solidjs+testing-library@0.8.10.../dist/index.js:16
if (typeof afterEach === "function") {
  afterEach(cleanup);
}

And with a failing-first regression test (packages/ui-kit-chat/test/solid-cleanup-wiring.browser.test.tsx): with the wiring temporarily removed, the second of two tests that each mount an identically-named button fails with strict mode violation: getByRole('button', ...) resolved to 2 elements — proof the previous test's DOM leaked. With wiring restored, both tests pass.

Fix: shared, explicit setupFiles wiring

  • packages/vitest-config/src/solid-cleanup-setup.ts — afterEach(cleanup), exported as the @conciv/vitest-config/solid-cleanup subpath.
  • packages/vitest-config/src/reporters.ts — new ciTestSolidBrowser() helper: {...ciTest(), setupFiles: ['@conciv/vitest-config/solid-cleanup']}.
  • Every affected package's browser vitest project now uses ciTestSolidBrowser() (or spreads its setupFiles) instead of bare ciTest().
  • @solidjs/testing-library is an optional peerDependency of @conciv/vitest-config (verified pnpm resolves it correctly from each consumer's own devDependency — confirmed empirically per-package, and that packages/extensions/terminal needed no direct devDependency on it at all, since it has no direct import, only the transitive setup file; fallow's dead-dependency check caught that one and it was removed).

Lint: ban the footgun at the source

packages/oxlint-plugin/src/solid-test-render.js — a new filename-gated rule (mirrors tool-card-shell.js's structure) banning render/hydrate imports from solid-js/web in test files, with a failing-first fixture suite under packages/oxlint-plugin/test/fixtures/solid-test-render/ and wired into .oxlintrc.json as conciv/solid-test-render: error.

Two legitimate exemptions (file-level .oxlintrc.json overrides, not rule-level): packages/ui-kit-system/test/dialog-harness.tsx and packages/extensions/terminal/test/reload-replay.browser.test.tsx both mount into a shadow root they create themselves — @solidjs/testing-library's render() mounts into document.body or a supplied container, not an arbitrary shadow root, so these keep solid-js/web's render directly with their own manual disposal.

Test plan

  • pnpm turbo run typecheck for all 11 touched packages — 44 tasks, all green
  • TURBO_CONCURRENCY=1 VITEST_MAX_FORKS=1 pnpm turbo run test --concurrency=1 for all 11 touched packages, 3 foreground batches — all green, zero skips
  • packages/oxlint-plugin own suite (including the new rule's fixtures) — green
  • pnpm lint && pnpm format:check — clean
  • pnpm exec fallow audit --changed-since origin/main --format json --quiet — verdict pass, zero introduced findings (one introduced dead-dependency and one introduced complexity finding were found and fixed during this PR: removed terminal's unneeded direct @solidjs/testing-library devDependency, and split a helper out of the new lint rule to bring cyclomatic complexity under the threshold)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Testing Improvements
    • Standardized Solid component browser tests on Solid Testing Library rendering and automatic cleanup.
    • Added browser-specific test setup to improve isolation between tests.
    • Added coverage validating rendering, hydration, and cleanup behavior.
  • Developer Experience
    • Added linting guidance to flag direct test rendering through Solid’s web renderer.
    • Updated test configurations and tooling across application and extension packages.

…t-ban render from solid-js/web in tests (#389)

Finishes the interrupted repo-wide migration off hand-rolled `render` from
'solid-js/web' plus manual disposer arrays, onto @solidjs/testing-library,
across apps/conciv and 8 Solid packages (extensions/tanstack, terminal,
test-runner, try-it, ui-kit-chat, ui-kit-chat-tools, ui-kit-system,
ui-kit-terminal).

Critical gap found and closed: @solidjs/testing-library only self-registers
its afterEach(cleanup) when `typeof afterEach === 'function'` in global
scope (vitest `globals: true`), which this repo does not use. Verified
against the installed package source
(@solidjs/testing-library/dist/index.js) and by a failing-first regression
test (packages/ui-kit-chat/test/solid-cleanup-wiring.browser.test.tsx) that
fails with a strict-mode "resolved to 2 elements" violation when the
wiring is absent. Wired explicitly via a shared
@conciv/vitest-config/solid-cleanup entry (afterEach(cleanup)) pulled in
through a new ciTestSolidBrowser() helper, consumed by every affected
package's browser vitest project's setupFiles. @solidjs/testing-library is
declared as an optional peerDependency of @conciv/vitest-config so the
setup file's own import resolves without vitest-config forcing the
dependency on non-Solid consumers; each Solid package still carries it as
its own devDependency for its test files' direct imports.

Adds packages/oxlint-plugin/src/solid-test-render.js: a filename-gated
oxlint rule banning `render`/`hydrate` imports from solid-js/web in test
files, mirroring tool-card-shell.js's structure, with a failing-first
fixture suite under test/fixtures/solid-test-render and wired into
.oxlintrc.json. Two legitimate shadow-DOM exemptions
(ui-kit-system/test/dialog-harness.tsx, extensions/terminal/test/reload-replay.browser.test.tsx)
stay on solid-js/web's render directly, since @solidjs/testing-library
mounts into document.body/a supplied container rather than an arbitrary
shadow root.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Browser tests across Conciv and UI packages now use @solidjs/testing-library, with centralized Vitest cleanup. A new Oxlint rule detects direct test imports from solid-js/web.

Changes

Solid browser testing migration

Layer / File(s) Summary
Centralized test infrastructure
packages/vitest-config/*, */vitest.config.ts, */package.json
Added ciTestSolidBrowser() and automatic Testing Library cleanup. Browser projects now use the shared configuration.
Lint enforcement
.oxlintrc.json, packages/oxlint-plugin/*
Added and enabled conciv/solid-test-render. Tests cover forbidden imports, valid imports, and the host fixture exception.
Conciv and extension tests
apps/conciv/test/*, packages/extensions/*/test/*
Replaced manual hosts and disposer registries with Testing Library rendering. Existing core, toast, router, and pane cleanup remains where required.
UI kit tests
packages/ui-kit-*/test/*
Migrated shared view harnesses and browser tests to Testing Library rendering. Removed custom cleanup helpers and retained explicit cleanup for special mounts.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant BrowserTest
  participant SolidTestingLibrary
  participant VitestCleanup
  BrowserTest->>SolidTestingLibrary: render component
  SolidTestingLibrary-->>BrowserTest: return container or unmount
  VitestCleanup->>SolidTestingLibrary: cleanup after each test
  SolidTestingLibrary-->>VitestCleanup: remove rendered mounts
Loading

Possibly related PRs

  • conciv-dev/conciv#348: Modifies overlapping Conciv browser test files for tool-card rendering coverage.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the browser test migration and the new lint rule banning direct Solid web rendering in tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/389-testing-library-migration

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/oxlint-plugin/src/solid-test-render.js`:
- Line 3: Update TEST_FILE in
packages/oxlint-plugin/src/solid-test-render.js:3-3 to match test and standalone
spec files with .ts, .tsx, .js, and .jsx extensions. Add violation fixtures
covering JavaScript or JSX tests and a standalone spec file in
packages/oxlint-plugin/test/solid-test-render.test.ts:14-39.

In `@packages/vitest-config/src/solid-cleanup-setup.ts`:
- Line 2: Declare `@solidjs/testing-library` as a dependency for
`@conciv/extension-terminal` in its package manifest, ensuring the existing
ciTestSolidBrowser() setup can load the imported cleanup symbol from
solid-cleanup-setup.ts before tests run.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 11ae6ed1-bde7-4da2-8c59-851172c10359

📥 Commits

Reviewing files that changed from the base of the PR and between 92ae8c9 and ab54e6a.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (79)
  • .oxlintrc.json
  • apps/conciv/package.json
  • apps/conciv/test/attachment-dispatch.browser.test.tsx
  • apps/conciv/test/attachment-widget.browser.test.tsx
  • apps/conciv/test/chat-pane.browser.test.tsx
  • apps/conciv/test/context-tracker.browser.test.tsx
  • apps/conciv/test/engine-staleness.browser.test.tsx
  • apps/conciv/test/grab-reference.browser.test.tsx
  • apps/conciv/test/helpers/pane-harness.tsx
  • apps/conciv/test/kit-controls.browser.test.tsx
  • apps/conciv/test/launch-actions.browser.test.tsx
  • apps/conciv/test/launch-menu.browser.test.tsx
  • apps/conciv/test/model-selector.browser.test.tsx
  • apps/conciv/test/notices.browser.test.tsx
  • apps/conciv/test/panel-focus-stability.browser.test.tsx
  • apps/conciv/test/session-selector.browser.test.tsx
  • apps/conciv/test/tool-card-dispatch.browser.test.tsx
  • apps/conciv/test/user-turn.browser.test.tsx
  • apps/conciv/vitest.config.ts
  • packages/extensions/tanstack/package.json
  • packages/extensions/tanstack/test/inspector-chip.browser.test.tsx
  • packages/extensions/tanstack/vitest.config.ts
  • packages/extensions/terminal/vitest.config.ts
  • packages/extensions/test-runner/package.json
  • packages/extensions/test-runner/test/test-card.browser.test.tsx
  • packages/extensions/test-runner/vitest.config.ts
  • packages/extensions/try-it/package.json
  • packages/extensions/try-it/test/connect-pane.browser.test.tsx
  • packages/extensions/try-it/vitest.config.ts
  • packages/oxlint-plugin/src/plugin.js
  • packages/oxlint-plugin/src/solid-test-render.js
  • packages/oxlint-plugin/test/fixtures/solid-test-render/clean-testing-library.tsx
  • packages/oxlint-plugin/test/fixtures/solid-test-render/hydrate-violation.tsx
  • packages/oxlint-plugin/test/fixtures/solid-test-render/render-violation.tsx
  • packages/oxlint-plugin/test/fixtures/solid-test-render/test/fixtures/host/main.tsx
  • packages/oxlint-plugin/test/fixtures/solid-test-render/unrelated-import.tsx
  • packages/oxlint-plugin/test/oxlintrc-solid-test-render.json
  • packages/oxlint-plugin/test/solid-test-render.test.ts
  • packages/ui-kit-chat-tools/package.json
  • packages/ui-kit-chat-tools/test/catalog-cards.browser.test.tsx
  • packages/ui-kit-chat-tools/test/mount-view.tsx
  • packages/ui-kit-chat-tools/test/new-tool-projection.browser.test.tsx
  • packages/ui-kit-chat-tools/test/page-tool-cards.browser.test.tsx
  • packages/ui-kit-chat-tools/test/registry-card-declarations.browser.test.tsx
  • packages/ui-kit-chat-tools/vitest.config.ts
  • packages/ui-kit-chat/package.json
  • packages/ui-kit-chat/test/action-bar-copy.browser.test.tsx
  • packages/ui-kit-chat/test/action-row.browser.test.tsx
  • packages/ui-kit-chat/test/card-shell-subtitle.browser.test.tsx
  • packages/ui-kit-chat/test/chip.browser.test.tsx
  • packages/ui-kit-chat/test/collapsible-card-shape.browser.test.tsx
  • packages/ui-kit-chat/test/collapsible-section.browser.test.tsx
  • packages/ui-kit-chat/test/composer-completion.browser.test.tsx
  • packages/ui-kit-chat/test/composer-send-morph.browser.test.tsx
  • packages/ui-kit-chat/test/element-preview.browser.test.tsx
  • packages/ui-kit-chat/test/meta-tool-card-error.browser.test.tsx
  • packages/ui-kit-chat/test/model-selector.browser.test.tsx
  • packages/ui-kit-chat/test/mount-view.tsx
  • packages/ui-kit-chat/test/result-image.browser.test.tsx
  • packages/ui-kit-chat/test/slot-instances.browser.test.tsx
  • packages/ui-kit-chat/test/solid-cleanup-wiring.browser.test.tsx
  • packages/ui-kit-chat/test/status-visual.browser.test.tsx
  • packages/ui-kit-chat/test/thread-auto-scroll.browser.test.tsx
  • packages/ui-kit-chat/test/thread-composition.browser.test.tsx
  • packages/ui-kit-chat/test/thread-hold.browser.test.tsx
  • packages/ui-kit-chat/test/tool-call-card-dispatch.browser.test.tsx
  • packages/ui-kit-chat/vitest.config.ts
  • packages/ui-kit-system/package.json
  • packages/ui-kit-system/test/dialog-harness.tsx
  • packages/ui-kit-system/test/dialog.browser.test.tsx
  • packages/ui-kit-system/test/text-field.browser.test.tsx
  • packages/ui-kit-system/test/tooltip-icon-button.browser.test.tsx
  • packages/ui-kit-system/vitest.config.ts
  • packages/ui-kit-terminal/package.json
  • packages/ui-kit-terminal/test/terminal.test.tsx
  • packages/ui-kit-terminal/vitest.config.ts
  • packages/vitest-config/package.json
  • packages/vitest-config/src/reporters.ts
  • packages/vitest-config/src/solid-cleanup-setup.ts
💤 Files with no reviewable changes (1)
  • apps/conciv/test/engine-staleness.browser.test.tsx

@@ -0,0 +1,46 @@
import {isIdentifier} from './ast-walk.js'

const TEST_FILE = /(^|[\\/])test[\\/].*\.tsx?$|\.test\.tsx?$/

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Match all supported test-file names.

Line 3 does not match .js, .jsx, or standalone .spec.* files. A test such as widget.spec.jsx can therefore import render or hydrate from solid-js/web without a diagnostic.

  • packages/oxlint-plugin/src/solid-test-render.js#L3-L3: include JavaScript, JSX, and .spec suffixes in TEST_FILE.
  • packages/oxlint-plugin/test/solid-test-render.test.ts#L14-L39: add violation fixtures for a JavaScript or JSX test and a standalone spec file.
Proposed matcher update
-const TEST_FILE = /(^|[\\/])test[\\/].*\.tsx?$|\.test\.tsx?$/
+const TEST_FILE = /(^|[\\/])test[\\/].*\.[jt]sx?$|\.(?:test|spec)\.[jt]sx?$/

As per coding guidelines, **/*.{test,spec}.{ts,tsx,js,jsx} is an explicitly supported test-file pattern.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const TEST_FILE = /(^|[\\/])test[\\/].*\.tsx?$|\.test\.tsx?$/
const TEST_FILE = /(^|[\\/])test[\\/].*\.[jt]sx?$|\.(?:test|spec)\.[jt]sx?$/
📍 Affects 2 files
  • packages/oxlint-plugin/src/solid-test-render.js#L3-L3 (this comment)
  • packages/oxlint-plugin/test/solid-test-render.test.ts#L14-L39
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/oxlint-plugin/src/solid-test-render.js` at line 3, Update TEST_FILE
in packages/oxlint-plugin/src/solid-test-render.js:3-3 to match test and
standalone spec files with .ts, .tsx, .js, and .jsx extensions. Add violation
fixtures covering JavaScript or JSX tests and a standalone spec file in
packages/oxlint-plugin/test/solid-test-render.test.ts:14-39.

Source: Coding guidelines

@@ -0,0 +1,4 @@
import {afterEach} from 'vitest'
import {cleanup} from '@solidjs/testing-library'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Expect every Solid browser test package to resolve `@solidjs/testing-library`.
rg -n -C 2 '"`@conciv/vitest-config`"|"`@solidjs/testing-library`"' --glob 'package.json' .
rg -n -C 2 '\bciTestSolidBrowser\s*\(' --glob '*.ts' .

Repository: conciv-dev/conciv

Length of output: 23352


🏁 Script executed:

printf '%s\n' '--- skill files ---'
find .. -iname '*skill*' -o -iname 'AGENTS.md' -o -iname 'CONTRIBUTING.md' | head -80
printf '%s\n' '--- relevant manifests and setup ---'
sed -n '1,140p' packages/vitest-config/package.json
sed -n '1,100p' packages/vitest-config/src/solid-cleanup-setup.ts
sed -n '1,90p' packages/vitest-config/src/reporters.ts
for f in \
  apps/conciv/package.json \
  packages/ui-kit-terminal/package.json \
  packages/ui-kit-chat/package.json \
  packages/ui-kit-chat-tools/package.json \
  packages/ui-kit-system/package.json \
  packages/extensions/try-it/package.json \
  packages/extensions/test-runner/package.json \
  packages/extensions/terminal/package.json \
  packages/extensions/tanstack/package.json; do
  printf '\n--- %s ---\n' "$f"
  cat "$f"
done

Repository: conciv-dev/conciv

Length of output: 36319


🏁 Script executed:

set -euo pipefail
printf '%s\n' '--- skill files ---'
find .. \( -iname '*skill*' -o -name 'AGENTS.md' -o -name 'CONTRIBUTING.md' \) -print | head -80
printf '%s\n' '--- relevant manifests and setup ---'
sed -n '1,140p' packages/vitest-config/package.json
sed -n '1,100p' packages/vitest-config/src/solid-cleanup-setup.ts
sed -n '1,90p' packages/vitest-config/src/reporters.ts
for f in \
  apps/conciv/package.json \
  packages/ui-kit-terminal/package.json \
  packages/ui-kit-chat/package.json \
  packages/ui-kit-chat-tools/package.json \
  packages/ui-kit-system/package.json \
  packages/extensions/try-it/package.json \
  packages/extensions/test-runner/package.json \
  packages/extensions/terminal/package.json \
  packages/extensions/tanstack/package.json; do
  printf '\n--- %s ---\n' "$f"
  cat "$f"
done

Repository: conciv-dev/conciv

Length of output: 10317


🏁 Script executed:

python3 - <<'PY'
import json
import pathlib
import re

root = pathlib.Path('.')
config = json.loads((root / 'packages/vitest-config/package.json').read_text())
peer = '`@solidjs/testing-library`'
print('optional_peer:', config.get('peerDependenciesMeta', {}).get(peer, {}).get('optional'))
print('peer_range:', config.get('peerDependencies', {}).get(peer))

calls = []
for path in root.rglob('*.ts'):
    text = path.read_text(errors='replace')
    if re.search(r'\bciTestSolidBrowser\s*\(', text):
        calls.append(path)

for path in sorted(calls):
    manifest = path.parent
    while manifest != root and not (manifest / 'package.json').exists():
        manifest = manifest.parent
    data = json.loads((manifest / 'package.json').read_text()) if (manifest / 'package.json').exists() else {}
    deps = {}
    for group in ('dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies'):
        if peer in data.get(group, {}):
            deps[peer] = group
    print(f'{path}: manifest={manifest / "package.json"} {deps or "MISSING"}')
PY
printf '%s\n' '--- setup resolution and config export ---'
rg -n -C 5 'solid-cleanup|SOLID_CLEANUP_SETUP_ENTRY|setupFiles|from .solid-cleanup' packages/vitest-config/src packages/vitest-config/package.json

Repository: conciv-dev/conciv

Length of output: 3633


🏁 Script executed:

set -euo pipefail
printf '%s\n' '--- repository guidance ---'
cat AGENTS.md
printf '%s\n' '--- review skill ---'
cat .claude/skills/conciv-review/SKILL.md
printf '%s\n' '--- code-review skill ---'
cat .github/skills/code-review/SKILL.md

Repository: conciv-dev/conciv

Length of output: 32697


🏁 Script executed:

set -euo pipefail
pnpm dlx `@tanstack/intent`@latest list

Repository: conciv-dev/conciv

Length of output: 1919


Declare @solidjs/testing-library for @conciv/extension-terminal.

packages/extensions/terminal/vitest.config.ts calls ciTestSolidBrowser(), but its manifest does not declare @solidjs/testing-library. The setup file imports this optional peer at load time, so Vitest can fail before tests run.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/vitest-config/src/solid-cleanup-setup.ts` at line 2, Declare
`@solidjs/testing-library` as a dependency for `@conciv/extension-terminal` in its
package manifest, ensuring the existing ciTestSolidBrowser() setup can load the
imported cleanup symbol from solid-cleanup-setup.ts before tests run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Migrates Solid browser tests to Solid Testing Library, adds explicit cleanup wiring, and prevents regressions through linting.

Changes:

  • Adds shared afterEach(cleanup) browser-test configuration.
  • Migrates tests away from manual Solid render disposal.
  • Adds and tests a lint rule banning direct Solid web rendering in tests.

Reviewed changes

Copilot reviewed 79 out of 80 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pnpm-lock.yaml Records testing-library dependencies.
packages/vitest-config/src/solid-cleanup-setup.ts Registers Solid cleanup.
packages/vitest-config/src/reporters.ts Adds browser-test configuration helper.
packages/vitest-config/package.json Exports cleanup setup and peers.
packages/ui-kit-terminal/vitest.config.ts Enables shared cleanup.
packages/ui-kit-terminal/test/terminal.test.tsx Migrates terminal rendering.
packages/ui-kit-terminal/package.json Adds testing-library dependency.
packages/ui-kit-system/vitest.config.ts Enables shared cleanup.
packages/ui-kit-system/test/tooltip-icon-button.browser.test.tsx Removes manual disposal.
packages/ui-kit-system/test/text-field.browser.test.tsx Migrates text-field rendering.
packages/ui-kit-system/test/dialog.browser.test.tsx Migrates dialog rendering.
packages/ui-kit-system/test/dialog-harness.tsx Updates regular and shadow mounts.
packages/ui-kit-system/package.json Adds testing-library dependency.
packages/ui-kit-chat/vitest.config.ts Enables shared cleanup.
packages/ui-kit-chat/test/tool-call-card-dispatch.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat/test/thread-hold.browser.test.tsx Migrates thread harness.
packages/ui-kit-chat/test/thread-composition.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat/test/thread-auto-scroll.browser.test.tsx Migrates scroll harness.
packages/ui-kit-chat/test/status-visual.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat/test/solid-cleanup-wiring.browser.test.tsx Verifies test isolation.
packages/ui-kit-chat/test/slot-instances.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat/test/result-image.browser.test.tsx Migrates image rendering.
packages/ui-kit-chat/test/mount-view.tsx Uses testing-library rendering.
packages/ui-kit-chat/test/model-selector.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat/test/meta-tool-card-error.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat/test/element-preview.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat/test/composer-send-morph.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat/test/composer-completion.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat/test/collapsible-section.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat/test/collapsible-card-shape.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat/test/chip.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat/test/card-shell-subtitle.browser.test.tsx Migrates card rendering.
packages/ui-kit-chat/test/action-row.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat/test/action-bar-copy.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat/package.json Adds testing-library dependency.
packages/ui-kit-chat-tools/vitest.config.ts Wires shared cleanup setup.
packages/ui-kit-chat-tools/test/registry-card-declarations.browser.test.tsx Uses centralized cleanup.
packages/ui-kit-chat-tools/test/page-tool-cards.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat-tools/test/new-tool-projection.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat-tools/test/mount-view.tsx Uses testing-library rendering.
packages/ui-kit-chat-tools/test/catalog-cards.browser.test.tsx Removes local cleanup.
packages/ui-kit-chat-tools/package.json Adds testing-library dependency.
packages/oxlint-plugin/test/solid-test-render.test.ts Tests the new lint rule.
packages/oxlint-plugin/test/oxlintrc-solid-test-render.json Configures lint fixtures.
packages/oxlint-plugin/test/fixtures/solid-test-render/unrelated-import.tsx Covers allowed imports.
packages/oxlint-plugin/test/fixtures/solid-test-render/test/fixtures/host/main.tsx Covers host exemption.
packages/oxlint-plugin/test/fixtures/solid-test-render/render-violation.tsx Covers forbidden render.
packages/oxlint-plugin/test/fixtures/solid-test-render/hydrate-violation.tsx Covers forbidden hydration.
packages/oxlint-plugin/test/fixtures/solid-test-render/clean-testing-library.tsx Covers valid rendering.
packages/oxlint-plugin/src/solid-test-render.js Implements the lint rule.
packages/oxlint-plugin/src/plugin.js Registers the lint rule.
packages/extensions/try-it/vitest.config.ts Enables shared cleanup.
packages/extensions/try-it/test/connect-pane.browser.test.tsx Migrates pane rendering.
packages/extensions/try-it/package.json Adds testing-library dependency.
packages/extensions/test-runner/vitest.config.ts Enables shared cleanup.
packages/extensions/test-runner/test/test-card.browser.test.tsx Migrates card rendering.
packages/extensions/test-runner/package.json Adds testing-library dependency.
packages/extensions/terminal/vitest.config.ts Enables shared cleanup.
packages/extensions/tanstack/vitest.config.ts Enables shared cleanup.
packages/extensions/tanstack/test/inspector-chip.browser.test.tsx Migrates chip rendering.
packages/extensions/tanstack/package.json Adds testing-library dependency.
apps/conciv/vitest.config.ts Enables shared cleanup.
apps/conciv/test/user-turn.browser.test.tsx Migrates thread rendering.
apps/conciv/test/tool-card-dispatch.browser.test.tsx Migrates card rendering.
apps/conciv/test/session-selector.browser.test.tsx Removes manual disposal.
apps/conciv/test/panel-focus-stability.browser.test.tsx Migrates router rendering.
apps/conciv/test/notices.browser.test.tsx Migrates toaster rendering.
apps/conciv/test/model-selector.browser.test.tsx Migrates selector rendering.
apps/conciv/test/launch-menu.browser.test.tsx Migrates menu rendering.
apps/conciv/test/launch-actions.browser.test.tsx Removes manual disposal.
apps/conciv/test/kit-controls.browser.test.tsx Migrates control rendering.
apps/conciv/test/helpers/pane-harness.tsx Migrates shared pane harness.
apps/conciv/test/grab-reference.browser.test.tsx Migrates reference rendering.
apps/conciv/test/engine-staleness.browser.test.tsx Removes manual disposal.
apps/conciv/test/context-tracker.browser.test.tsx Migrates tracker rendering.
apps/conciv/test/chat-pane.browser.test.tsx Removes manual disposal.
apps/conciv/test/attachment-widget.browser.test.tsx Migrates widget rendering.
apps/conciv/test/attachment-dispatch.browser.test.tsx Migrates attachment rendering.
apps/conciv/package.json Adds testing-library dependency.
.oxlintrc.json Enables the lint rule and exemptions.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

dispose()
host.remove()
},
dispose: mounted.unmount,
@omridevk
omridevk merged commit d332a6a into main Aug 10, 2026
45 of 47 checks passed
@omridevk
omridevk deleted the fix/389-testing-library-migration branch August 10, 2026 22:59
omridevk added a commit that referenced this pull request Aug 10, 2026
…t-render matcher (#417 follow-up) (#420)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
omridevk added a commit that referenced this pull request Aug 13, 2026
…rap onCleanup (#469)

* fix(test+router): #462 router-owned extension-instance disposal via Wrap onCleanup

createConcivRouter now passes a Wrap component to createRouter that registers
onCleanup to dispose every extension instance, riding whatever unmounts the
tree rendering RouterProvider (solid-router renders Wrap inside its reactive
root). This replaces disposeConcivRouter, an export every consumer had to
remember to pair with unmount by hand — packages/embed/src/mount-impl.tsx and
three apps/conciv browser suites carried ad hoc disposer arrays for exactly
that reason.

Central DOM cleanup (afterEach(cleanup) from @conciv/vitest-config/solid-cleanup,
added in #417) already unmounts every rendered tree between tests, so the
apparent "leak" was never a missing unmount call — it was extension instances
nothing in the render tree owned. Phase 1 evidence (see PR body) confirmed
both: no DOM persists across tests on main, and a plain render+unmount with no
manual disposeConcivRouter call never disposes an extension instance.

router.ts becomes router.tsx (the Wrap needs a JSX fragment to satisfy the
solid/reactivity lint rule against returning props.children bare), with the
apps/conciv/package.json "./router" export updated to match.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(app): cover throw-resilient extension disposal in the Wrap onCleanup path

The deleted router-restore.browser.test.ts test proved three extensions all
get disposed even when the middle one's dispose() throws. That semantic still
lives in disposeInstances but the new router-wrap-disposal suite only covered
a single extension with no throw. Extends it with a second test: three
extensions, middle disposer throws, unmount via the render result, assert it
doesn't throw and every disposer ran exactly once in order.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(app): explicit idempotent disposal path for a router that is never rendered

Copilot review on #469 flagged that Wrap-owned disposal only fires once Solid
actually mounts the tree: a router created via createConcivRouter but never
rendered through RouterProvider has no disposal owner for its eagerly-created
extension instances (createInstances runs at router-creation time, not inside
Wrap). Confirmed real before touching anything: packages/embed/src/mount-impl.tsx
reads router.options.context.instances synchronously right after
createConcivRouter returns, to build the page-tool driver, before render()
ever runs — so deferring instance creation into Wrap's component body (the
originally proposed fix) would leave that driver built with zero tools and
zero effects on every real widget boot. Grepped every other reader
(extension-slots.tsx, app/context.ts, routes/__root.tsx) and confirmed they
all read post-render, inside the routed component tree Wrap wraps.

Fix, kept as one mechanism: createConcivRouter still creates instances
eagerly, but now builds a single guarded disposer (closure flag; first call
disposes every instance with the existing try/catch semantics, every later
call is a no-op) and stores it on context as disposeInstances. Wrap's
onCleanup calls it. disposeConcivRouter is re-exported as a one-line call to
that same disposer, giving mount-impl.tsx (and any router that boot-fails
before render) an explicit, idempotent owner: calling it after a normal
unmount is a no-op, and calling it twice on a never-rendered router disposes
exactly once.

packages/embed/src/mount-impl.tsx: re-added disposeConcivRouter(router) to
both bootNormal's and bootConnect's disposer lists.

apps/conciv/test/router-wrap-disposal.browser.test.tsx: two new tests
(idempotent after unmount; disposes + is idempotent when never rendered), with
the three single-extension setups deduped through a routerWithDisposeSpy
helper (fallow flagged the near-identical inline setups as introduced
duplication). Verified red (missing export) against the pre-fix source,
green with the fix restored via a manual git-checkout revert-check (no stash).
The three already-migrated suites (route-boundary, panel-focus-stability,
router-restore) are untouched — Wrap alone still covers them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants