Skip to content

Commit

Permalink
bug: wrangler pages functions does not log a beta warning
Browse files Browse the repository at this point in the history
In #661, we wrote a test, but didn't actually test if the error gets thrown. Being explicit about the thrown error shows that the  error doesn't get thrown, and the warning doesn't get logged.
  • Loading branch information
threepointone committed Mar 29, 2022
1 parent e2b7352 commit b964ebb
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/wrangler/src/__tests__/pages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,36 @@ describe("subcommand implicit help ran on imcomplete command execution", () => {
describe("beta message for subcommands", () => {
const isWindows = process.platform === "win32";
it("should display for pages:dev", async () => {
let err: Error | undefined;
try {
execaSync("npx", ["wrangler", "pages", "dev"], {
shell: isWindows,
env: { BROWSER: "none", ...process.env },
}).stderr;
} catch (e: unknown) {
expect(e).toMatchInlineSnapshot(`
err = e as Error;
}
expect(err).toMatchInlineSnapshot(`
[Error: Command failed with exit code 1: npx wrangler pages dev
🚧 'wrangler pages <command>' is a beta command. Please report any issues to https://github.com/cloudflare/wrangler2/issues/new/choose
Must specify a directory of static assets to serve or a command to run.]
`);
}
});

it("should display for pages:functions", async () => {
let err: Error | undefined;
try {
execaSync("npx", ["wrangler", "pages", "functions"], {
shell: isWindows,
env: { BROWSER: "none", ...process.env },
}).stderr;
} catch (e: unknown) {
expect(e).toMatchInlineSnapshot(`
err = e as Error;
}
expect(err).toMatchInlineSnapshot(`
[Error: Command failed with exit code 1: npx wrangler pages functions
🚧 'wrangler pages <command>' is a beta command. Please report any issues to https://github.com/cloudflare/wrangler2/issues/new/choose
Must specify a directory of static assets to serve or a command to run.]
`);
}
});
});

0 comments on commit b964ebb

Please sign in to comment.