Skip to content

Conversation

@edmundhung
Copy link
Member

Summary

It wasn't clear enough to people why we recommend Vitest and what vitest-pool-workers resolves. Hopefully this will improve the messaging around it.

Screenshots (optional)

Documentation checklist

  • The documentation style guide has been adhered to.
  • If a larger change - such as adding a new page- an issue has been opened in relation to any incorrect or out of date information that this PR fixes.
  • Files which have changed name or location have been allocated redirects.

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"requires additional manual setup"

Additional compared to what?

@ToriLindsay ToriLindsay requested a review from a team as a code owner May 8, 2025 09:28
@hyperlint-ai
Copy link
Contributor

hyperlint-ai bot commented May 8, 2025

Howdy and thanks for contributing to our repo. The Cloudflare team reviews new, external PRs within two (2) weeks. If it's been two weeks or longer without any movement, please tag the PR Assignees in a comment.

We review internal PRs within 1 week. If it's something urgent or has been sitting without a comment, start a thread in the Developer Docs space internally.


PR Change Summary

Improved messaging around the recommendation of the Vitest integration for testing Workers, clarifying its benefits and setup process.

  • Enhanced clarity on why Vitest is recommended for testing Workers.
  • Updated descriptions to highlight the challenges of testing within the Workers runtime.
  • Provided more details on the features of the Vitest integration.

Modified Files

  • src/content/docs/workers/testing/index.mdx
  • src/content/docs/workers/testing/unit-testing.mdx
  • src/content/docs/workers/testing/vitest-integration/get-started/index.mdx
  • src/content/docs/workers/testing/vitest-integration/index.mdx

How can I customize these reviews?

Check out the Hyperlint AI Reviewer docs for more information on how to customize the review.

If you just want to ignore it on this PR, you can add the hyperlint-ignore label to the PR. Future changes won't trigger a Hyperlint review.

Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add hyperlint-ignore to the PR to ignore the link check for this PR.

@ToriLindsay
Copy link
Contributor

Hi @edmundhung - This has merge conflicts and it says that they're too complex to resolve in the web editor. It would probably just be easiest to create a new PR? Let me know if you'd like me to do that for you and close this one.

@kodster28
Copy link
Collaborator

Closing out as this section has changed considerably (and seems much clearer overall now).

If desired, you could do a new PR against https://developers.cloudflare.com/workers/testing/vitest-integration/, where an amended version of the original description lives.

@kodster28 kodster28 closed this May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:workers Related to Workers product size/xs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants