Run prettier across the repo, exclude the lockfile from it
Prettier had never been run in --check mode here before, so this had drifted across most files (markdown tables, long option() chains, line wrapping). Purely formatting, no logic changes - needed so a CI format:check gate can actually pass. Adds .prettierignore for pnpm-lock.yaml specifically: prettier's YAML formatter rewrites every quoted key (single -> double quotes) producing an ~8700-line diff of pure noise on a file pnpm itself owns the formatting of. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,10 @@ import { test } from "node:test";
|
||||
import type { VariableConfig } from "../../lib/config/schema";
|
||||
import { coerceVariables, parseVarFlags } from "./variables";
|
||||
|
||||
function stringVar(name: string, overrides: Partial<VariableConfig> = {}): VariableConfig {
|
||||
function stringVar(
|
||||
name: string,
|
||||
overrides: Partial<VariableConfig> = {},
|
||||
): VariableConfig {
|
||||
return {
|
||||
type: "string",
|
||||
name,
|
||||
@@ -62,18 +65,32 @@ test("parseVarFlags rejects a flag with no '='", () => {
|
||||
});
|
||||
|
||||
test("coerceVariables coerces booleans and numbers, passes strings through", () => {
|
||||
const variables = [stringVar("environment"), boolVar("dryRun"), numberVar("replicas")];
|
||||
const variables = [
|
||||
stringVar("environment"),
|
||||
boolVar("dryRun"),
|
||||
numberVar("replicas"),
|
||||
];
|
||||
const values = coerceVariables(variables, {
|
||||
environment: ["staging"],
|
||||
dryRun: ["true"],
|
||||
replicas: ["3"],
|
||||
});
|
||||
assert.deepEqual(values, { environment: "staging", dryRun: true, replicas: 3 });
|
||||
assert.deepEqual(values, {
|
||||
environment: "staging",
|
||||
dryRun: true,
|
||||
replicas: 3,
|
||||
});
|
||||
});
|
||||
|
||||
test("coerceVariables rejects an invalid boolean/number", () => {
|
||||
assert.throws(() => coerceVariables([boolVar("dryRun")], { dryRun: ["yes"] }), /must be 'true' or 'false'/);
|
||||
assert.throws(() => coerceVariables([numberVar("replicas")], { replicas: ["abc"] }), /not a valid number/);
|
||||
assert.throws(
|
||||
() => coerceVariables([boolVar("dryRun")], { dryRun: ["yes"] }),
|
||||
/must be 'true' or 'false'/,
|
||||
);
|
||||
assert.throws(
|
||||
() => coerceVariables([numberVar("replicas")], { replicas: ["abc"] }),
|
||||
/not a valid number/,
|
||||
);
|
||||
});
|
||||
|
||||
test("coerceVariables collects a multiselect variable's repeats into an array", () => {
|
||||
@@ -85,7 +102,8 @@ test("coerceVariables collects a multiselect variable's repeats into an array",
|
||||
|
||||
test("coerceVariables rejects a non-multiselect variable given more than once", () => {
|
||||
assert.throws(
|
||||
() => coerceVariables([stringVar("environment")], { environment: ["a", "b"] }),
|
||||
() =>
|
||||
coerceVariables([stringVar("environment")], { environment: ["a", "b"] }),
|
||||
/given 2 times/,
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user