Skip to content

Commit

Permalink
test: fix width of wrangler build warning in unit tests
Browse files Browse the repository at this point in the history
Previously this was passing with `npm test` but failing with
`npm run test-watch` because in the latter it was taking the
current screen width, which changes depending upon your
current setuop.
  • Loading branch information
petebacondarwin committed Jun 14, 2022
1 parent 5206c24 commit e5a3814
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/wrangler/src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ describe("wrangler", () => {
expect(std.out).toMatchInlineSnapshot(`
"▲ [WARNING] Deprecation: \`wrangler build\` has been deprecated.
Please refer to https://developers.cloudflare.com/workers/wrangler/migration/deprecations/#build for more information.
Please refer to https://developers.cloudflare.com/workers/wrangler/migration/deprecations/#build
for more information.
Attempting to run \`wrangler publish --dry-run --outdir=dist\` for you instead:
Expand Down
3 changes: 2 additions & 1 deletion packages/wrangler/src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as fs from "node:fs";
import { resolve } from "node:path";
import TOML from "@iarna/toml";
import { formatMessagesSync } from "esbuild";
import { logger } from "./logger";

export type Message = {
text: string;
Expand Down Expand Up @@ -38,7 +39,7 @@ export function formatMessage(
const lines = formatMessagesSync([input], {
color,
kind: kind,
terminalWidth: process.stderr.columns,
terminalWidth: logger.columns,
});
return lines.join("\n");
}
Expand Down

0 comments on commit e5a3814

Please sign in to comment.