Skip to content

Commit 7389d43

Browse files
skovhusclaude
andauthored
Only silence jscodeshift runner in tests, not in production (#359)
The `silent: true` option was hardcoded in `runTransform`, suppressing jscodeshift output even for real CLI usage. Add an opt-in `silent` option to `RunTransformOptions` (default false) and pass it through. Tests explicitly set `silent: true`. https://claude.ai/code/session_019oLJbbZntnGzsugStNT2Hf Co-authored-by: Claude <noreply@anthropic.com>
1 parent ace51a8 commit 7389d43

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/__tests__/run-prepass-failure-contract.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ describe("runTransform prepass failure contract", () => {
144144
consumerPaths: SAMPLE_FILE,
145145
adapter,
146146
dryRun: true,
147+
silent: true,
147148
});
148149
await expect(execution).rejects.toThrowError(
149150
/prepass failed while using externalInterface: "auto"/i,
@@ -188,6 +189,7 @@ describe("runTransform prepass failure contract", () => {
188189
consumerPaths: SAMPLE_FILE,
189190
adapter,
190191
dryRun: true,
192+
silent: true,
191193
});
192194

193195
expect(result.errors).toBe(0);

src/__tests__/run.e2e.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ describe("runTransform (e2e)", () => {
5555
dryRun: false,
5656
print: false,
5757
parser: "tsx",
58+
silent: true,
5859
});
5960

6061
expect(result.errors).toBe(0);

src/run.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ export interface RunTransformOptions {
9090
* @default 3
9191
*/
9292
maxExamples?: number;
93+
94+
/**
95+
* Suppress jscodeshift runner output.
96+
* @default false
97+
*/
98+
silent?: boolean;
9399
}
94100

95101
export interface RunTransformResult {
@@ -478,7 +484,7 @@ export async function runTransform(options: RunTransformOptions): Promise<RunTra
478484
// Programmatic use passes an Adapter object (functions). That cannot be
479485
// serialized across process boundaries, so we must run in-band.
480486
runInBand: true,
481-
silent: true,
487+
silent: options.silent ?? false,
482488
});
483489

484490
// Write sidecar .stylex.ts files (defineMarker declarations)

0 commit comments

Comments
 (0)