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.
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
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/workers-testing-vitest-integration-write-your-first-test-workflow-guide.md | A 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.text | A 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.text | The 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.text | The 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.text | The 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.text | A 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.text | A 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.text | A 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.text | A 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.text | A 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.text | A 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.text | A 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.text | A 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
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - 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
