Skip to content

Commit

Permalink
feat: parameter overrides support double escape
Browse files Browse the repository at this point in the history
BREAKING CHANGE
  • Loading branch information
joscha committed Sep 3, 2021
1 parent e1abeb9 commit 350cf7e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/__tests__/command.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,16 @@ describe('buildkite-graph', () => {
.withParameterOverride('priority', 'MY_PRIORITY')
.toJson(),
).resolves.toEqual(
expect.objectContaining({ priority: '${MY_PRIORITY}' }),
expect.objectContaining({ priority: '$MY_PRIORITY' }),
);
});
it('supports double escape', async () => {
await expect(
new CommandStep('noop')
.withParameterOverride('priority', '$MY_PRIORITY')
.toJson(),
).resolves.toEqual(
expect.objectContaining({ priority: '$$MY_PRIORITY' }),
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/steps/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export class CommandStep extends LabeledStep {

private valueWithOverride<T>(value: T, key: CommandProperty): string | T {
if (this.overrides.has(key)) {
return `$\{${this.overrides.get(key) as string}}`;
return ('$' + this.overrides.get(key)) as string;
}
return value;
}
Expand Down

0 comments on commit 350cf7e

Please sign in to comment.