Skip to content

Commit

Permalink
fix: don't fetch migrations when in --dry-run mode
Browse files Browse the repository at this point in the history
Fixes #1038
  • Loading branch information
threepointone committed May 17, 2022
1 parent 3545e41 commit e4c0c42
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .changeset/lazy-sheep-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

fix: don't fetch migrations when in `--dry-run` mode

Fixes https://github.com/cloudflare/wrangler2/issues/1038
9 changes: 8 additions & 1 deletion packages/wrangler/src/__tests__/publish.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4627,7 +4627,14 @@ addEventListener('fetch', event => {});`

describe("--dry-run", () => {
it("should not publish the worker if --dry-run is specified", async () => {
writeWranglerToml();
writeWranglerToml({
// add a durable object with migrations
// to make sure we _don't_ fetch migration status
durable_objects: {
bindings: [{ name: "NAME", class_name: "SomeClass" }],
},
migrations: [{ tag: "v1", new_classes: ["SomeClass"] }],
});
writeWorkerSource();
await runWrangler("publish index.js --dry-run");
expect(std).toMatchInlineSnapshot(`
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export default async function publish(props: Props): Promise<void> {

// if config.migrations
let migrations;
if (config.migrations.length > 0) {
if (!props.dryRun && config.migrations.length > 0) {
// get current migration tag
type ScriptData = { id: string; migration_tag?: string };
let script: ScriptData | undefined;
Expand Down

0 comments on commit e4c0c42

Please sign in to comment.