Skip to content

Use vitest#expect from the local context#12415

Merged
vicb merged 1 commit intomainfrom
vicn/expect-wrangler-3
Feb 5, 2026
Merged

Use vitest#expect from the local context#12415
vicb merged 1 commit intomainfrom
vicn/expect-wrangler-3

Conversation

@vicb
Copy link
Copy Markdown
Contributor

@vicb vicb commented Feb 4, 2026

Part of #12346

Part of a series (#12347, #12356, #12373, #12385, #12403, #12412) handling simple refactors, one package at a time to keep the review simpler.

This PR handles bucket 3 out of 4 of the wrangler package.

Code was created by OpenNext/Opus:

Overview

Bucket 3 migration for the no-vitest-import-expect ESLint rule. Migration involved converting trivial files to use { expect } from test context and adding eslint-disable comments to complex files.

All Changed Files (41 files)

ESLint Configuration

  • packages/wrangler/eslint.config.mjs - Added bucket 3 pattern

versions/ (12 files)

Trivial (converted to { expect })

  • deployments/deployments.list.test.ts
  • deployments/deployments.status.test.ts
  • deployments/deployments.view.test.ts
  • versions.help.test.ts
  • versions.list.test.ts
  • versions.view.test.ts

Complex (eslint-disable added)

File Reason
secrets/bulk.test.ts expect in mockPostVersion callback
secrets/delete.test.ts expect in mockPostVersion callback
secrets/list.test.ts expect in MSW handler callbacks
secrets/put.test.ts expect in mockPostVersion callback
versions.deploy.test.ts Uses test.each patterns
versions.upload.test.ts expect in MSW handler callbacks

autoconfig/ (8 files)

Trivial (converted to { expect })

  • get-installed-package-version.test.ts
  • run-summary.test.ts
  • vite-config.test.ts
  • details/confirm-auto-config-details.test.ts
  • details/display-auto-config-details.test.ts

Complex (eslint-disable added)

File Reason
run.test.ts expect in module-scope helper function
details/get-details-for-auto-config.test.ts expect in helper functions
details/get-worker-name-from-project.test.ts expect in helper functions

api/startDevWorker/ (5 files)

Trivial (converted to { expect })

  • utils.test.ts

Complex (eslint-disable added)

File Reason
BundleController.test.ts Complex test patterns
ConfigController.test.ts Complex test patterns
LocalRuntimeController.test.ts Complex test patterns
RemoteRuntimeController.test.ts Complex test patterns

deploy/ (3 files)

Trivial (converted to { expect })

  • check-remote-secrets-override.test.ts
  • get-config-patch.test.ts
  • get-remote-config-diff.test.ts

dev/ (2 files)

Trivial (converted to { expect })

  • remote-bindings.test.ts
  • remote-bindings-errors.test.ts

config/ (2 files)

Trivial (converted to { expect })

  • loadDotEnv.test.ts

Complex (eslint-disable added)

File Reason
configuration.test.ts Large file with complex patterns

utils/ (5 files)

Trivial (converted to { expect })

  • create-batches.test.ts
  • format-message.test.ts
  • getValidBindingName.test.ts
  • retry.test.ts

Complex (eslint-disable added)

File Reason
log-file.test.ts expect in helper functions

core/ (2 files)

Trivial (converted to { expect })

  • command-registration.test.ts
  • handle-errors.test.ts

metrics/ (1 file)

Trivial (converted to { expect })

  • sanitization.test.ts

Summary Statistics

Category Count
Total files changed 41
Trivial files migrated 26
Complex files (eslint-disable) 14
Config files 1

ESLint Configuration

The bucket 3 pattern added to packages/wrangler/eslint.config.mjs:

// Bucket 3: versions, autoconfig, api, deploy, dev, config, utils, core, metrics
{
  files: [
    "src/__tests__/{versions,autoconfig,api,deploy,dev,config,utils,core,metrics}/**/*.test.ts",
  ],
  rules: {
    "workers-sdk/no-vitest-import-expect": "error",
  },
},

Verification

pnpm --filter wrangler check:lint

Passes with no errors related to no-vitest-import-expect in bucket 3 directories.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: no user f

A picture of a cute animal (not mandatory, but encouraged)


Open with Devin

@vicb vicb requested a review from a team as a code owner February 4, 2026 19:12
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 4, 2026

⚠️ No Changeset found

Latest commit: c156b50

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional flags.

Open in Devin Review

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Feb 4, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@12415

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@12415

miniflare

npm i https://pkg.pr.new/miniflare@12415

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@12415

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@12415

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@12415

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@12415

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@12415

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@12415

wrangler

npm i https://pkg.pr.new/wrangler@12415

commit: c156b50

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Feb 5, 2026
@vicb vicb merged commit ddd1baa into main Feb 5, 2026
52 of 60 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Feb 5, 2026
@vicb vicb deleted the vicn/expect-wrangler-3 branch February 5, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants