Logotipo de Repo Source Code Test Frameworks

Repo Source Code Test Frameworks

OrganizaciónPopular
open-circle
repo-source-code-test-frameworks

Write unit and type tests for Formisch framework packages (frameworks/angular, frameworks/preact, frameworks/solid, frameworks/svelte, frameworks/vue, frameworks/react, frameworks/react-native). Use when adding tests for hooks/composables/runes/inject functions (useForm/createForm/injectForm, useField/injectField, useFieldArray/injectFieldArray) or components and directives (Form, Field, FieldArray, formischForm, formischField) in any framework wrapper.

Descripción general

Editoropen-circle
Repositorioformisch
Nombre de la habilidadrepo-source-code-test-frameworks
Estrellas
1.2K
Forks
36
Archivos incluidos
Solo instrucciones
LicenciaMIT
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando la petición encaja con la habilidad.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • Todo en las instrucciones

    Todo lo que necesita el modelo está en las instrucciones: no hay archivos adicionales que sincronizar.

  • Código abierto

    Publicada por open-circle en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Repo Source Code Test Frameworks en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/open-circle/formisch/tree/main/.agents/skills/repo-source-code-test-frameworks
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/open-circle/formisch.git /tmp/formisch
mkdir -p .claude/skills
cp -r /tmp/formisch/.agents/skills/repo-source-code-test-frameworks .claude/skills/repo-source-code-test-frameworks
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Repo Source Code Test Frameworks en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición encaja con la habilidad, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Repo Source Code Test Frameworks automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Repo Source Code Test Frameworks no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición que encaja con la habilidad, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo seguirá.

Writing Framework Tests

Tests for frameworks/<fw>/. For packages/core/ or packages/methods/, use repo-source-code-test-packages.

Rules

  1. React is the canonical reference. New shared tests land in frameworks/react first, then port.
  2. Cross-framework consistency. Shared API (useForm/createForm/injectForm, useField, useFieldArray, Field, FieldArray) keeps the same describe/test names, schemas, initialInput, expected outputs. Only mechanical adapters differ. Test what the adapter actually exports: React Native has no Form component, and Angular ships directives instead of components.
  3. No framework hint in test names. Never 'should ... (Solid-only)'. Use a // ... comment above the test if framework-specific reasoning matters.
  4. No tautological assertions. A test must be able to fail under a real source change.
  5. 100% coverage on non-excluded files. Match React's vitest.config.ts exclusions: src/types, src/vitest, **/index.ts(x), test files.
  6. vi.waitFor for async, never setTimeout(0).

File layout

frameworks/<fw>/
├── vitest.config.ts          # framework plugin + jsdom + setupFiles + coverage exclusions
├── package.json              # `test: vitest run --typecheck`, framework testing-library devDep
└── src/
    ├── vitest/
    │   ├── setup.ts          # jest-dom + cleanup
    │   ├── renderHook.ts     # (Vue/Svelte only)
    │   └── *Host.svelte      # (Svelte only) shared hosts
    ├── hooks|primitives|composables|runes|functions/<name>/<name>.test.{ts,tsx} + .test-d.ts
    └── components|directives/<Name>/<Name>.test.{ts,tsx}
                            └── *Host.test.svelte # (Svelte only) per-test hosts

Standard test set

Identical describe/test names across all frameworks:

Sourcedescribe blocksTests
useForm / createForm / injectForminitialization, initial validation, reactivity4 + 2 type
useField / injectFieldinitialization, input updates, validation modes, element registration10 + 4 type
useFieldArray / injectFieldArrayinitialization, reactivity6 + 4 type
Form / Field / FieldArray(flat)3 each

Form only exists where the adapter provides it: React Native has no Form component, and Angular ships the [formischForm] directive instead.

The store stability describe tests useMemo across re-renders and exists only in React and React Native. In other frameworks omit it with a one-line // Note: ... comment.

Per-framework adapters

ConcernPreactSolidSvelteVueReactReact NativeAngular
Hook nameuseFormcreateFormcreateFormuseFormuseFormuseForminjectForm
Read stateform.isValid.valueform.isValidform.isValidform.isValidform.isValidform.isValidform.isValid()
Imperative setfield.onInput(v)field.onInput(v)field.onInput(v)field.input = vfield.onChange(v)field.onChange(v)field.setInput(v)
DOM input eventfireEvent.inputfireEvent.inputfireEvent.inputinput.setValue(v)fireEvent.changefireEvent.changeinput.dispatchEvent(new Event())
Auto-focus propautofocusautofocusautofocusautofocusautoFocusnonenone
Field childrenfunctionfunction{#snippet children}v-slot / scoped slotfunctionfunction*formischField + let field
Testing library@testing-library/preact@solidjs/testing-library@testing-library/svelte@vue/test-utils@testing-library/react@testing-library/react@angular/core/testing (TestBed)

renderHook

  • Preact / React / React Native: from the testing library — { result: { current }, rerender, unmount }.
  • Solid: from @solidjs/testing-library — { result, owner, cleanup }. result is direct, not wrapped in .current. Use createRoot from solid-js only if no JSX context is needed; our primitives need an owner so renderHook is the default.
  • Vue: custom helper at src/vitest/renderHook.ts — mounts a defineComponent({ setup() { return hook(); } }) (the canonical Vue Test Utils TestComponent recipe). Required because onBeforeMount/computed need component context.
  • Angular: no renderHook. Call the inject functions inside TestBed.runInInjectionContext(() => …) (or runInInjectionContext(injector, …) when you need to control destruction), and mount a host @Component with TestBed.createComponent for directive tests.
  • Svelte: custom helper at src/vitest/renderHook.ts — mounts Hook.svelte. Required because onMount and [createAttachmentKey()] need template context. For pure rune logic with no lifecycle, $effect.root(() => { ... })() in a .test.svelte.ts is lighter — but no covered rune in this repo qualifies.

Async

ts
// ❌ flaky
await new Promise((r) => setTimeout(r, 0));
// ✅
await vi.waitFor(() => expect(form.isValid).toBe(false));

For Svelte rune updates, flushSync() from svelte synchronously drains derived/effect updates before the assertion. For Vue, flushPromises() from @vue/test-utils is fine for one-shot microtask drains; prefer vi.waitFor for multi-tick reactive flows.

Type tests (*.test-d.ts)

ts
import * as v from 'valibot';
import { describe, expectTypeOf, test } from 'vitest';
import type { FieldStore } from '../../types/index.ts';
import { useForm } from '../useForm/index.ts';
import { useField } from './useField.ts';

describe('useField', () => {
  test('should narrow input type for primitive leaves', () => {
    const schema = v.object({ name: v.string() });
    const form = useForm({ schema });
    expectTypeOf(useField(form, { path: ['name'] }).input).toEqualTypeOf<
      string | undefined
    >();
  });

  test('should reject invalid paths', () => {
    const form = useForm({ schema: v.object({ name: v.string() }) });
    // @ts-expect-error nonexistent field
    useField(form, { path: ['nonexistent'] });
  });
});

For Preact, wrap leaf types in ReadonlySignal<...>, and for Angular in its Signal<...> — those are the only framework-specific deltas in .test-d.ts files. Angular's types/field.test-d.ts additionally checks that a FieldStore stays assignable across schema and path generics, which is what its directives rely on.

Schema types

Always derive with typeof schema. If the schema is referenced only at the type level (host owns runtime), suppress the lint warning rather than hand-writing the valibot generic shape:

ts
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- referenced only via `typeof schema`
const schema = v.object({ name: v.string() });
type Schema = typeof schema;

Framework gotchas

Angular — every reactive field.* / form.* is an Angular Signal<T>; read by calling it (field.isDirty()). Setter is field.setInput(v). There is no props object: templates bind [formischControl]="field" and pass the value with [value]="field.input() ?? ''". Field tests mount a host @Component whose template uses *formischField="['path'] of form; let field", configure TestBed with provideZonelessChangeDetection(), and drive the DOM with input.dispatchEvent(new Event('input')) followed by await fixture.whenStable() and fixture.detectChanges(). src/vitest/setup.ts already calls TestBed.initTestEnvironment and resets the module after each test.

Preact — every reactive field.* / form.* is a ReadonlySignal<T>; read with .value. Setter is field.onInput(v). DOM events fire on oninput. props.autofocus is lowercase.

React Native — tests render through react-native-web with @testing-library/react and jsdom, so fireEvent.change / fireEvent.focus work on the rendered TextInput. field.props has no name and no autoFocus; text is set via onChangeText. There is no Form component and no submit method, so submission tests call handleSubmit. Element cleanup differs by React version: react-native-web discards ref cleanup functions, so tests that assert per-element unregistration must render raw elements — see the comments in useField.test.tsx.

Solid — primitive is createForm (not useForm). Methods (insert, swap) don't need act(). Use class= not className= in JSX. vite-plugin-solid ≥ 2.8.2 auto-configures vitest; don't add manual deps overrides.

Vue — field.props has no onInput; wire DOM input via the setter:

ts
h('input', {
  ...field.props,
  value: field.input ?? '',
  onInput: (e: Event) => {
    field.input = (e.target as HTMLInputElement).value;
  },
});

For "element removed" assertions, mount with attachTo: document.body and query document.querySelector — wrapper.find keeps finding stale nodes after unmount().

Svelte — runes need Svelte compilation. Three test patterns:

  • Hook.svelte via renderHook — default; required when source calls onMount or uses [createAttachmentKey()].
  • *Host.test.svelte per-test components — for snippet/slot rendering of Field/FieldArray/Form.
  • $effect.root in a *.test.svelte.ts — only for pure rune logic with no lifecycle.

Snippets can't run statements; forward values via {@const _ = onField(field)} with a comment explaining the pattern. After every test, cleanup() from @testing-library/svelte must run in setup.ts or screen.getByTestId finds duplicates.

Svelte build hygiene — package.json files excludes **/*.test.*, **/*.test-d.*, dist/vitest. Verify after adding new fixtures:

bash
pnpm -C frameworks/svelte build && cd frameworks/svelte && pnpm pack --pack-destination /tmp/
tar -tzf /tmp/formisch-svelte-*.tgz | grep -E "(test|Host|vitest)"  # must be empty

Coverage

bash
cd frameworks/<fw> && pnpm exec vitest run --coverage

Must hit 100% on every non-excluded file. Common gaps that need framework-specific tests (no React analogue): field.props.onChange handler (Preact/Solid/Svelte/Vue, covered by validate:'change' test), usePathSignal length-mismatch branch (Preact), unwrap (Solid/Svelte). Add such tests with a // ... comment, not a (X-only) suffix.

Running

bash
pnpm -C frameworks/<fw> test           # runtime + type
pnpm -C frameworks/<fw> lint           # eslint + tsc --noEmit

CI: <fw>_vitest job in .github/workflows/ci.yml.

Checklist

  • Test names match React canonical names exactly (no (X-only) suffixes)
  • Framework divergence justified by // ... comment, not test name
  • vi.waitFor for async, never setTimeout(0)
  • Schema types via typeof schema, never hand-written valibot generics
  • No tautological assertions
  • 100% coverage on covered files
  • pnpm test and pnpm lint pass
  • (Svelte) pnpm pack output contains no test/Host/vitest files
  • CI has a <fw>_vitest job

Preguntas frecuentes

¿Qué hace la habilidad de IA Repo Source Code Test Frameworks?

Write unit and type tests for Formisch framework packages (frameworks/angular, frameworks/preact, frameworks/solid, frameworks/svelte, frameworks/vue, frameworks/react, frameworks/react-native). Use when adding tests for hooks/composables/runes/inject functions (useForm/createForm/injectForm, useField/injectField, useFieldArray/injectFieldArray) or components and directives (Form, Field, FieldArray, formischForm, formischField) in any framework wrapper.

¿Por qué usar Repo Source Code Test Frameworks en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Repo Source Code Test Frameworks está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Repo Source Code Test Frameworks en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/open-circle/formisch/tree/main/.agents/skills/repo-source-code-test-frameworks. TypingMind lee el archivo SKILL.md de esa carpeta e instala su contenido como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Repo Source Code Test Frameworks?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Repo Source Code Test Frameworks?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Repo Source Code Test Frameworks con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Repo Source Code Test Frameworks?

Sí. open-circle la ha publicado en GitHub bajo la licencia MIT. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver el directorio

Crea ya tu propio espacio de trabajo con IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇