studio-testing
- Repo stars 103,397
- Author updated Live
- Author repo supabase
- Domain
- Writing
- Compatible agents
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- Trust score
- 88 / 100 · community maintained
- Author / version / license
- @supabase · no license declared
- Token usage
- Lean
- Setup complexity
- Guided setup
- External API key
- Not required
- Operating systems
- Unspecified (assume cross-platform)
- Runtime requirements
- No special requirements
- Permissions
-
- Read-only
- Write / modify
- Shell exec
- Network behavior
- Local-only
- Install commands
- 26 variants
Profile is derived at build time from SKILL.md and install vectors. Subject to drift from author intent.
Heads up: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: studio-testing
description: Testing strategy for Supabase Studio. Use when writing tests, deciding what How to write and str…
category: writing
runtime: no special runtime
---
# studio-testing output preview
## PART A: Task fit
- Use case: Testing strategy for Supabase Studio. Use when writing tests, deciding what How to write and structure tests for apps/studio/. The core principle: push logic out of React components into pure utility functions, then test those runs entirely locally. Works with Claude Code, Cursor, Cline and 23 more..
- Inputs: target material, constraints, expected output, and acceptance criteria.
- Evidence boundary: follow “When to Apply / Rule Categories by Priority / Quick Reference” and do not present inference as author intent.
## PART B: Execution result
- **01** The card summarizes the use case; runtime output centers on “Testing strategy for Supabase Studio. Use when writing tests, deciding what How to write and structure tests for apps/studio/. The core principle: push logic out of React components into pure utility functions, then test those runs entirely locally. Works with Claude Code, Cursor, Cline and 23 more.”.
- **02** When the source has headings, the agent prioritizes “When to Apply / Rule Categories by Priority / Quick Reference” so the result follows the author’s structure.
- **03** Typical output includes task judgment, concrete steps, required commands or file edits, validation, and follow-up options.
- **04** Risk context follows the fingerprint: read files, write/modify files, run shell commands; mostly runs locally; usually needs no extra API key.
## Running Rules
- read files, write/modify files, run shell commands; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding scope.
- Return the result, validation criteria, and next iteration options. The source does not require a stable slash command. After installation, invoke the skill by name and describe the task.
Name target files or source material, expected output, forbidden changes, and whether network or shell access is allowed. Permission fingerprint: read files, write/modify files, run shell commands.
Start with a small task and check whether the result follows “When to Apply / Rule Categories by Priority / Quick Reference”. Inspect diffs, logs, previews, or tests before expanding scope.
Confirm the final output includes a concrete result, evidence, and next action. If it stays generic, tighten inputs, boundaries, and acceptance criteria.
---
name: studio-testing
description: Testing strategy for Supabase Studio. Use when writing tests, deciding what How to write and str…
category: writing
source: supabase/supabase
---
# studio-testing
## When to use
- Testing strategy for Supabase Studio. Use when writing tests, deciding what How to write and structure tests for apps/…
- Use it when the task has clear inputs, repeatable steps, and validation criteria.
## What to provide
- Target material, scope, expected result, and forbidden changes.
- Whether network, commands, file writes, or external services are allowed.
## Execution rules
- Organize steps around “When to Apply / Rule Categories by Priority / Quick Reference” and keep inference separate from source facts.
- read files, write/modify files, run shell commands; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding the task.
## Output requirements
- Return the deliverable, key evidence, validation method, and next action.
- Mark missing information as unknown; do not invent commands, platforms, or dependencies. The author source anchors workflow facts; repository files anchor sources and commands; Fluxly only adds fit, limitations, and quality judgment.
skill "studio-testing" {
input -> user goal + target files + boundaries + acceptance criteria
context -> When to Apply / Rule Categories by Priority / Quick Reference
rules -> SKILL.md triggers / order / output contract
runtime -> no special runtime | read files, write/modify files, run shell commands | mostly runs locally
guardrails -> usually needs no extra API key + small-sample validation + diff/log review
output -> copyable result + checklist + next iteration
} Studio Testing Strategy
How to write and structure tests for apps/studio/. The core principle: push
logic out of React components into pure utility functions, then test those
functions exhaustively. Only use component tests for complex UI interactions.
Use E2E tests for features shared between self-hosted and platform.
When to Apply
Reference these guidelines when:
- Writing new tests for Studio code
- Deciding which type of test to write (unit, component, E2E)
- Extracting logic from a component to make it testable
- Reviewing whether test coverage is sufficient
- Adding a new feature that needs tests
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Logic Extraction | CRITICAL | testing- |
| 2 | Test Coverage | CRITICAL | testing- |
| 3 | Component Tests | HIGH | testing- |
| 4 | E2E Tests | HIGH | testing- |
Quick Reference
1. Logic Extraction (CRITICAL)
testing-extract-logic- Remove logic from components into.utils.tsfiles as pure functions: args in, return out
2. Test Coverage (CRITICAL)
testing-exhaustive-permutations- Test every permutation of utility functions: happy path, malformed input, empty values, edge cases
3. Component Tests (HIGH)
testing-component-tests-ui-only- Only write component tests for complex UI interaction logic, not business logic
4. E2E Tests (HIGH)
testing-e2e-shared-features- Write E2E tests for features used in both self-hosted and platform; cover clicks AND keyboard shortcuts
Decision Tree: Which Test Type?
Is the logic a pure transformation (parse, format, validate, compute)?
YES -> Extract to .utils.ts, write unit test with vitest
NO -> Does the feature involve complex UI interactions?
YES -> Is it used in both self-hosted and platform?
YES -> Write E2E test in e2e/studio/features/
NO -> Write component test with customRender
NO -> Can you extract the logic to make it pure?
YES -> Do that, then unit test it
NO -> Write a component test
1. Extract Logic Into Utility Files (CRITICAL)
Remove as much logic from components as possible. Put it in co-located
.utils.ts files as pure functions: arguments in, return value out.
File naming:
- Utility:
ComponentName.utils.tsnext to the component - Test:
tests/components/.../ComponentName.utils.test.tsmirroring the source path
// ❌ Logic buried in component — hard to test without rendering
function TaxIdForm({ taxIdValue, taxIdName }: Props) {
const handleSubmit = () => {
const taxId = TAX_IDS.find((t) => t.name === taxIdName)
let sanitized = taxIdValue
if (taxId?.vatPrefix && !taxIdValue.startsWith(taxId.vatPrefix)) {
sanitized = taxId.vatPrefix + taxIdValue
}
submitToApi(sanitized)
}
return <form onSubmit={handleSubmit}>...</form>
}
// ✅ Logic extracted to .utils.ts — trivially testable
// TaxID.utils.ts
export function sanitizeTaxIdValue({ value, name }: { value: string; name: string }): string {
const taxId = TAX_IDS.find((t) => t.name === name)
if (taxId?.vatPrefix && !value.startsWith(taxId.vatPrefix)) {
return taxId.vatPrefix + value
}
return value
}
// TaxIdForm.tsx — thin shell
const handleSubmit = () => {
const sanitized = sanitizeTaxIdValue({ value: taxIdValue, name: taxIdName })
submitToApi(sanitized)
}
2. Test Every Permutation (CRITICAL)
Once logic is extracted, test exhaustively. Every code path needs a test:
- Valid inputs (happy path for each branch)
- Invalid / malformed inputs
- Empty values, null values, missing fields
- Edge cases (timestamps with colons, special characters, boundary values)
// ❌ Only happy path
test('parses a filter', () => {
expect(formatFilterURLParams('id:gte:20')).toStrictEqual({ column: 'id', operator: 'gte', value: '20' })
})
// ✅ Every permutation
test('parses valid filter', () => { ... })
test('handles timestamp with colons in value', () => { ... })
test('rejects malformed filter with missing parts', () => { ... })
test('rejects unrecognized operator', () => { ... })
test('allows empty filter value', () => { ... })
3. Component Tests for Complex UI Only (HIGH)
Only write component tests when there is complex UI interaction logic that cannot be captured by testing utility functions alone.
Valid reasons: conditional rendering from user interaction sequences, popover open/close with keyboard/mouse, multi-step form transitions.
Not valid: testing a calculation or transformation that happens to live
in a component — extract to .utils.ts and unit test instead.
// Studio component test conventions
import { fireEvent } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { customRender } from 'tests/lib/custom-render' // always use customRender, not raw render
import { addAPIMock } from 'tests/lib/msw' // API mocking in beforeEach
4. E2E Tests for Shared Features (HIGH)
If a feature exists in both self-hosted and platform, create an E2E test. Cover mouse clicks AND keyboard shortcuts (Tab, Enter, Escape, Arrow keys).
Extract reusable interactions into e2e/studio/utils/*-helpers.ts. Use
try/finally for resource cleanup. For E2E execution details, see the
studio-e2e-tests skill.
Codebase References
| What | Where |
|---|---|
| Util test examples | apps/studio/tests/components/Grid/Grid.utils.test.ts, apps/studio/tests/components/Billing/TaxID.utils.test.ts, apps/studio/tests/components/Editor/SpreadsheetImport.utils.test.ts |
| Component test examples | apps/studio/tests/features/logs/LogsFilterPopover.test.tsx, apps/studio/tests/components/CopyButton.test.tsx |
| E2E test example | e2e/studio/features/filter-bar.spec.ts |
| E2E helpers pattern | e2e/studio/utils/filter-bar-helpers.ts |
| Custom render | apps/studio/tests/lib/custom-render.tsx |
| MSW mock setup | apps/studio/tests/lib/msw.ts (addAPIMock) |
| Test README | apps/studio/tests/README.md |
| Vitest config | apps/studio/vitest.config.ts |
| Related skills | studio-e2e-tests (running E2E), vitest (API reference), vercel-composition-patterns (component architecture) |
Decide Fit First
Design Intent
How To Use It
Boundaries And Review