fix: ensure that version secrets commands do not write wrangler config warnings#7450
Conversation
🦋 Changeset detectedLatest commit: a80fb2c The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
5a9a2e4 to
a80fb2c
Compare
| expect(std.err).toMatchInlineSnapshot(`""`); | ||
| }); | ||
|
|
||
| // For some reason, this always hangs. Not sure why |
There was a problem hiding this comment.
This was broken because you cannot call useMockStdin() from within an it() clause since itself calls things like beforeEach().
| function mockGetVersionContent() { | ||
| msw.use( | ||
| http.get( | ||
| `*/accounts/:accountId/workers/scripts/:scriptName/content/v2?version=ce15c78b-cc43-4f60-b5a9-15ce4f298c2a`, |
There was a problem hiding this comment.
This was causing MockServiceWorkers (MSW) to write warnings to the console about a redundant query in the URL matcher.
|
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/12179779644/npm-package-wrangler-7450You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7450/npm-package-wrangler-7450Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-wrangler-7450 dev path/to/script.jsAdditional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-create-cloudflare-7450 --no-auto-updatenpm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-cloudflare-kv-asset-handler-7450npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-miniflare-7450npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-cloudflare-pages-shared-7450npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-cloudflare-vitest-pool-workers-7450npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-cloudflare-workers-editor-shared-7450npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-cloudflare-workers-shared-7450npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12179779644/npm-package-cloudflare-workflows-shared-7450Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
| const configPath = | ||
| args.config || (args.name && findWranglerConfig(path.dirname(args.name))); | ||
| return readConfig(configPath, args); | ||
| args.config || (entryPath && findWranglerConfig(path.dirname(entryPath))); |
There was a problem hiding this comment.
In the future I think we could somehow roll this into readConfig() itself and remove the need for this helper function at all.
andyjessop
left a comment
There was a problem hiding this comment.
Looks great, nice cleanup too. Thanks!
| // Include command specific args as well as the wrangler global flags | ||
| args: ReadConfigCommandArgs, | ||
| requirePagesConfig: true | ||
| options: { requirePagesConfig: true } |
|
|
||
| test("no wrangler configuration warnings shown", async () => { | ||
| await writeFile("secrets.json", JSON.stringify({ SECRET_1: "secret-1" })); | ||
| await writeFile("wrangler.json", JSON.stringify({ invalid_field: true })); |
There was a problem hiding this comment.
Nit, but could this use the writeWranglerConfig helper?
There was a problem hiding this comment.
Not really because that requires that the input object matches the RawConfig type, which then requires an awkward cast.
Fixes #0000
Ensures that version secrets commands do not write wrangler config warnings.
This was a regression introduced by #7437.