Skip to content

Commit

Permalink
Fix diagnostic flag parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
codykaup committed Nov 1, 2024
1 parent db3848b commit d66dee9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 6 additions & 0 deletions node-src/lib/getOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,10 @@ describe('getOptions', () => {
uploadMetadata: true,
});
});

it('allows you to specify a diagnostics file name', async () => {
expect(getOptions(getContext(['--diagnostics-file', 'output.json']))).toMatchObject({
diagnosticsFile: 'output.json',
});
});
});
6 changes: 2 additions & 4 deletions node-src/lib/getOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,9 @@ export default function getOptions(ctx: InitialContext): Options {
forceRebuild: trueIfSet(flags.forceRebuild),
debug: flags.debug,
diagnosticsFile:
defaultIfSet(flags.diagnosticsFile, DEFAULT_DIAGNOSTICS_FILE) ||
defaultUnlessSetOrFalse(flags.diagnosticsFile, DEFAULT_DIAGNOSTICS_FILE) ||
// for backwards compatibility
flags.diagnostics
? DEFAULT_DIAGNOSTICS_FILE
: undefined,
(flags.diagnostics ? DEFAULT_DIAGNOSTICS_FILE : undefined),
junitReport: defaultIfSet(flags.junitReport, DEFAULT_REPORT_FILE),
zip: flags.zip,
skipUpdateCheck: flags.skipUpdateCheck,
Expand Down

0 comments on commit d66dee9

Please sign in to comment.