Prompt Buddy logoPrompt Buddy

cloudflare · Cloudflare Workers Docs

Workers Write your first test

Sets up and implements a testing environment for Cloudflare Workers using Vitest and the @cloudflare/vitest-pool-workers package, including configuration, type definitions, and writing unit and integration tests.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Workers Write your first test

Sets up and implements a testing environment for Cloudflare Workers using Vitest and the @cloudflare/vitest-pool-workers package, including configuration, type definitions, and writing unit and integration tests.

When To Use

Use when you need to configure Vitest to run tests against Cloudflare Workers environments and write unit or integration tests for your Worker code.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/workers-testing-vitest-integration-write-your-first-test-workflow-guide.mdA guide for setting up and writing initial tests for Cloudflare Workers using the @cloudflare/vitest-pool-workers package.Questions about a guide for setting up and writing initial tests for Cloudflare Workers using the @cloudflare/vitest-pool-workers pac...
examples/workers-testing-vitest-integration-write-your-first-test-cloudflare-work.textA text guide outlining the installation commands and initial configuration steps for integrating Vitest with Cloudflare Workers.Exact payloads, commands, or snippets shown in A text guide outlining the installation commands and initial configuration steps for integrating Vitest with Cloudfla...
examples/workers-testing-vitest-integration-write-your-first-test-cloudflare-work-2.textThe shell commands required to install vitest and the cloudflare vitest pool workers package as development dependencies.Exact payloads, commands, or snippets shown in The shell commands required to install vitest and the cloudflare vitest pool workers package as development dependenc...
examples/workers-testing-vitest-integration-write-your-first-test-cloudflare-work-3.textThe shell commands required to install vitest and the cloudflare vitest pool workers package using pnpm.Exact payloads, commands, or snippets shown in The shell commands required to install vitest and the cloudflare vitest pool workers package using pnpm.
examples/workers-testing-vitest-integration-write-your-first-test-cloudflare-work-4.textThe shell commands required to install vitest and the cloudflare vitest pool workers package using bun.Exact payloads, commands, or snippets shown in The shell commands required to install vitest and the cloudflare vitest pool workers package using bun.
examples/workers-testing-vitest-integration-write-your-first-test-cloudflare-work-5.textA Vitest configuration file demonstrating the integration of the @cloudflare/vitest-pool-workers plugin for testing Workers.Exact payloads, commands, or snippets shown in A Vitest configuration file demonstrating the integration of the @cloudflare/vitest-pool-workers plugin for testing W...
examples/workers-testing-vitest-integration-write-your-first-test-cloudflare-work-6.textA Vitest configuration file demonstrating the integration of the cloudflareTest plugin with wrangler and miniflare settings.Exact payloads, commands, or snippets shown in A Vitest configuration file demonstrating the integration of the cloudflareTest plugin with wrangler and miniflare se...
examples/workers-testing-vitest-integration-write-your-first-test-cloudflare-work-7.textA tsconfig.json configuration file setting up module resolution and type definitions for Cloudflare Workers Vitest integration.Exact payloads, commands, or snippets shown in A tsconfig.json configuration file setting up module resolution and type definitions for Cloudflare Workers Vitest in...
examples/workers-testing-vitest-integration-write-your-first-test-cloudflare-work-8.textA JavaScript worker script implementing a basic fetch handler with a 404 error condition for testing purposes.Exact payloads, commands, or snippets shown in A JavaScript worker script implementing a basic fetch handler with a 404 error condition for testing purposes.
examples/workers-testing-vitest-integration-write-your-first-test-cloudflare-work-9.textA JavaScript worker script implementing a fetch handler with a 404 error condition for testing purposes.Exact payloads, commands, or snippets shown in A JavaScript worker script implementing a fetch handler with a 404 error condition for testing purposes.
examples/workers-testing-vitest-integration-write-your-first-test-cloudflare-work-10.textA Vitest test suite demonstrating how to import a worker and assert its response using the cloudflare:workers environment.Exact payloads, commands, or snippets shown in A Vitest test suite demonstrating how to import a worker and assert its response using the cloudflare:workers environ...
examples/workers-testing-vitest-integration-write-your-first-test-cloudflare-work-11.textA Vitest test suite demonstrating how to import a worker and assert its response using the cloudflare:workers environment.Exact payloads, commands, or snippets shown in A Vitest test suite demonstrating how to import a worker and assert its response using the cloudflare:workers environ...
examples/workers-testing-vitest-integration-write-your-first-test-cloudflare-work-12.textA Vitest test suite demonstrating how to test a Cloudflare Worker's fetch handler using the cloudflare:workers module.Exact payloads, commands, or snippets shown in A Vitest test suite demonstrating how to test a Cloudflare Worker's fetch handler using the cloudflare:workers module.

What This Skill Covers

  • This guide will instruct you through getting started with the @cloudflare/vitest-pool-workers package. For more complex examples of testing using @cloudflare...
  • Main sections: Prerequisites, Define Vitest configuration, Define types, Writing tests, Unit tests.

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/vitest-integration/write-your-first-test