Prompt Buddy logoPrompt Buddy

cloudflare · Cloudflare Workers Docs

Workers Writing tests

Sets up and configures Miniflare v3 to perform integration testing for Cloudflare Workers using the node:test framework or other testing libraries.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Workers Writing tests

Sets up and configures Miniflare v3 to perform integration testing for Cloudflare Workers using the node:test framework or other testing libraries.

When To Use

Use when you need to implement low-level integration tests for Workers that require full control over platform primitives and configuration options via the Miniflare API.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/workers-testing-miniflare-writing-tests-workflow-guide.mdA guide on setting up and using Miniflare to write tests for Cloudflare Workers, including interacting with bindings and handling complex scenarios.Questions about a guide on setting up and using Miniflare to write tests for Cloudflare Workers, including interacting with bindings...
examples/workers-testing-miniflare-writing-tests-cloudflare-workers-miniflare-wri.textAn example demonstrating how to write tests for Cloudflare Workers using the Miniflare testing framework.Exact payloads, commands, or snippets shown in An example demonstrating how to write tests for Cloudflare Workers using the Miniflare testing framework.
examples/workers-testing-miniflare-writing-tests-cloudflare-workers-miniflare-wri-2.textA text-based example demonstrating how to write tests for Cloudflare Workers using Miniflare.Exact payloads, commands, or snippets shown in A text-based example demonstrating how to write tests for Cloudflare Workers using Miniflare.
examples/workers-testing-miniflare-writing-tests-cloudflare-workers-miniflare-wri-3.textA text-based example demonstrating how to write tests for Cloudflare Workers using Miniflare.Exact payloads, commands, or snippets shown in A text-based example demonstrating how to write tests for Cloudflare Workers using Miniflare.
examples/workers-testing-miniflare-writing-tests-cloudflare-workers-miniflare-wri-4.textA text-based example demonstrating how to set up and write tests for Cloudflare Workers using Miniflare.Exact payloads, commands, or snippets shown in A text-based example demonstrating how to set up and write tests for Cloudflare Workers using Miniflare.
examples/workers-testing-miniflare-writing-tests-cloudflare-workers-miniflare-wri-5.textA text example demonstrating how to write tests for Cloudflare Workers using Miniflare.Exact payloads, commands, or snippets shown in A text example demonstrating how to write tests for Cloudflare Workers using Miniflare.
examples/workers-testing-miniflare-writing-tests-cloudflare-workers-miniflare-wri-6.textA JavaScript test suite using Miniflare to dispatch fetch requests and assert worker responses.Exact payloads, commands, or snippets shown in A JavaScript test suite using Miniflare to dispatch fetch requests and assert worker responses.
examples/workers-testing-miniflare-writing-tests-cloudflare-workers-miniflare-wri-7.textA JavaScript test suite demonstrating how to use Miniflare to test Cloudflare Workers with environment bindings.Exact payloads, commands, or snippets shown in A JavaScript test suite demonstrating how to use Miniflare to test Cloudflare Workers with environment bindings.
examples/workers-testing-miniflare-writing-tests-cloudflare-workers-miniflare-wri-8.textA JavaScript test suite demonstrating how to use Miniflare to test Cloudflare Workers with KV namespace bindings.Exact payloads, commands, or snippets shown in A JavaScript test suite demonstrating how to use Miniflare to test Cloudflare Workers with KV namespace bindings.
examples/workers-testing-miniflare-writing-tests-cloudflare-workers-miniflare-tes.textA code example demonstrating how to instantiate Miniflare with ES modules for testing Cloudflare Workers.Exact payloads, commands, or snippets shown in A code example demonstrating how to instantiate Miniflare with ES modules for testing Cloudflare Workers.
examples/workers-testing-miniflare-writing-tests-cloudflare-workers-miniflare-tes-2.textA code example demonstrating how to instantiate Miniflare with script paths and module rules for testing Cloudflare Workers.Exact payloads, commands, or snippets shown in A code example demonstrating how to instantiate Miniflare with script paths and module rules for testing Cloudflare W...
examples/workers-testing-miniflare-writing-tests-cloudflare-workers-miniflare-wri-9.textA text example demonstrating the use of before hooks and spawnSync to build wrangler projects during Miniflare testing.Exact payloads, commands, or snippets shown in A text example demonstrating the use of before hooks and spawnSync to build wrangler projects during Miniflare testing.

What This Skill Covers

  • For most users, Cloudflare recommends using the Workers Vitest integration. If you have been using test environments from Miniflare, refer to the Migrate fro...
  • Main sections: Interacting with Bindings, More complex Workers, Custom builds.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://developers.cloudflare.com/workers/testing/miniflare/writing-tests