From 81a24767837e8c727afd8ada9d4e1bac85335e71 Mon Sep 17 00:00:00 2001 From: Edmund Hung Date: Fri, 14 Feb 2025 14:47:06 +0000 Subject: [PATCH 1/2] docs(vitest-integration): clarify why we recommend the vitest integration --- src/content/docs/workers/testing/index.mdx | 2 +- src/content/docs/workers/testing/unit-testing.mdx | 2 +- .../workers/testing/vitest-integration/get-started/index.mdx | 2 +- src/content/docs/workers/testing/vitest-integration/index.mdx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/content/docs/workers/testing/index.mdx b/src/content/docs/workers/testing/index.mdx index 88d0a51cdfab88..fafed05b020739 100644 --- a/src/content/docs/workers/testing/index.mdx +++ b/src/content/docs/workers/testing/index.mdx @@ -7,7 +7,7 @@ sidebar: import { Render, LinkButton } from "~/components"; -The Workers platform has a variety of ways to test your applications, depending on your requirements. We recommend using the [VitestĀ integration](/workers/testing/vitest-integration), which allows for unit testing individual functions within your Worker. However, if you don't use Vitest, both [Miniflare'sĀ API](/workers/testing/miniflare/writing-tests) and the [`unstable_startWorker()`](/workers/wrangler/api/#unstable_startworker) API provide options for testing your Worker in any testing framework. +The Workers platform has a variety of ways to test your applications, depending on your requirements. We recommend using the [Vitest integration](/workers/testing/vitest-integration), which allows for unit testing individual functions within [workerd](https://github.com/cloudflare/workerd). However, if you don't use Vitest, both [Miniflare's API](/workers/testing/miniflare/writing-tests) and the [`unstable_startWorker()`](/workers/wrangler/api/#unstable_startworker) API provide options for testing your Worker in any testing framework. Write your first test diff --git a/src/content/docs/workers/testing/unit-testing.mdx b/src/content/docs/workers/testing/unit-testing.mdx index 971092d45c921b..4fc56157568e38 100644 --- a/src/content/docs/workers/testing/unit-testing.mdx +++ b/src/content/docs/workers/testing/unit-testing.mdx @@ -39,7 +39,7 @@ This test only verifies that the `add` function is returning the correct value, ## Vitest integration -The recommended way to unit test your Workers is by using the Workers Vitest integration. For more information on features, as well as installation and setup instructions, refer to the [Vitest integration Get Started guide](/workers/testing/vitest-integration/get-started/). +Testing Workers within our Workers runtime can be challenging and requires additional manual setup. Our Workers Vitest integration simplifies this process for most projects. For more details on features and setup instructions, see the [Vitest integration Get Started guide](/workers/testing/vitest-integration/get-started/). diff --git a/src/content/docs/workers/testing/vitest-integration/get-started/index.mdx b/src/content/docs/workers/testing/vitest-integration/get-started/index.mdx index 7ab2eddee99e03..e08105744b86bc 100644 --- a/src/content/docs/workers/testing/vitest-integration/get-started/index.mdx +++ b/src/content/docs/workers/testing/vitest-integration/get-started/index.mdx @@ -10,7 +10,7 @@ description: Install and set up the Workers Vitest integration. import { DirectoryListing } from "~/components" -For most users, Cloudflare recommends using the Workers Vitest integration for testing Workers and [Pages Functions](/pages/functions/) projects. [Vitest](https://vitest.dev/) is a popular JavaScript testing framework featuring a very fast watch mode, Jest compatibility, and out-of-the-box support for TypeScript. In this integration, Cloudflare provides a custom pool that allows your Vitest tests to run *inside* the Workers runtime. +Testing Workers and Pages Functions within our Workers runtime can be challenging and requires additional manual setup. To address this, Cloudflare offers the Workers Vitest integration, which streamlines the process by providing a custom pool that lets your tests run directly inside the Workers runtime using [Vitest](https://vitest.dev/). Vitest is a modern JavaScript testing framework with a wide range of features such as an instant watch mode, snapshot testing, code coverage, built-in TypeScript support and seamless Jest compatibility. The Workers Vitest integration: diff --git a/src/content/docs/workers/testing/vitest-integration/index.mdx b/src/content/docs/workers/testing/vitest-integration/index.mdx index 68fbdcd5d280ac..411f5d750e8b00 100644 --- a/src/content/docs/workers/testing/vitest-integration/index.mdx +++ b/src/content/docs/workers/testing/vitest-integration/index.mdx @@ -8,7 +8,7 @@ sidebar: import { DirectoryListing, Render } from "~/components" -Information about the Workers Vitest integration - the recommended package for writing unit and integration tests for Workers. +Information about the Workers Vitest integration: From ac857ed6bdcc02662b796cc1c4e380b5c48df87a Mon Sep 17 00:00:00 2001 From: ToriLindsay Date: Thu, 8 May 2025 10:28:15 +0100 Subject: [PATCH 2/2] Update src/content/docs/workers/testing/vitest-integration/get-started/index.mdx --- .../workers/testing/vitest-integration/get-started/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/workers/testing/vitest-integration/get-started/index.mdx b/src/content/docs/workers/testing/vitest-integration/get-started/index.mdx index e08105744b86bc..a761fe66d58b5e 100644 --- a/src/content/docs/workers/testing/vitest-integration/get-started/index.mdx +++ b/src/content/docs/workers/testing/vitest-integration/get-started/index.mdx @@ -10,7 +10,7 @@ description: Install and set up the Workers Vitest integration. import { DirectoryListing } from "~/components" -Testing Workers and Pages Functions within our Workers runtime can be challenging and requires additional manual setup. To address this, Cloudflare offers the Workers Vitest integration, which streamlines the process by providing a custom pool that lets your tests run directly inside the Workers runtime using [Vitest](https://vitest.dev/). Vitest is a modern JavaScript testing framework with a wide range of features such as an instant watch mode, snapshot testing, code coverage, built-in TypeScript support and seamless Jest compatibility. +Testing Workers and Pages Functions within our Workers runtime can be challenging and requires additional manual setup. To address this, Cloudflare offers the Workers Vitest integration, which streamlines the process by providing a custom pool that lets your tests run directly inside the Workers runtime using [Vitest](https://vitest.dev/). Vitest is a modern JavaScript testing framework with a wide range of features such as an instant watch mode, snapshot testing, code coverage, built-in TypeScript support, and seamless Jest compatibility. The Workers Vitest integration: