-
Notifications
You must be signed in to change notification settings - Fork 829
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
Upgrade @cloudflare/vitest-pool-workers
to Vitest v2+
#6232
Conversation
🦋 Changeset detectedLatest commit: acc0f99 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10852453045/npm-package-wrangler-6232 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/6232/npm-package-wrangler-6232 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10852453045/npm-package-wrangler-6232 dev path/to/script.js Additional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10852453045/npm-package-create-cloudflare-6232 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10852453045/npm-package-cloudflare-kv-asset-handler-6232 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10852453045/npm-package-miniflare-6232 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10852453045/npm-package-cloudflare-pages-shared-6232 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10852453045/npm-package-cloudflare-vitest-pool-workers-6232 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10852453045/npm-package-cloudflare-workers-editor-shared-6232 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/10852453045/npm-package-cloudflare-workers-shared-6232 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
This ends up with an error for now npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @cloudflare/vitest-pool-workers@0.4.14
npm error Found: vitest@2.0.3
npm error node_modules/vitest
npm error peerOptional vitest@"*" from eslint-plugin-vitest@0.5.4
npm error node_modules/eslint-plugin-vitest
npm error dev eslint-plugin-vitest@"^0.5.4" from the root project
npm error peerOptional vitest@">= 0.32" from @testing-library/jest-dom@6.4.6
npm error node_modules/@testing-library/jest-dom
npm error dev @testing-library/jest-dom@"^6.4.6" from the root project
npm error 2 more (@vitest/coverage-v8, the root project)
npm error
npm error Could not resolve dependency:
npm error peer vitest@"1.3.x - 1.5.x" from @cloudflare/vitest-pool-workers@0.4.14
npm error node_modules/@cloudflare/vitest-pool-workers
npm error dev @cloudflare/vitest-pool-workers@"^0.4.14" from the root project
npm error
npm error Conflicting peer dependency: vitest@1.5.3
npm error node_modules/vitest
npm error peer vitest@"1.3.x - 1.5.x" from @cloudflare/vitest-pool-workers@0.4.14
npm error node_modules/@cloudflare/vitest-pool-workers
npm error dev @cloudflare/vitest-pool-workers@"^0.4.14" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution. |
I'd love to test these changes but have found that trying to reference the PR release for |
Do we have any ETA of when this will be ready to use? |
expect(result.stdout).toMatch( | ||
"stdout | index.test.ts:4:10\nnew describe" |
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.
This seems to be a change in the Vitest output to remove line numbers (verified by upgrading Wrangler to Vitest v2+ and seeing the change)
0e508f5
to
f9a02b7
Compare
"@vitest/runner": "2.0.x", | ||
"@vitest/snapshot": "2.0.x", | ||
"vitest": "2.0.x" |
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.
These don't use the catalog because I'm hopeful we can make it a range in future
import { unstable_dev } from "wrangler"; | ||
|
||
let output = ""; | ||
function spyOnConsoleMethod(name: keyof typeof console) { | ||
vi.spyOn(console, name).mockImplementation((...args: unknown[]) => { | ||
(vi.spyOn(console, name) as Mock).mockImplementation((...args: unknown[]) => { |
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.
For reference this is needed because the name
variable here does not result in the spyOn()
function being narrowed enough for it to generate a sensible return type, resultng in never
.
4095808
to
acc0f99
Compare
What this PR solves / how to test
Fixes #6215
Author has addressed the following
@cloudflare/vitest-pool-workers
now requires Vitest v2 cloudflare-docs#16827