Skip to content
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

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

Merged
merged 1 commit into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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