Skip to content

Commit 4ee43c7

Browse files
test: ensure Wrangler tests run in a deterministic locale
1 parent f1dc739 commit 4ee43c7

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/wrangler/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"generate-json-schema": "pnpm exec ts-json-schema-generator --no-type-check --path src/config/config.ts --type RawConfig --out config-schema.json",
6262
"prepublishOnly": "SOURCEMAPS=false pnpm run -w build",
6363
"start": "pnpm run bundle && cross-env NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
64-
"test": "pnpm run assert-git-version && vitest",
64+
"test": "pnpm run assert-git-version && LC_ALL=C vitest",
6565
"test:ci": "pnpm run test run",
6666
"test:debug": "pnpm run test --silent=false --verbose=true",
6767
"test:e2e": "vitest -c ./e2e/vitest.config.mts",

packages/wrangler/src/__tests__/vitest.setup.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-disable @typescript-eslint/consistent-type-imports */
2+
import assert from "node:assert";
23
import { resolve } from "path";
34
import { PassThrough } from "stream";
45
import chalk from "chalk";
@@ -22,8 +23,10 @@ chalk.level = 0;
2223
global as unknown as { __RELATIVE_PACKAGE_PATH__: string }
2324
).__RELATIVE_PACKAGE_PATH__ = "..";
2425

25-
// Set `LC_ALL` to fix the language as English for the messages thrown by Yargs.
26-
process.env.LC_ALL = "en";
26+
assert(
27+
process.env.LC_ALL === "C",
28+
"Expected `LC_ALL` env var to be 'C' in order get deterministic localized messages in tests"
29+
);
2730

2831
vi.mock("ansi-escapes", () => {
2932
return {

0 commit comments

Comments
 (0)