Index of every page on this site: llms.txt
All skills
langgenius avatar

/frontend-testing

@b9081dc
by langgeniuslanggenius/dify162k stars
25,538
Run it yourself

Use when writing or changing Vitest or React Testing Library tests under `web/` or `packages/dify-ui/`, or when the user explicitly requests frontend test strategy, including evaluation of an existing strategy. Do not use for frontend code-review-only requests, general testability discussion, Python tests, or Cucumber/Playwright E2E.

Use this Skill: https://skilld.dev/gh/langgenius/dify/frontend-testing

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈88 tokens for metadata: the name and description. ≈146 when used: this file.

Description uses 4.4% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈354 characters, or 4.4%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Frontend Testing

Read the testing policy for the package that owns the changed tests:

  • web/: web/docs/test.md owns Web test boundaries, environments, and commands.
  • packages/dify-ui/: packages/dify-ui/docs/testing.md owns primitive test boundaries, environments, Storybook, and commands.

This skill adds no parallel policy or check sequence. Follow the selected owner's requirements, including its validation commands. Recommend deleting low-value tests as readily as adding missing behavior coverage, and report the contract verified and any material verification gap.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo5 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill is safe. It provides non-executable guidelines and policy directions for frontend testing within a repository.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

  • Runlayer8mo

    1/10 files flagged

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at b9081dc. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 1 hour ago.

Activeupdated 3 months ago
  • Frontend
  • Testing
  • vitest
  • react-testing-library
  • rtl
  • dify
  • components
  • hooks
  • unit-tests
  • integration-tests

README badge

README badge for langgenius/dify/frontend-testing

Generates Vitest and React Testing Library tests for Dify frontend components, hooks, and utilities following the project's conventions. Tests use the AAA pattern, semantic queries, and an incremental one-file-at-a-time workflow; mocks external dependencies like API services and next/navigation while importing real project components.

Generated from the current SKILL.md.

Does this skill cover E2E testing or only unit/integration tests?
This skill covers unit and integration tests for frontend components, hooks, and utilities using Vitest and React Testing Library. E2E tests (Cucumber + Playwright) are out of scope; use the E2E testing skill for those.
What should I mock and what should I import as real?
Mock only external dependencies like API services (`@/service/*`), `next/navigation`, and complex context providers. Import and use real project components, base components from `@/app/components/base/*`, and dify-ui primitives directly in tests.
How should I organize test files in the Dify project?
Test files must live in a sibling `__tests__/` directory at the same level as the source. For example, `foo/index.tsx` maps to `foo/__tests__/index.spec.tsx`, and `foo/bar.ts` maps to `foo/__tests__/bar.spec.ts`.
Should I write all tests at once or incrementally?
Always use an incremental approach. Analyze and list files, order by complexity (simple to complex), then write and run tests one file at a time, verifying each passes before proceeding to the next.
How do I test components that use `useQueryState` from nuqs?
Use `NuqsTestingAdapter` from the shared helpers in `web/test/nuqs-testing.tsx` and assert URL synchronization via `onUrlUpdate`. Ensure custom parsers maintain bijective `parse` and `serialize` functions.

Generated from the current SKILL.md. These answers refresh after source changes.