-
Notifications
You must be signed in to change notification settings - Fork 1.2k
chore: bump vitest to 1.5.0 and loosen version requirement for vitest-pool-workers #5458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c3ae2fe
f8a1917
ba379aa
87b9e1f
d8b2de1
fc11358
1261d4b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@cloudflare/vitest-pool-workers": patch | ||
| --- | ||
|
|
||
| fix: loosen the peer dependency version on vitest to support versions ranging from 1.3.0 to 1.5.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ import { | |
| testRegExps, | ||
| WebSocket, | ||
| } from "miniflare"; | ||
| import semverSatisfies from "semver/functions/satisfies.js"; | ||
|
||
| import { createMethodsRPC } from "vitest/node"; | ||
| import { createChunkingSocket } from "../shared/chunking-socket"; | ||
| import { OPTIONS_PATH, parseProjectOptions } from "./config"; | ||
|
|
@@ -56,7 +57,7 @@ import type { | |
| } from "vitest"; | ||
| import type { ProcessPool, Vitest, WorkspaceProject } from "vitest/node"; | ||
|
|
||
| // https://github.com/vitest-dev/vitest/blob/v1.3.0/packages/vite-node/src/client.ts#L386 | ||
| // https://github.com/vitest-dev/vitest/blob/v1.5.0/packages/vite-node/src/client.ts#L386 | ||
| declare const __vite_ssr_import__: unknown; | ||
| assert( | ||
| typeof __vite_ssr_import__ === "undefined", | ||
|
|
@@ -775,13 +776,13 @@ function assertCompatibleVitestVersion(ctx: Vitest) { | |
| "Expected to find `vitest`'s version" | ||
| ); | ||
|
|
||
| if (expectedVitestVersion !== actualVitestVersion) { | ||
| if (!semverSatisfies(actualVitestVersion, expectedVitestVersion)) { | ||
| const message = [ | ||
| `You're running \`vitest@${actualVitestVersion}\`, but this version of \`@cloudflare/vitest-pool-workers\` only supports \`vitest@${expectedVitestVersion}\`.`, | ||
| `You're running \`vitest@${actualVitestVersion}\`, but this version of \`@cloudflare/vitest-pool-workers\` only officially supports \`vitest ${expectedVitestVersion}\`.`, | ||
| "`@cloudflare/vitest-pool-workers` currently depends on internal Vitest APIs that are not protected by semantic-versioning guarantees.", | ||
| `Please install \`vitest@${expectedVitestVersion}\` to continue using \`@cloudflare/vitest-pool-workers\`.`, | ||
| `Your tests may work without issue, but we can not guarantee compatibility outside of the above version range.`, | ||
| ].join("\n"); | ||
| throw new Error(message); | ||
| log.warn(message); | ||
| } | ||
| } | ||
|
|
||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL - hyphenated ranges!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same!
>=1.3.0 || <= 1.5.xdidn't work as I expected, because1.2.0satisfied this, as it's < 1.5.x, but hyphenated worked great!