Vitest type error in Github Actions and eslint

error: Cannot find package "cloudflare:test" from "
error: Cannot find package "cloudflare:test" from "
For some reason in both Github Actions and eslint it's failing to load the types, with the above error for both. I'm using the (newish) Vitest support for testing my Workers. See * https://blog.cloudflare.com/workers-vitest-integration * https://developers.cloudflare.com/workers/testing/vitest-integration/get-started/write-your-first-test/#define-vitest-configuration I'm using Typescript and bun. Would appreciate any suggestions on where to look! Here's my Github Action config:
name: Deploy Worker
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: '1.1.0'
- name: Install dependencies
run: bun install
- name: Lint
run: bun run lint
- name: Run tests
run: bun test
- name: Build & Deploy Worker
uses: cloudflare/[email protected]
with:
packageManager: bun
environment: production
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
name: Deploy Worker
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: '1.1.0'
- name: Install dependencies
run: bun install
- name: Lint
run: bun run lint
- name: Run tests
run: bun test
- name: Build & Deploy Worker
uses: cloudflare/[email protected]
with:
packageManager: bun
environment: production
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
The Cloudflare Blog
Improved Cloudflare Workers testing via Vitest and workerd
Today, we’re excited to announce a new Workers Vitest integration - allowing you to write unit and integration tests via the popular testing framework, Vitest, that execute directly in our runtime, workerd!
Cloudflare Docs
Write your first test · Cloudflare Workers docs
Write unit tests against Workers.
1 Reply
outsideurimagination
I'm getting the same locally. "@cloudflare/vitest-pool-workers" is in the tsconfig types and it declares this package https://github.com/cloudflare/workers-sdk/blob/main/packages/vitest-pool-workers/types/cloudflare-test.d.ts so I'm unsure what's going on. Using bun for reference
GitHub
workers-sdk/packages/vitest-pool-workers/types/cloudflare-test.d.ts...
⛅️ Home to Wrangler, the CLI for Cloudflare Workers® - cloudflare/workers-sdk
Want results from more Discord servers?
Add your server