walkeros-create-cmp-so…
A CMP source is a specialized walkerOS source that listens to a consent management platform's events and translates consent…
walkerOS uses a layered testing approach with built-in patterns for mocking and documentation sync. This skill ensures tests are reliable, efficient, and maintainable.
Claude Code
$ npx -y skills add elbwalker/walkerOS --skill walkeros-testing-strategy --agent claude-code
Codex
$ npx skills add elbwalker/walkerOS --skill walkeros-testing-strategy -a codex -y
Cursor
$ npx skills add elbwalker/walkerOS --skill walkeros-testing-strategy -a cursor -y
Gemini CLI
$ npx skills add elbwalker/walkerOS --skill walkeros-testing-strategy -a gemini-cli -y
GitHub Copilot
$ npx skills add elbwalker/walkerOS --skill walkeros-testing-strategy -a github-copilot -y
OpenCode
$ npx skills add elbwalker/walkerOS --skill walkeros-testing-strategy -a opencode -y
Windsurf
$ npx skills add elbwalker/walkerOS --skill walkeros-testing-strategy -a windsurf -y
name: walkeros-testing-strategy description: Use when writing tests, reviewing test code, or discussing testing approach for walkerOS packages. Covers env pattern, dev examples, and package-specific strategies.
walkerOS uses a layered testing approach with built-in patterns for mocking and documentation sync. This skill ensures tests are reliable, efficient, and maintainable.
**Core principle:** Test real behavior using the `env` pattern, link to `dev` examples, verify before claiming complete.
walkerOS has a built-in dependency injection pattern via `env` in context. This is lighter than Jest mocks, enables documentation generation, and keeps tests in sync with examples.
**Wrong:**
jest.mock('../ga4', () => ({ initGA4: jest.fn() }));
expect(initGA4).toHaveBeenCalledWith(...);**Right:**
import { examples } from '../dev';
import { mockEnv } from '@walkeros/core';
const calls: Array<{ path: string[]; args: unknown[] }> = [];
const testEnv = mockEnv(examples.env.push, (path, args) => {
calls.push({ path, args });
});
await destination.push(event, { ...context, env: testEnv });
expect(calls).toContainEqual({
path: ['window', 'gtag'],
args: ['event', 'page_view', { page_title: 'Home' }],
});The `dev.ts` export provides `examples.env` (the mock env and its `simulation` paths) and `examples.step` (the step examples), plus `examples.minimal` for a destination and `examples.createTrigger` for a source. Using these in tests ensures documentation stays in sync.
A destination's step examples run through `runExamples`, which starts a real collector for each one and compares its `out` and `outcome`:
import type { StandardEventName } from '@walkeros/core';
import { runExamples } from '@walkeros/collector/dev';
import { page } from '@walkeros/web-core/dev';
import { destinationMeta } from '..';
import { examples } from '../dev';
// The standard events the destination maps, each with a public example
const claims: StandardEventName[] = [
'page view',
'product view',
'product add',
'order complete',
];
// The init example takes a config as `in`, not an event
const { init, ...events } = examples.step;
it('runs the step examples', async () => {
await runExamples('destination', destinationMeta, events, {
settings: examples.minimal.settings,
env: { push: examples.env.push, simulation: examples.env.simulation },
page,
claims,
});
});(`packages/web/destinations/meta/src/__tests__/conformance.test.ts` runs this test.)
A source's step examples run one test per example with `it.each(Object.entries(examples.step))`: the test feeds each example's `trigger` and `in` through `examples.createTrigger` and compares what the source hands the collector with `out` (see `packages/server/sources/express/src/__tests__/stepExamples.test.ts`).
See [using-step-examples](../walkeros-using-step-examples/SKILL.md) for the full lifecycle including the Three Type Zones and naming conventions.
If you're asserting that a mock was called, you're testing the mock works, not the code.
**Red flags:**
effects
**Fix:** Test what the code actually does. If external APIs must be mocked, verify the real API would receive correct data.
A test or repro that claims an event was delivered, lost or reported as failed starts a real collector with `startFlow` and mocks only the network or the vendor global (through `env`), never `collector.push`. A suite that mocks the collector cannot see loss: a destination that returns early, swallows an error or forgets an `await` passes it. Assert on what a user sees at default settings: the push result (`ok: false`, the destination under `failed` with its `reason`), the status counters, or the ERROR line the collector wrote.
Failure paths are examples too. A step package's failure modes (a missing required setting, a failing transport, a vendor script that is not loaded yet) are `public: false` step examples with an `outcome` (and `respond` for a vendor answer), not only the happy path. A `silent` rule and a consent revocation get examples as well.
**Use the conformance kit.** `conformance(kind, step, options)` from `@walkeros/collector/dev` runs a destination, source, transformer or store on a real collector against its step examples and checks the failure contract in one call. The `profile` states what the step talks to: for destinations `http`, `sdk-env`, `web-sdk` (a web SDK started in `init`), `vendor-global` or `socket`; `transformer` and `source` for those kinds. A web step passes `page` from `@walkeros/web-core/dev`, the browser it runs on; the browser profiles fail without it. A destination also passes `minimal: examples.minimal` (from `src/examples/minimal.ts`, only the settings the schema requires or `init` refuses to start without): the kit starts the destination with the settings its docs quickstart shows and requires one public example delivered. A package that cannot have a minimal example passes `withoutMinimal: '<reason>'` instead; with neither, or with an option that disagrees with the file, the test fails. `runExamples` runs the examples alone.
**Examples are the tests.** A destination's public examples (one per standard event it maps, from `getEvent(name)`) are asserted by `runExamples` with `claims`; do not restate an example's input and assertion in a second test. Every example runs as published: each function as source text, revived outside its module, the way `walkerOS.json` ships it (the runner
From browser to BigQuery and ad platforms - warehouse-native, and ready for AI agents via MCP.
A CMP source is a specialized walkerOS source that listens to a consent management platform's events and translates consent…
Use when creating a new walkerOS destination to send events to a vendor or API (GA4/gtag, Meta/Facebook Pixel, Mixpanel,…
Use when creating a new walkerOS source to capture events (browser source, dataLayer interception, server/HTTP source, webhook…
| Symptom | Likely Cause | Check | | ---------------------------------- | ---------------------------- |…
Read [understanding-mapping](../walkeros-understanding-mapping/SKILL.md) first for core concepts.
Use this skill to extract structured Markdown/JSON from PDFs and document images—tables with cell-level precision, formulas as…
Estimates intracellular metabolic fluxes from steady-state carbon-13 isotope-tracing measurements using validated atom maps,…