Skip to content

Commit

Permalink
- r converting GenericDiffReporterBase to handle command options
Browse files Browse the repository at this point in the history
  • Loading branch information
ilandikov authored and isidore committed Sep 30, 2024
1 parent 20f1648 commit 58b39c7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Reporting/GenericDiffReporterBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default class GenericDiffReporterBase implements Reporter {
public exePath: string = "";
private _reporterFileLookedUp: boolean;
public setCommandArgs: (approved: string, received: string) => string[] = ((a: string, r: string) => [r,a]);
public modifyCommandOptions: (commandOptions: any) => any = ((c) => c);
private _reporterFileLookedUpAndFound: boolean;

constructor(name: string) {
Expand Down Expand Up @@ -135,7 +136,7 @@ export default class GenericDiffReporterBase implements Reporter {
}

getCommandArguments(approved: string, received: string, options: Partial<Config> = {}) {
const cmdOptions = options.cmdOptionOverrides;
const cmdOptions = this.modifyCommandOptions(options.cmdOptionOverrides);
const args = options.cmdArgs || this.setCommandArgs(approved, received);
return {cmdOptions, args};
}
Expand Down
8 changes: 8 additions & 0 deletions lib/Reporting/Reporters/vimdiffReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,13 @@ export default class Reporter extends GenericDiffReporterBase {
this.setCommandArgs = (approved, received) => {
return ["-d", received, approved];
};
this.modifyCommandOptions = (cmdOptions) => {
if (!cmdOptions) {
cmdOptions = {};
}

cmdOptions.stdio = "inherit";
return cmdOptions;
};
}
}
4 changes: 4 additions & 0 deletions test/Reporting/Reporters/VimDiffReporterTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ describe("Reporter", function () {

const args = reporter.getCommandArguments(approved, received);
assert.deepEqual(expectedCommand, args.args);
assert.deepEqual(args.cmdOptions, {
stdio: 'inherit',
});

});
});
});

0 comments on commit 58b39c7

Please sign in to comment.