Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changeset/many-fishes-raise.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ npx jscodeshift -t https://unpkg.com/@cloudflare/vitest-pool-workers/dist/codemo
- **`isolatedStorage` & `singleWorker`:** These have been removed in favour of a simpler isolation model that more closely matches Vitest. Storage isolation is now on a per test file basis, and you can make your test files share the same storage by using the Vitest flags `--max-workers=1 --no-isolate`
- **`import { env, SELF } from "cloudflare:test"`:** These have been removed in favour of `import { env, exports } from "cloudflare:workers"`. `exports.default.fetch()` has the same behaviour as `SELF.fetch()`, except that it doesn't expose Assets. To test your assets, write an integration test using [`startDevWorker()`](https://developers.cloudflare.com/workers/testing/unstable_startworker/)
- **`import { fetchMock } from "cloudflare:test"`:** This has been removed. Instead, [mock `globalThis.fetch`](https://github.com/cloudflare/workers-sdk/blob/main/fixtures/vitest-pool-workers-examples/request-mocking/test/imperative.test.ts) or use ecosystem libraries like [MSW (recommended)](https://mswjs.io/).
- **Vitest peer dependency:** `@cloudflare/vitest-pool-workers` requires `vitest@^4.0.18`. Both the stable `4.0.x` and `4.1.x` release lines are supported.
6 changes: 3 additions & 3 deletions packages/vitest-pool-workers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@
"vitest": "catalog:default"
},
"peerDependencies": {
"@vitest/runner": "4.1.0-beta.4",
"@vitest/snapshot": "4.1.0-beta.4",
"vitest": "4.1.0-beta.4"
"@vitest/runner": "^4.0.18",
"@vitest/snapshot": "^4.0.18",
"vitest": "^4.0.18"
},
"volta": {
"extends": "../../package.json"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import assert from "node:assert";
import { dirname } from "node:path";
import { env } from "cloudflare:workers";
import { VitestSnapshotEnvironment } from "vitest/runtime";
import { VitestSnapshotEnvironment } from "vitest/snapshot";

// Define a custom `SnapshotEnvironment` that uses a service binding for file
// system operations, rather than `node:fs`
Expand Down
Loading
Loading