Skip to content

Commit

Permalink
Fix: vitest-pool-workers use env in .dev.vars (#6180)
Browse files Browse the repository at this point in the history
#5612 added support for selecting the environment of config used, but it missed passing it to the code that reads `.dev.vars.{environment}`
  • Loading branch information
Skye-31 committed Jul 2, 2024
1 parent 7951815 commit b994604
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .changeset/itchy-bags-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"wrangler": patch
"@cloudflare/vitest-pool-workers": patch
---

Fix: pass env to getBindings to support reading `.dev.vars.{environment}`

https://github.com/cloudflare/workers-sdk/pull/5612 added support for selecting the environment of config used, but it missed passing it to the code that reads `.dev.vars.{environment}`

Closes #5641
5 changes: 2 additions & 3 deletions packages/wrangler/src/api/integrations/platform/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,15 @@ export type SourcelessWorkerOptions = Omit<

export function unstable_getMiniflareWorkerOptions(
configPath: string,
environment?: string
env?: string
): {
workerOptions: SourcelessWorkerOptions;
define: Record<string, string>;
main?: string;
} {
const config = readConfig(configPath, {
experimentalJsonConfig: true,
env: environment,
env,
});

const modulesRules: ModuleRule[] = config.rules
Expand All @@ -256,7 +256,6 @@ export function unstable_getMiniflareWorkerOptions(
fallthrough: rule.fallthrough,
}));

const env = undefined;
const bindings = getBindings(config, env, true, {});
const { bindingOptions } = buildMiniflareBindingOptions({
name: undefined,
Expand Down

0 comments on commit b994604

Please sign in to comment.