Skip to content

Commit 7d5bd0a

Browse files
Merge master into dependabot/npm_and_yarn/body-parser-2.2.1
2 parents ffb63ac + a77940f commit 7d5bd0a

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

.changeset/1906.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@asyncapi/cli': patch
3+
---
4+
5+
fix: show the correct path to the newly created optimized file
6+
7+
- e16ebf5: fix: show the correct path to the newly created optimized file
8+
9+

src/apps/cli/commands/optimize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export default class Optimize extends Command {
174174
case Outputs.NEW_FILE:
175175
await writeFile(newPath, optimizedDocument, { encoding: 'utf8' });
176176
this.log(
177-
`✅ Success! Your optimized file has been created at ${chalk.blue({ newPath })}.`,
177+
`✅ Success! Your optimized file has been created at ${chalk.blue(newPath)}.`,
178178
);
179179
break;
180180
case Outputs.OVERWRITE:

test/integration/optimize.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ describe('optimize', () => {
143143
.stderr()
144144
.stdout()
145145
.command(['optimize', unoptimizedYamlFile, '--no-tty', '-o', 'new-file'])
146-
.it('generate YAML output against YAML input.', (ctx, done) => {
146+
.it('generate YAML output against YAML input and show its path.', (ctx, done) => {
147147
const pos = unoptimizedYamlFile.lastIndexOf('.');
148148
const optimizedFile = `${unoptimizedYamlFile.substring(0, pos)}_optimized.${unoptimizedYamlFile.substring(pos + 1)}`;
149-
expect(ctx.stdout).to.contain('✅ Success! Your optimized file has been created at ');
149+
expect(ctx.stdout).to.contain(`✅ Success! Your optimized file has been created at ${optimizedFile}.`);
150150
expect(ctx.stderr).to.equal('');
151151
expect(fs.readFileSync(optimizedFile, 'utf8')).to.contain('asyncapi: 2.0.0');
152152
fs.unlinkSync(optimizedFile);
@@ -157,10 +157,10 @@ describe('optimize', () => {
157157
.stderr()
158158
.stdout()
159159
.command(['optimize', unoptimizedJsonFile, '--no-tty', '-o', 'new-file'])
160-
.it('generate JSON output against JSON input.', (ctx, done) => {
160+
.it('generate JSON output against JSON input and show its path.', (ctx, done) => {
161161
const pos = unoptimizedJsonFile.lastIndexOf('.');
162162
const optimizedFile = `${unoptimizedJsonFile.substring(0, pos)}_optimized.${unoptimizedJsonFile.substring(pos + 1)}`;
163-
expect(ctx.stdout).to.contain('✅ Success! Your optimized file has been created at ');
163+
expect(ctx.stdout).to.contain(`✅ Success! Your optimized file has been created at ${optimizedFile}.`);
164164
expect(ctx.stderr).to.equal('');
165165
expect(fs.readFileSync(optimizedFile, 'utf8')).to.contain('"asyncapi": "2.0.0"');
166166
fs.unlinkSync(optimizedFile);

0 commit comments

Comments
 (0)