agentleFS
CloudflareKnown publishercloudflare/realtimekit-ui/.agents/skills/realtimekit-test-setup/SKILL.md

realtimekit-test-setup

Skill76 starsChanged 6 days agoApache-2.0View on GitHub

Use with writing-tests for realtimekit-ui tests. Covers Stencil/Jest component specs, core e2e tests, script tests, workspace lint commands, and local test setup.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read writing-tests for the rules.

    line 8
  2. Very specific:

    Do not install packages just to make a test run without permission (see minimal-changes).

    line 35
  3. Very specific:

    Search nearby *.spec.tsx files for fixtures and stubs already in use.

    line 48
  4. Distinctive:

    If one spec needs a small fixture, keep it local.

    line 49
  5. Very specific:

    Use Jest mocks (jest.fn(), jest.spyOn(), jest.mock()) where appropriate.

    line 51
  6. Very specific:

    After changing props or events, use page.waitForChanges() before checking updated DOM.

    line 56

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

UI Kit test setup

Read writing-tests for the rules. This skill gives the places and commands for this repo.

Basics

  • Core component and utility specs live next to source as *.spec.tsx or *.spec.ts. Example: packages/core/src/components/rtk-meeting/rtk-meeting.spec.tsx.
  • Core e2e tests live in packages/core/e2e/. Script tests live in scripts/*.test.js.
  • Stencil uses Jest. Import newSpecPage or newE2EPage from @stencil/core/testing; use describe, it or test, expect, and jest.fn() as in nearby specs.
  • For component specs, render the real Stencil component with newSpecPage({ components: [...], template: ... }). Check props, shadow DOM, emitted events, and cleanup as needed.

Commands

Commands are from the repo root unless noted. Check the root and workspace package.json before using a command.

GoalCommand
Lint core TypeScriptnpm run lint -w @cloudflare/realtimekit-ui
Lint all workspaces with lint scriptsnpm run lint
Run one core spec oncenpm exec -w @cloudflare/realtimekit-ui -- stencil test --spec --runInBand --testPathPattern=rtk-meeting.spec.tsx (replace the filename)
Run core specs and e2e testsnpm test -w @cloudflare/realtimekit-ui
Run all workspace tests and script testsnpm test
Run core spec coverage (single run)npm run test:coverage -w @cloudflare/realtimekit-ui
Run script tests onlynpm run test:scripts
  • npm run test:spec -w @cloudflare/realtimekit-ui uses --watchAll. Do not use it for a single-run check.
  • The core test script runs stencil test --spec --e2e; e2e tests may need a browser environment. Report environment failures instead of claiming tests pass.
  • packages/react-library has a lint placeholder, not a real linter. packages/angular-library uses node test.js, which skips when it finds no Angular specs.
  • There is no standalone root or core type-check script. Do not run npm run build, npm run generate, or npm run docs:generate; the developer runs builds and generators.
  • Do not install packages just to make a test run without permission (see minimal-changes).

Where shared mocks live

You needUseHow
A Stencil component pagenewSpecPage from @stencil/core/testingPass the real component class and render it with a template or HTML.
A browser-level component pagenewE2EPage from @stencil/core/testingPut e2e tests in packages/core/e2e/.
Meeting or device stateA small local fixture or an existing helper in the specStub only the needed SDK boundary with jest.fn() and check what the component renders.
A common mock shared by several specsA shared helper near the affected specsSearch existing specs before adding a new mock module or helper.

Add a new shared mock

  1. Search nearby *.spec.tsx files for fixtures and stubs already in use.
  2. If one spec needs a small fixture, keep it local. If several specs need the same setup, use or add a shared helper without moving unrelated tests.
  3. Mock only the boundary that the UI needs, such as an SDK meeting method or a browser device API. Keep the component under test real.
  4. Use Jest mocks (jest.fn(), jest.spyOn(), jest.mock()) where appropriate. Do not copy Vitest vi calls into this repo.

Things that go wrong

  • newSpecPage renders components in a test DOM; inspect page.root and page.root.shadowRoot rather than testing a private method when the DOM result is visible.
  • After changing props or events, use page.waitForChanges() before checking updated DOM.
  • A mocked helper does not run its real logic. Test shared UIConfig or utility changes through their real exported functions.
  • Clean up listeners or page roots when the component registers browser or meeting listeners. Follow the nearby spec pattern.

Think from the UI Kit

Load realtimekit-sdk-map. Name tests for what an app sees: the component's props, shadow DOM, emitted event detail, or exported helper result. Cover alternate states or sizes when the changed UI behaves differently there. Follow AGENTS.md for the component and package you change.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.